Difference between revisions of "SNORT: Reputation Preprocessor"

From OnnoWiki
Jump to navigation Jump to search
 
(25 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
  
Disini, kita akan melihat Preprosesor Reputasi Snort. Kami akan melihat bagaimana preprosesor ini digunakan untuk menggunakan black list IP dan white list IP (dikenal bersama sebagai list IP) untuk memblokir, memperingatkan, atau mengizinkan lalu lintas berdasarkan alamat IP pengirim dan/atau penerima. Kami akan menunjukkan kepada Anda cara mengonfigurasi, menguji, dan memecahkan masalah preprocessor reputasi dan daftar IP terkait. Terakhir kita akan melihat bagaimana PulledPork dapat dikonfigurasi untuk mengunduh daftar hitam secara otomatis.
+
Disini, kita akan melihat Preprosesor Reputasi Snort. Kami akan melihat bagaimana preprosesor ini digunakan untuk menggunakan black list IP dan white list IP (dikenal bersama sebagai list IP) untuk memblokir, memperingatkan, atau mengizinkan lalu lintas berdasarkan alamat IP pengirim dan/atau penerima. Kami akan menunjukkan kepada Anda cara mengonfigurasi, menguji, dan memecahkan masalah preprocessor reputasi dan black list secara otomatis.
  
 
==Sejarah Preprosesor Reputasi==
 
==Sejarah Preprosesor Reputasi==
Line 20: Line 20:
 
Anda dapat membuat white list dan black list secara manual, meskipun Anda mungkin lebih baik menggunakan PulledPork untuk mengunduh file black list secara otomatis. Kabar baiknya adalah jika Anda menggunakan PulledPork dan preprosesor reputasi Anda telah dikonfigurasi dengan benar, semua ini akan bekerja untuk Anda. Jika Anda ingin mengubah cara kerja, melakukan sesuatu yang istimewa, atau hanya ingin memahami Snort dengan lebih baik, panduan ini cocok untuk Anda.
 
Anda dapat membuat white list dan black list secara manual, meskipun Anda mungkin lebih baik menggunakan PulledPork untuk mengunduh file black list secara otomatis. Kabar baiknya adalah jika Anda menggunakan PulledPork dan preprosesor reputasi Anda telah dikonfigurasi dengan benar, semua ini akan bekerja untuk Anda. Jika Anda ingin mengubah cara kerja, melakukan sesuatu yang istimewa, atau hanya ingin memahami Snort dengan lebih baik, panduan ini cocok untuk Anda.
  
==What Happens When a Packet Matches an Entry in an IP List==
+
==Apa Yang Terjadi Ketika Sebuah Paket Match dengan Entri dalam List IP==
  
Assuming your reputation preprocessor is configured correctly, and you have entries in your whitelist and blacklist files: the reputation preprocessor is the first processor that a packet encounters in Snort after being assembled by the decoder. The reputation preprocessor compares the source and destination IP addresses in the packet against the IP addresses in both the whitelist and blacklist files. If one of the IP addresses (sender or recipient) for the packet is on the blacklist, then an alert is generated (with GID:136, and SID:1) and no further processing is done on the packet (it skips all other processors and the rule engine). If you are running in NIDS mode, only an alert is generated. If you are running inline in IPS mode, then the packet is dropped. If one of the IP addresses is on a whitelist: the packet can either bypass all other preprocessors and the rule engine and continue on, or it can be “unblacked”. When a packet is unblocked, it is treated like a regular packet, being processed by the other preprocessors and rules, even if the address is on the blacklist.
+
Dengan asumsi preprosesor reputasi Anda dikonfigurasi dengan benar, dan Anda memiliki entri dalam file white list dan black list: reputation preprocessor adalah prosesor pertama yang ditemui paket di Snort setelah dirakit oleh dekoder. Reputation preprocessor membandingkan alamat IP sumber dan tujuan dalam paket dengan alamat IP dalam file white list dan black list. Jika salah satu alamat IP (pengirim atau penerima) untuk paket ada di black list, maka peringatan akan dikeluarkan (dengan GID:136, dan SID:1) dan tidak ada pemrosesan lebih lanjut yang dilakukan pada paket (melewati semua prosesor lainnya dan mesin aturan). Jika Anda menjalankan dalam mode NIDS, hanya peringatan yang dibuat. Jika Anda menjalankan inline dalam mode IPS, maka paket akan dibuang. Jika salah satu alamat IP ada di white list: paket dapat melewati semua preprosesor lain dan mesin aturan dan melanjutkan, atau dapat "unblacked". Ketika sebuah paket dibuka blokirnya, itu diperlakukan seperti paket biasa, sedang diproses oleh preprosesor dan aturan lain, bahkan jika alamatnya ada di black list.
  
If your Snort server is running as a NIDS (network intrusion detection system) then alerts are generated (we are detecting) for packets that match one of the IP lists. If you are running Snort as a NIPS (network intrusion prevention system), then traffic can be dropped instead of generating alerts when the packet IP address matches an IP in the blacklist . If one IP address is on the whitelist, and the other address is on the blacklist, the action taken will depend on your configuration, namely the priority and white reputation preprocessor options described below.
+
Jika server Snort Anda berjalan sebagai NIDS (network intrusion detection system) maka Alert akan dihasilkan (kami mendeteksi) untuk paket yang cocok dengan salah satu list IP. Jika Anda menjalankan Snort sebagai NIPS (Network Intrusion Prevention System), maka lalu lintas bahkan dapat dihentikan tidak sekedar menghasilkan Alert ketika alamat IP paket match dengan IP dalam black list. Jika satu alamat IP ada di white list, dan alamat lainnya ada di black list, tindakan yang diambil akan bergantung pada konfigurasi Anda, yaitu opsi preprocessor priority dan white reputation preprocessor yang akan dijelaskan selanjutnya.
  
==Configuring the Reputation Preprocessor==
+
==Mengkonfigurasi Reputation Preprocessor==
  
The reputation preprocessor is configured in your snort.conf. Many standard Snort installations place this file at /etc/snort/snort.conf. Open this snort configuration file and find the section for the reputation preprocessor. This should be around line number 506 if you haven’t changed your snort.conf much. If the preprocessor is disabled with the hash symbol (#) at the beginning of each line for the preprocessor, you can enable it by removing the hash symbol from the beginning of each line. The preprocessor configuration should look similar to the following when enabled:
+
Reputation preprocessor dikonfigurasi di snort.conf. Banyak instalasi Snort standar menempatkan file ini di /etc/snort/snort.conf. Buka file konfigurasi snort ini dan temukan bagian untuk reputation preprocessor. Ini harus berada di sekitar nomor baris 506 jika Anda belum banyak mengubah snort.conf. Jika preprocessor dinonaktifkan dengan simbol hash (#) di awal setiap baris untuk preprocessor, Anda dapat mengaktifkannya dengan menghapus simbol hash dari awal setiap baris. Konfigurasi reputation preprocessor akan terlihat serupa dengan yang berikut saat diaktifkan:
 
 
 
  # Reputation preprocessor. For more information see README.reputation
 
  # Reputation preprocessor. For more information see README.reputation
Line 38: Line 38:
 
     blacklist $BLACK_LIST_PATH/black_list.rules  
 
     blacklist $BLACK_LIST_PATH/black_list.rules  
  
There are a few other lines in your snort.conf that relate to IP lists as well. The following two lines tell Snort where the folder is that stores the whitelists and blacklists:
+
Ada beberapa baris lain di snort.conf Anda yang berhubungan dengan list IP. Dua baris berikut memberi tahu Snort di mana folder yang menyimpan white list dan black list:
  
 +
var WHITE_LIST_PATH /etc/snort/rules/iplists
 +
var BLACK_LIST_PATH /etc/snort/rules/iplists
  
var WHITE_LIST_PATH /etc/snort/rules/iplists        # line 113 in snort.conf
+
perhatikan bahwa Anda hanya dapat menggunakan jalur absolut untuk penilai WHITE_LIST_PATH dan BLACK_LIST_PATH daripada menggunakan $BLACK_LIST_PATH/filename seperti pada dua contoh di atas.
var BLACK_LIST_PATH /etc/snort/rules/iplists        # line 114 in snort.conf
 
  
note that you could just use an absolute path for WHITE_LIST_PATH and BLACK_LIST_PATH rater than using the $BLACK_LIST_PATH/filename as in the above two examples.
+
Kami juga memerlukan folder untuk menyimpan list IP Anda, dan white list dan black list kosong. Ketiga item ini adalah apa yang kami beri tahu Snort untuk digunakan di dua bagian snort.conf di atas (buat ini jika tidak ada, berdasarkan konfigurasi preprocessor Anda):
  
We also need a folder to hold your IP lists, and the empty whitelist and blacklist. These three items are what we told Snort to use in the above two sections of the snort.conf (create these if they don’t exist, based on your preprocessor configuration):
 
 
 
  # these commands will create your whitelist and blacklist files as configured in the above example
 
  # these commands will create your whitelist and blacklist files as configured in the above example
 
  sudo mkdir /etc/snort/rules/iplists
 
  sudo mkdir /etc/snort/rules/iplists
Line 53: Line 52:
 
  sudo touch /etc/snort/rules/iplists/white_list.rules
 
  sudo touch /etc/snort/rules/iplists/white_list.rules
  
Since you’ve edited your snort.conf, it’s always a good idea to test that you didn’t create any errors. A simple test (change for your system as needed) and make sure no issues are reported:
+
Karena Anda telah mengedit snort.conf Anda, selalu merupakan ide bagus untuk menguji apakah Anda tidak membuat kesalahan apa pun. Tes sederhana (ubah sistem Anda sesuai kebutuhan) dan pastikan tidak ada masalah yang dilaporkan, pastikan menggunakan nama interface jaringan yang benar:
+
 
 
  sudo snort -T -c /etc/snort/snort.conf -i eth0
 
  sudo snort -T -c /etc/snort/snort.conf -i eth0
 +
sudo snort -T -c /etc/snort/snort.conf -i enp0s3
  
==Manually Adding Entries to IP Lists==
+
==Menambahkan Entri ke List IP Secara Manual==
  
If you want to build your own whitelists and blacklists, this is easy. Snort can easily load multiple whitelists and blacklists (see the section below for instructions). The list should be a text document with either plain IP addresses (specifying a single host), or IP addresses in CIDR format, with one entry per line. You can have full-line and inline comments by using the hash (#) symbol. An example of all these options is below:
+
Jika Anda ingin membuat white list dan black list sendiri, ini mudah. Snort dapat dengan mudah memuat banyak white list dan black list. Daftar tersebut harus berupa dokumen teks dengan alamat IP biasa (menentukan satu host), atau alamat IP dalam format CIDR, dengan satu entri per baris. Anda dapat memiliki komentar full-line dan inline dengan menggunakan simbol hash (#). Contoh dari semua opsi ini adalah di bawah ini:
  
+
  # Ini adalah komentar baris penuh
# This is a full-line comment
+
  # List ini bisa menjadi white list atau black list,
# This list could be a whitelist or a blacklist, it only depends on what you tell Snort to treat it as
+
  # itu hanya tergantung pada apa yang Anda katakan kepada Snort untuk memperlakukannya
 
    
 
    
# Add these single hosts to this list:
+
  # Tambahkan host tunggal ini ke daftar ini:
10.0.0.120  
+
  10.0.0.120
10.0.0.222       # This is an inline comment.
+
  10.0.0.222 # Ini adalah komentar sebaris.
 
    
 
    
# Add these entire subnets (in CIDR format) to the list:
+
  # Tambahkan seluruh subnet ini (dalam format CIDR) ke dalam daftar:
10.2.0.0/24
+
  10.2.0.0/24
224.0.0.0/4     # add the entire multicast subnet to this list
+
  224.0.0.0/4 # tambahkan seluruh subnet multicast ke daftar ini
  
==Allowing Local IP Addresses==
+
==Mengijinkan Local IP Address==
 +
 
 +
Jika Anda ingin Reputation Preprocessor mengenali (bukan mengabaikan) alamat jaringan pribadi (yang ada di jaringan rumah atau internal Anda) yang semuanya termasuk dalam rentang lokal:
  
If you want the reputation preprocessor to recognize (not ignore) private network addresses (the ones on your home or internal network) which all fall in the local ranges:
 
  
 
     10.0.0.0 – 10.255.255.255 (10.0.0.0/8)
 
     10.0.0.0 – 10.255.255.255 (10.0.0.0/8)
Line 81: Line 82:
 
     192.168.0.0 – 192.168.255.255 (192.168.0.0/16)
 
     192.168.0.0 – 192.168.255.255 (192.168.0.0/16)
  
then add the scan_local option to the reputation preprocessor, as show below in line 6:
+
tambahkan opsi scan_local dalam konfigurasi reputation preprocessor, seperti tampak di bawah ini,
 
 
 
  # Reputation preprocessor. For more information see README.reputation
 
  # Reputation preprocessor. For more information see README.reputation
Line 92: Line 93:
 
     blacklist $BLACK_LIST_PATH/black_list.rules  
 
     blacklist $BLACK_LIST_PATH/black_list.rules  
  
This option allows you to test the reputation preprocessor with private addresses (alert on traffic from the 10.0.0.0/24 subnet for example). Without this option, all IP addresses in your IP lists from a private address will be not be compared against the IP lists.
+
Opsi ini memungkinkan Anda menguji Reputation Preprocessor dengan alamat private (peringatan lalu lintas dari subnet 10.0.0.0/24 misalnya). Tanpa opsi ini, semua alamat IP dalam daftar IP Anda dari alamat private tidak akan dibandingkan dengan list IP.
  
==Configuring IP List Actions and Precedence==
+
==Konfigurasi IP List Tindakan dan Prioritas==
  
The two reputation preprocessor configuration options that determine how IP lists affect the processing of packets are priority and white.
+
Dua opsi konfigurasi reputation preprocessor yang menentukan effek IP list pada pemrosesan paket adalah priority dan white.
 +
 
 +
* priority: Ketika sebuah paket memiliki satu IP pada black list dan IP lainnya pada white list (alamat IP pengirim dan alamat IP penerima), opsi ini menentukan mana yang lebih penting. Jika ini di set ke black list, maka paket akan menghasilkan Alert. Jika ini di set ke white list, maka proses akan diizinkan untuk lewat. Contoh pengaturan ini (dipotong untuk kesederhanaan):
  
priority: When a packet has one IP on a blacklist and the other IP on a whitelist (sender IP address and receiver IP address), this option determines which is more important. If this is set to blacklist, then the packet will generate an alert. If this is set to whitelist, then the process will be allowed to pass. An example of this setting (truncated for simplicity):
 
 
 
  preprocessor reputation: \
 
  preprocessor reputation: \
 
     priority whitelist, \
 
     priority whitelist, \
 
     ...
 
     ...
  
white: this option can be set to either unblack or trust. When set to unblack, if the packet also has an address that is in the IP blacklist (say the source IP address is in the whitelist and the destination ip address of that same packet is in the blacklist), then the packet will continue to process through the other preprocessors as if it was not on the blacklist. Note that for the packet to continue to be processed, the priority must be set to whitelist. When white is set to trust, then the packet is implicitly trusted and bypasses all further processing. An example of this:
+
* white: opsi ini dapat diatur ke unblack atau trust. Ketika diatur ke unblack, jika paket juga memiliki alamat yang ada di black list IP (misalkan alamat IP sumber ada di white list dan alamat ip tujuan dari paket yang sama ada di black list), maka paket akan terus diproses melalui preprosesor lain seolah-olah tidak ada dalam black list. Perhatikan bahwa agar paket dapat terus diproses, prioritas harus ditetapkan ke black list. Ketika white di set ke trust, maka paket dipercaya secara implisit dan melewati semua pemrosesan lebih lanjut. Contohnya:
 
 
 
  preprocessor reputation: \
 
  preprocessor reputation: \
Line 110: Line 111:
 
     ...
 
     ...
  
==Setting up local.rules to Generate Alerts for Blacklist Events==
+
==Setting local.rules untuk Alert saat ada event Blacklist==
  
If you are not using PulledPork to manage your rulesets, and have manually configured your whitelists and / or blacklists, you need to tell Snort to generate an alert when it sees packets that match these IP lists.
+
Jika Anda tidak menggunakan PulledPork untuk mengelola ruleset, dan telah mengonfigurasi white list dan/atau black list secara manual, Anda perlu memberi tahu Snort untuk membuat Alert ketika melihat paket yang match dengan list IP ini.
  
You need a local.rules file loaded by Snort with the following rules (if you need help setting this up, please see my article here):
+
Edit local.rules, masukan rule berikut,
 
 
 
  alert ( msg: "REPUTATION_EVENT_BLACKLIST"; sid: 1; gid: 136; rev: 1; metadata: rule-type preproc ; classtype:bad-unknown; )
 
  alert ( msg: "REPUTATION_EVENT_BLACKLIST"; sid: 1; gid: 136; rev: 1; metadata: rule-type preproc ; classtype:bad-unknown; )
 
  alert ( msg: "REPUTATION_EVENT_WHITELIST"; sid: 2; gid: 136; rev: 1; metadata: rule-type preproc ; classtype:bad-unknown; )
 
  alert ( msg: "REPUTATION_EVENT_WHITELIST"; sid: 2; gid: 136; rev: 1; metadata: rule-type preproc ; classtype:bad-unknown; )
  
NOTE: if you are using PulledPork to manage rules, you don’t need the above lines, it will add these rules automatically.
+
CATATAN: Bagi pengguna PulledPork, kita tidak perlu rule di atas, karena semua akan secara automatis di set oleh PulledPork.
  
Rules with GID 136 are rules triggered by the reputation preprocessor. There are 3 SID’s for that processor:
+
Rules dengan GID 136 adalah rules yang di trigger oleh reputation preprocessor. Ada tiga 3 SID dari processor:
  
    Packets are blacklisted
+
1 Packet adalah blacklist
    Packets are whitelisted
+
2 Packet adalah whitelist
    Packets are inspected
+
3 Packet inspected
  
We don’t want to create a rule with a SID of 3 because that would be a lot of alerts (essentially all packets).
+
Kita tidak membuat rule dengan SID 3 karena ini akan membuat banyak Alert, karena pada dasarnya semua packet adalah inspected.
  
There is an easy way to test the reputation processor works. First, make sure your reputation preprocessor is properly configured, and you have the two rules listed above in your local.rules file (and make sure that Snort is loading your local.rules).
+
Ada cara mudah untuk menguji kerja reputation processor. Pertama, pastikan reputation processor dikonfigurasi dengan benar, dan Anda memiliki dua aturan yang tercantum di atas dalam file local.rules Anda (dan pastikan Snort memuat local.rules Anda).
  
Next, add the IP address of a second host on your network (other than your snort host) to your black_list.rules file. This IP address will be the address that Snort generates alerts on, due to the IP address being in the blacklist file.
+
Selanjutnya, tambahkan alamat IP host kedua di jaringan Anda (selain host snort Anda) ke file black_list.rules. Alamat IP ini akan menjadi alamat di mana Snort menghasilkan peringatan, karena alamat IP ada di file black list.
 +
 
 +
Start Snort dengan perintah berikut (ubah untuk pengaturan sistem spesifik Anda). Ini akan menghasilkan peringatan ke konsol:
  
Start Snort with the following command (change for your specific system settings). This will generate alerts to the console:
 
 
 
 
  sudo /usr/local/bin/snort -A console -q -c /etc/snort/snort.conf -i eth0
 
  sudo /usr/local/bin/snort -A console -q -c /etc/snort/snort.conf -i eth0
 +
sudo /usr/local/bin/snort -A console -q -c /etc/snort/snort.conf -i enp0s3
  
If you now ping your Snort server from the system that is in your blacklist, you should see alerts display on the console. Use Ctrl-C to stop Snort from running. In the example below, the first alert is from me ssh-ing into the Snort server from the blacklisted computer. Next I pinged the Snort server 8 times, then used wget to try to pull a webpage from the Snort server:
+
Jika sekarang Anda melakukan ping ke server Snort Anda dari sistem yang ada di black list, Anda akan melihat tampilan Alert di konsol. Gunakan Ctrl-C untuk menghentikan Snort berjalan. Pada contoh di bawah ini, peringatan pertama adalah dari ssh ke server Snort dari komputer yang masuk black list. Selanjutnya saya melakukan ping ke server Snort 8 kali, lalu menggunakan wget untuk mencoba menarik halaman web dari server Snort:
 
 
 
  12/09-20:25:10.423907  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.72:51312 -> 10.0.0.101:22
 
  12/09-20:25:10.423907  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.72:51312 -> 10.0.0.101:22
Line 149: Line 152:
 
  12/09-20:25:18.355319  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.105 -> 10.0.0.101
 
  12/09-20:25:18.355319  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.105 -> 10.0.0.101
 
  12/09-20:25:26.194898  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.101:52671 -> 10.0.0.105:80
 
  12/09-20:25:26.194898  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.101:52671 -> 10.0.0.105:80
^C*** Caught Int-Signal
+
^C*** Caught Int-Signal
  
If you are wondering how I’m able to remote into the server from a blacklisted host, remember that we have configured Snort as an IDS (intrusion detection system), it only detects and alerts for malicious traffic. We have not configured Snort as an IPS (intrusion prevention system). More information on running Snort as an IPS here.
+
Jika Anda bertanya-tanya bagaimana kita dapat melakukan remote ke server dari host yang masuk black list, ingatlah bahwa kita telah mengonfigurasi Snort sebagai IDS (Intrusion Detection System), Snort hanya mendeteksi dan memberi Alert untuk lalu lintas berbahaya. Kita belum mengonfigurasi Snort sebagai IPS (Intrusion Prevention Sistem).
  
If you don’t see any alerts like above, run the below command to test your snort.conf,
+
Jika Anda tidak melihat peringatan seperti di atas, jalankan perintah di bawah ini untuk menguji snort.conf Anda,
  
 
 
 
  sudo snort -T -c /etc/snort/snort.conf -i eth0
 
  sudo snort -T -c /etc/snort/snort.conf -i eth0
  
If Snort verifies the configuration file successfully (indicated in the final few lines of output), then scroll up through the output up to see if any IP addresses show in the reputation portion of the output (see line 6 below for our one IP address loaded from the blacklist file):
+
Jika Snort berhasil memverifikasi file konfigurasi (ditunjukkan dalam beberapa baris terakhir keluaran), lalu gulir ke atas melalui keluaran untuk melihat apakah ada alamat IP yang ditampilkan di bagian reputasi keluaran (lihat baris 6 di bawah untuk satu alamat IP kami dimuat dari file black list):
 +
 
 
 
 
  Reputation config:  
 
  Reputation config:  
Line 175: Line 179:
 
         Shared memory is Not supported.
 
         Shared memory is Not supported.
  
You will also want to verify that our two rules (from local.rules) have loaded in the rules section of the output (note that they are recognized as preprocessor rules):
+
Anda juga ingin memverifikasi bahwa dua aturan (dari local.rules) telah dimuat di bagian aturan keluaran (perhatikan bahwa aturan tersebut dikenali sebagai preprocessor rules):
 +
 
 
 
 
  +++++++++++++++++++++++++++++++++++++++++++++++++++
 
  +++++++++++++++++++++++++++++++++++++++++++++++++++
Line 196: Line 201:
 
  +----------------------------------------------------------------------------
 
  +----------------------------------------------------------------------------
  
if both of those are correct, start looking at your IP addresses to verify that you have everything correct. If you are using private IP addresses (like 10.x.x.x) then remember that you need to enable scan_local in the reputation preprocessor.
+
jika keduanya benar, mulailah melihat alamat IP Anda untuk memverifikasi bahwa semuanya benar. Jika Anda menggunakan alamat IP pribadi (seperti 10.x.x.x), ingatlah bahwa Anda harus mengaktifkan scan_local di reputation preprocessor.
 +
 
 +
==Understanding nested_ip==
  
==Understanding nested_ip--
+
Paket sering di enkapsulasi dalam paket lain, seperti GRE atau IP di IP tunnel. Jika Snort dapat melihat informasi header IP dari paket enkapsulasi (internal), Anda dapat memilih untuk membandingkan paket dalam, paket luar, atau header IP dalam dan luar terhadap list IP yang ada, dengan men-set opsi nested_ip ke salah satu dari yang berikut : dalam, luar, atau keduanya, yang memberi tahu reputation preprocessor untuk memeriksa alamat IP dalam, alamat IP luar, atau untuk memeriksa kedua alamat IP (baik dalam maupun luar). Salah satu contohnya di bawah ini:
  
Packets are often encapsulated in other packets, such as GRE or IP in IP tunnels. If Snort can see the IP header information of the encapsulated (internal) packet, you can choose to compare the inner packet, outer packet, or both inner and outer IP headers against your IP lists, by setting the nested_ip option to one of the following: inner, outer, or both, which tells the reputation preprocessor to check the inner IP address, the outer IP address, or to check both IP addresses (both inner and outer). One example is below:
 
 
 
 
  preprocessor reputation: \
 
  preprocessor reputation: \
Line 206: Line 212:
 
     ...
 
     ...
  
==PulledPork and Blacklists==
+
==Pulledpork Install==
 +
 
 +
'''WARNING:''' PulledPork tidak di rekomendasikan bagi mereka yang tidak berlangganan oinkcode. Bagi anda yang berlangganan oinkcode bisa akses Pulledpork untuk memperoleh IP address yang di black list
 +
 
 +
Instal aplikasi pendukung
 +
 
 +
apt-get install libcrypt-ssleay-perl liblwp-useragent-determined-perl -y
 +
 
 +
Sebagai user bisa, download Pulledpork versi terakhir
  
PulledPork can automatically download blacklists (but not whitelists), and is configured to do so by default. When configuring pulledpork.conf (usually located in /etc/snort/), you will need to have the following lines configured correctly.
+
cd ~/snort_src
 +
wget https://github.com/shirkdog/pulledpork/archive/master.tar.gz -O pulledpork-master.tar.gz
 +
tar xzvf pulledpork-master.tar.gz
 +
cd pulledpork-master/
 +
 
 +
sudo cp pulledpork.pl /usr/local/bin
 +
sudo chmod +x /usr/local/bin/pulledpork.pl
 +
sudo cp etc/*.conf /etc/snort
  
First we need to tell PulledPork which IP blacklist to download. By default we download the Talos blacklist, which is found at line 24 of pulledpork.conf. No changes are required to this line, since it’s enabled by default:
+
Test
  
 +
/usr/local/bin/pulledpork.pl -V
 +
 +
Keluar / Output
 +
PulledPork v0.8.0 - The only positive thing to come out of 2020...well this and take-out liquor!
 +
 +
Edit konfigurasi
 +
 +
sudo vi /etc/snort/pulledpork.conf
 +
 +
==PulledPork dan Blacklist==
 +
 +
PulledPork dapat secara otomatis mengunduh black list (tetapi bukan white list), dan dikonfigurasi untuk melakukannya secara default. Saat mengonfigurasi pullpork.conf (biasanya terletak di /etc/snort/), Anda harus mengonfigurasi baris berikut dengan benar.
 +
 +
Ubah sesuaikan dengan Ubuntu 22.04
 +
 +
# What path you want the .so files to actually go to *i.e. where is it
 +
# defined in your snort.conf, needs a trailing slash
 +
# sorule_path=/usr/local/lib/snort_dynamicrules/
 +
sorule_path=/usr/lib/snort/snort_dynamicrule
 +
 +
# Path to the snort binary, we need this to generate the stub files
 +
# snort_path=/usr/local/bin/snort
 +
snort_path=/usr/sbin/snort
 +
 +
# We need to know where your snort.conf file lives so that we can
 +
# generate the stub files
 +
# config_path=/usr/local/etc/snort/snort.conf
 +
config_path=/etc/snort/snort.conf
 +
 +
##### Deprecated - The stubs are now  categorically written to the  single rule file!
 +
# sostub_path=/usr/local/etc/snort/rules/so_rules.rules
 +
 +
# Define your distro, this is for the precompiled shared object libs!
 +
# Valid Distro Types:
 +
# Alpine-3-10
 +
# Centos-6, Centos-7, Centos-8
 +
# Debian-8, Debian-9, Debian-10
 +
# FC-27, FC-30
 +
# FreeBSD-11, FreeBSD-12
 +
# OpenBSD-6-2, OpenBSD-6-4, OpenBSD-6-5,
 +
# OpenSUSE-15-0, OpenSUS-15-1, OpenSUSE-42-3
 +
# RHEL-6, RHEL-7, RHEL-8
 +
# Slackware-14-2
 +
# Ubuntu-14-4, Ubuntu-16-4, Ubuntu-17-10, Ubuntu-18-4
 +
distro=Ubuntu-22-4
 +
 +
Ubah path directory rules,
 +
 +
# but still keeping a separate file for your so_rules!
 +
# rule_path=/usr/local/etc/snort/rules/snort.rules
 +
rule_path=/etc/snort/rules/snort.rules
 +
 +
 +
Selanjutnya, memberi tahu PulledPork black list IP mana yang akan diunduh. Secara default kita mengunduh black list Snort, yang ditemukan di baris 24 dari pullpork.conf. Tidak ada perubahan yang diperlukan pada baris ini, karena diaktifkan secara default:
 
 
 
  # pulledpork.conf - Line 24
 
  # pulledpork.conf - Line 24
  rule_url=http://talosintel.com/feeds/ip-filter.blf|IPBLACKLIST|open
+
  # rule_url=http://talosintel.com/feeds/ip-filter.blf|IPBLACKLIST|open
 +
rule_url=https://snort.org/downloads/ip-block-list|IPBLOCKLIST|open
 +
 
 +
 
 +
Baris 141 di PulledPork.conf menunjuk ke file lokal tempat Anda akan menyimpan black list yang Anda unduh. Ini akan menjadi file yang sama yang Anda konfigurasikan di reputation preprocessor dengan arahan: BLACK_LIST_PATH di snort.conf. Di sinilah PulledPork akan menulis black list ke:
  
Line 141 in PulledPork.conf points to local file where you will save the blacklist that you download. This will be the same file you configured in the reputation preprocessor with the directive: BLACK_LIST_PATH in your snort.conf. This is the where PulledPork will write the blacklists to:
 
 
 
  # pulledpork.conf - Line 141
 
  # pulledpork.conf - Line 141
 +
block_list=/usr/local/etc/snort/rules/iplists/default.blocklist
 +
 +
ubah menjadi
 
  black_list=/etc/snort/rules/iplists/black_list.rules
 
  black_list=/etc/snort/rules/iplists/black_list.rules
  
The other configuration item in PulledPork.conf that is related to blacklists is line 150. This is used to have Snort reload the IP lists without a reboot (although that requires a lot more configuration, and re-compiling snort with -enable-shared-rep and –enable-control-socket, which isn’t covered here). You just need to make sure this folder path points to your iplists folder so there are no errors, although we won’t be using this feature:
+
Item konfigurasi lain di PulledPork.conf yang terkait dengan black list adalah baris 150. Ini digunakan agar Snort memuat ulang list IP tanpa reboot (walaupun itu membutuhkan lebih banyak konfigurasi, dan mengkompilasi ulang snort dengan -enable-shared- rep dan –enable-control-socket, yang tidak tercakup di sini). Anda hanya perlu memastikan jalur folder ini mengarah ke folder iplists Anda sehingga tidak ada kesalahan, meskipun kami tidak akan menggunakan fitur ini:
+
 
 
  # pulledpork.conf - Line 150
 
  # pulledpork.conf - Line 150
 +
IPRVersion=/usr/local/etc/snort/rules/iplists
 +
 +
ubah menjadi
 
  IPRVersion=/etc/snort/rules/iplists
 
  IPRVersion=/etc/snort/rules/iplists
  
after running PulledPork, you should see the black_list.rules file be populated with a number of IP addresses (over 40,000 at this time from the Talos blacklist).
+
setelah menjalankan PulledPork, Anda akan melihat file black_list.rules diisi dengan sejumlah alamat IP (lebih dari 40.000 saat ini dari black list Talos).
  
==Using Multiple IP Lists==
+
==Penggunaan Multiple IP List==
 
 
You can have the reputation preprocessor load multiple whitelists and blacklists. This is good if you have a personal blacklist that you don’t want overwritten by PulledPork. An example or the reputation preprocessor configured with two whitelists and two blacklists:
 
  
 +
Anda dapat meminta reputation preprocessor memuat beberapa white list dan black list. Ini bagus jika Anda memiliki black list pribadi yang tidak ingin ditimpa oleh PulledPork. Contoh atau reputation preprocessor yang dikonfigurasi dengan dua white list dan dua black list:
 
 
 
  preprocessor reputation: \
 
  preprocessor reputation: \
Line 240: Line 322:
 
     whitelist etc/snort/rules/iplists/some_whitelist.rules, \
 
     whitelist etc/snort/rules/iplists/some_whitelist.rules, \
 
     blacklist /etc/snort/rules/iplists/some_blacklist.rules, \
 
     blacklist /etc/snort/rules/iplists/some_blacklist.rules, \
     blacklist $BLACK_LIST_PATH/black_list.rules  
+
     blacklist $BLACK_LIST_PATH/black_list.rules
 
 
==Useful References==
 
 
 
Snort’s guide on the reputation preprocessor is here. This explains every option for the preprocessor in detail.
 
README.reputation: the Snort overview of the reputation preprocessor.
 
 
 
==Conclusion==
 
 
 
I hope this has been a good overview of the reputation preprocessor in Snort. I wrote this article because I found most of the information on the web to be scattered, incomplete, and sometimes contradictory (as things tend to often be on the internet). I am hoping this article helps to explain the reputation preprocessor at a high-enough level as to make you wiser, as well as deeply enough that you can bend it to your will. If you have any questions or recommendations, please contact me. I can’t always answer questions right away, but I will do my best to get back to you. I welcome all recommendations and corrections.
 
 
 
 
 
 
 
  
 +
==Reference==
  
 +
* http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node17.html#SECTION003220000000000000000 - Snort’s guide on the reputation preprocessor.
  
 
==Referensi==
 
==Referensi==
  
 
* https://sublimerobots.com/2015/12/the-snort-reputation-preprocessor/
 
* https://sublimerobots.com/2015/12/the-snort-reputation-preprocessor/

Latest revision as of 07:07, 10 July 2023

Sumber: https://sublimerobots.com/2015/12/the-snort-reputation-preprocessor/


Disini, kita akan melihat Preprosesor Reputasi Snort. Kami akan melihat bagaimana preprosesor ini digunakan untuk menggunakan black list IP dan white list IP (dikenal bersama sebagai list IP) untuk memblokir, memperingatkan, atau mengizinkan lalu lintas berdasarkan alamat IP pengirim dan/atau penerima. Kami akan menunjukkan kepada Anda cara mengonfigurasi, menguji, dan memecahkan masalah preprocessor reputasi dan black list secara otomatis.

Sejarah Preprosesor Reputasi

Sebelum preprosesor reputasi dikembangkan, jika Anda ingin memblokir atau mengingatkan lalu lintas ke atau dari alamat atau rentang IP tertentu, Anda harus membuat aturan untuk alamat IP atau rentang alamat IP tersebut. Ini berfungsi dengan baik untuk kumpulan alamat yang sangat kecil yang tidak sering berubah. Sayangnya, di lingkungan saat ini, alamat IP untuk host berbahaya berubah dengan cepat, dan ada sejumlah besar alamat berbahaya. Overhead administratif untuk membuat dan memelihara aturan khusus untuk alamat ini menjadi sulit, serta masalah beban prosesor tambahan pada mesin deteksi Snort dengan penambahan begitu banyak aturan tambahan. Black List Talos saat ini memiliki lebih dari 40.000 entri, sehingga Anda dapat membayangkan bahwa upaya menggunakan aturan Snort biasa untuk memblokir banyak alamat IP itu sulit.

Solusi untuk kesulitan ini adalah preprocessor reputasi, pertama kali disertakan dalam rilis Snort 2.9.1.x Snort.


Overview Reputation Preprocessor

Reputation preprocessor dibuat untuk memungkinkan Snort menggunakan file yang penuh dengan alamat IP saja untuk mengidentifikasi host yang buruk dan host yang terpercaya. Alamat IP berbahaya disimpan dalam black list, dan alamat IP tepercaya disimpan dalam white list. Preprosesor reputasi memuat daftar ini saat Snort dimulai, dan membandingkan semua lalu lintas dengan daftar tersebut. Snort memeriksa alamat IP pengirim dan penerima di setiap paket terhadap setiap entri dalam daftar IP, dan jika alamat IP dalam paket cocok dengan alamat IP di daftar hitam, daftar putih, atau keduanya, Snort dapat melakukan beberapa tindakan berbeda: Snort dapat menghasilkan peringatan, memblokir paket, mengizinkan paket tanpa pemrosesan lain (melewati semua aturan lain), atau membiarkan paket melanjutkan pemeriksaan aturan reguler lainnya. Tindakan yang diambil Snort bergantung pada bagaimana Anda mengonfigurasi preprosesor reputasi, dan jika Snort berjalan dalam mode IDS atau IPS (Snort hanya dapat menjatuhkan paket saat berjalan dalam mode IPS, karena alasan yang jelas).

Reputation preprocessor adalah preprocessor pertama yang ditemui paket di Snort (setelah dirakit oleh decoder). Alasan untuk hal ini adalah karena preprocessor reputasi dapat menandai paket terpercaya untuk melewati sisa preprocessor dan mesin aturan, atau dapat menjatuhkan paket, ini dapat membantu mengurangi beban pada sistem Snort.

Anda dapat membuat white list dan black list secara manual, meskipun Anda mungkin lebih baik menggunakan PulledPork untuk mengunduh file black list secara otomatis. Kabar baiknya adalah jika Anda menggunakan PulledPork dan preprosesor reputasi Anda telah dikonfigurasi dengan benar, semua ini akan bekerja untuk Anda. Jika Anda ingin mengubah cara kerja, melakukan sesuatu yang istimewa, atau hanya ingin memahami Snort dengan lebih baik, panduan ini cocok untuk Anda.

Apa Yang Terjadi Ketika Sebuah Paket Match dengan Entri dalam List IP

Dengan asumsi preprosesor reputasi Anda dikonfigurasi dengan benar, dan Anda memiliki entri dalam file white list dan black list: reputation preprocessor adalah prosesor pertama yang ditemui paket di Snort setelah dirakit oleh dekoder. Reputation preprocessor membandingkan alamat IP sumber dan tujuan dalam paket dengan alamat IP dalam file white list dan black list. Jika salah satu alamat IP (pengirim atau penerima) untuk paket ada di black list, maka peringatan akan dikeluarkan (dengan GID:136, dan SID:1) dan tidak ada pemrosesan lebih lanjut yang dilakukan pada paket (melewati semua prosesor lainnya dan mesin aturan). Jika Anda menjalankan dalam mode NIDS, hanya peringatan yang dibuat. Jika Anda menjalankan inline dalam mode IPS, maka paket akan dibuang. Jika salah satu alamat IP ada di white list: paket dapat melewati semua preprosesor lain dan mesin aturan dan melanjutkan, atau dapat "unblacked". Ketika sebuah paket dibuka blokirnya, itu diperlakukan seperti paket biasa, sedang diproses oleh preprosesor dan aturan lain, bahkan jika alamatnya ada di black list.

Jika server Snort Anda berjalan sebagai NIDS (network intrusion detection system) maka Alert akan dihasilkan (kami mendeteksi) untuk paket yang cocok dengan salah satu list IP. Jika Anda menjalankan Snort sebagai NIPS (Network Intrusion Prevention System), maka lalu lintas bahkan dapat dihentikan tidak sekedar menghasilkan Alert ketika alamat IP paket match dengan IP dalam black list. Jika satu alamat IP ada di white list, dan alamat lainnya ada di black list, tindakan yang diambil akan bergantung pada konfigurasi Anda, yaitu opsi preprocessor priority dan white reputation preprocessor yang akan dijelaskan selanjutnya.

Mengkonfigurasi Reputation Preprocessor

Reputation preprocessor dikonfigurasi di snort.conf. Banyak instalasi Snort standar menempatkan file ini di /etc/snort/snort.conf. Buka file konfigurasi snort ini dan temukan bagian untuk reputation preprocessor. Ini harus berada di sekitar nomor baris 506 jika Anda belum banyak mengubah snort.conf. Jika preprocessor dinonaktifkan dengan simbol hash (#) di awal setiap baris untuk preprocessor, Anda dapat mengaktifkannya dengan menghapus simbol hash dari awal setiap baris. Konfigurasi reputation preprocessor akan terlihat serupa dengan yang berikut saat diaktifkan:

# Reputation preprocessor. For more information see README.reputation
preprocessor reputation: \
   memcap 500, \
   priority whitelist, \
   nested_ip inner, \
   whitelist $WHITE_LIST_PATH/white_list.rules, \
   blacklist $BLACK_LIST_PATH/black_list.rules 

Ada beberapa baris lain di snort.conf Anda yang berhubungan dengan list IP. Dua baris berikut memberi tahu Snort di mana folder yang menyimpan white list dan black list:

var WHITE_LIST_PATH /etc/snort/rules/iplists
var BLACK_LIST_PATH /etc/snort/rules/iplists

perhatikan bahwa Anda hanya dapat menggunakan jalur absolut untuk penilai WHITE_LIST_PATH dan BLACK_LIST_PATH daripada menggunakan $BLACK_LIST_PATH/filename seperti pada dua contoh di atas.

Kami juga memerlukan folder untuk menyimpan list IP Anda, dan white list dan black list kosong. Ketiga item ini adalah apa yang kami beri tahu Snort untuk digunakan di dua bagian snort.conf di atas (buat ini jika tidak ada, berdasarkan konfigurasi preprocessor Anda):

# these commands will create your whitelist and blacklist files as configured in the above example
sudo mkdir /etc/snort/rules/iplists
sudo touch /etc/snort/rules/iplists/black_list.rules
sudo touch /etc/snort/rules/iplists/white_list.rules

Karena Anda telah mengedit snort.conf Anda, selalu merupakan ide bagus untuk menguji apakah Anda tidak membuat kesalahan apa pun. Tes sederhana (ubah sistem Anda sesuai kebutuhan) dan pastikan tidak ada masalah yang dilaporkan, pastikan menggunakan nama interface jaringan yang benar:

sudo snort -T -c /etc/snort/snort.conf -i eth0
sudo snort -T -c /etc/snort/snort.conf -i enp0s3

Menambahkan Entri ke List IP Secara Manual

Jika Anda ingin membuat white list dan black list sendiri, ini mudah. Snort dapat dengan mudah memuat banyak white list dan black list. Daftar tersebut harus berupa dokumen teks dengan alamat IP biasa (menentukan satu host), atau alamat IP dalam format CIDR, dengan satu entri per baris. Anda dapat memiliki komentar full-line dan inline dengan menggunakan simbol hash (#). Contoh dari semua opsi ini adalah di bawah ini:

 # Ini adalah komentar baris penuh
 # List ini bisa menjadi white list atau black list,
 # itu hanya tergantung pada apa yang Anda katakan kepada Snort untuk memperlakukannya
 
 # Tambahkan host tunggal ini ke daftar ini:
 10.0.0.120
 10.0.0.222 # Ini adalah komentar sebaris.
 
 # Tambahkan seluruh subnet ini (dalam format CIDR) ke dalam daftar:
 10.2.0.0/24
 224.0.0.0/4 # tambahkan seluruh subnet multicast ke daftar ini

Mengijinkan Local IP Address

Jika Anda ingin Reputation Preprocessor mengenali (bukan mengabaikan) alamat jaringan pribadi (yang ada di jaringan rumah atau internal Anda) yang semuanya termasuk dalam rentang lokal:


   10.0.0.0 – 10.255.255.255 (10.0.0.0/8)
   172.16.0.0 – 172.31.255.255 (172.16.0.0/12)
   192.168.0.0 – 192.168.255.255 (192.168.0.0/16)

tambahkan opsi scan_local dalam konfigurasi reputation preprocessor, seperti tampak di bawah ini,

# Reputation preprocessor. For more information see README.reputation
preprocessor reputation: \
   memcap 500, \
   priority whitelist, \
   nested_ip inner, \
   scan_local, \
   whitelist $WHITE_LIST_PATH/white_list.rules, \
   blacklist $BLACK_LIST_PATH/black_list.rules 

Opsi ini memungkinkan Anda menguji Reputation Preprocessor dengan alamat private (peringatan lalu lintas dari subnet 10.0.0.0/24 misalnya). Tanpa opsi ini, semua alamat IP dalam daftar IP Anda dari alamat private tidak akan dibandingkan dengan list IP.

Konfigurasi IP List Tindakan dan Prioritas

Dua opsi konfigurasi reputation preprocessor yang menentukan effek IP list pada pemrosesan paket adalah priority dan white.

  • priority: Ketika sebuah paket memiliki satu IP pada black list dan IP lainnya pada white list (alamat IP pengirim dan alamat IP penerima), opsi ini menentukan mana yang lebih penting. Jika ini di set ke black list, maka paket akan menghasilkan Alert. Jika ini di set ke white list, maka proses akan diizinkan untuk lewat. Contoh pengaturan ini (dipotong untuk kesederhanaan):
preprocessor reputation: \
   priority whitelist, \
   ...
  • white: opsi ini dapat diatur ke unblack atau trust. Ketika diatur ke unblack, jika paket juga memiliki alamat yang ada di black list IP (misalkan alamat IP sumber ada di white list dan alamat ip tujuan dari paket yang sama ada di black list), maka paket akan terus diproses melalui preprosesor lain seolah-olah tidak ada dalam black list. Perhatikan bahwa agar paket dapat terus diproses, prioritas harus ditetapkan ke black list. Ketika white di set ke trust, maka paket dipercaya secara implisit dan melewati semua pemrosesan lebih lanjut. Contohnya:
preprocessor reputation: \
   white unblack, \
   ...

Setting local.rules untuk Alert saat ada event Blacklist

Jika Anda tidak menggunakan PulledPork untuk mengelola ruleset, dan telah mengonfigurasi white list dan/atau black list secara manual, Anda perlu memberi tahu Snort untuk membuat Alert ketika melihat paket yang match dengan list IP ini.

Edit local.rules, masukan rule berikut,

alert ( msg: "REPUTATION_EVENT_BLACKLIST"; sid: 1; gid: 136; rev: 1; metadata: rule-type preproc ; classtype:bad-unknown; )
alert ( msg: "REPUTATION_EVENT_WHITELIST"; sid: 2; gid: 136; rev: 1; metadata: rule-type preproc ; classtype:bad-unknown; )

CATATAN: Bagi pengguna PulledPork, kita tidak perlu rule di atas, karena semua akan secara automatis di set oleh PulledPork.

Rules dengan GID 136 adalah rules yang di trigger oleh reputation preprocessor. Ada tiga 3 SID dari processor:

1 Packet adalah blacklist
2 Packet adalah whitelist
3 Packet inspected

Kita tidak membuat rule dengan SID 3 karena ini akan membuat banyak Alert, karena pada dasarnya semua packet adalah inspected.

Ada cara mudah untuk menguji kerja reputation processor. Pertama, pastikan reputation processor dikonfigurasi dengan benar, dan Anda memiliki dua aturan yang tercantum di atas dalam file local.rules Anda (dan pastikan Snort memuat local.rules Anda).

Selanjutnya, tambahkan alamat IP host kedua di jaringan Anda (selain host snort Anda) ke file black_list.rules. Alamat IP ini akan menjadi alamat di mana Snort menghasilkan peringatan, karena alamat IP ada di file black list.

Start Snort dengan perintah berikut (ubah untuk pengaturan sistem spesifik Anda). Ini akan menghasilkan peringatan ke konsol:


sudo /usr/local/bin/snort -A console -q -c /etc/snort/snort.conf -i eth0
sudo /usr/local/bin/snort -A console -q -c /etc/snort/snort.conf -i enp0s3

Jika sekarang Anda melakukan ping ke server Snort Anda dari sistem yang ada di black list, Anda akan melihat tampilan Alert di konsol. Gunakan Ctrl-C untuk menghentikan Snort berjalan. Pada contoh di bawah ini, peringatan pertama adalah dari ssh ke server Snort dari komputer yang masuk black list. Selanjutnya saya melakukan ping ke server Snort 8 kali, lalu menggunakan wget untuk mencoba menarik halaman web dari server Snort:

12/09-20:25:10.423907  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.72:51312 -> 10.0.0.101:22
12/09-20:25:15.355331  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.101 -> 10.0.0.105
12/09-20:25:15.355375  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.105 -> 10.0.0.101
12/09-20:25:16.355231  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.101 -> 10.0.0.105
12/09-20:25:16.355270  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.105 -> 10.0.0.101
12/09-20:25:17.355272  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.101 -> 10.0.0.105
12/09-20:25:17.355310  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.105 -> 10.0.0.101
12/09-20:25:18.355293  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.101 -> 10.0.0.105
12/09-20:25:18.355319  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 10.0.0.105 -> 10.0.0.101
12/09-20:25:26.194898  [**] [136:1:1] (spp_reputation) packets blacklisted [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.101:52671 -> 10.0.0.105:80
^C*** Caught Int-Signal

Jika Anda bertanya-tanya bagaimana kita dapat melakukan remote ke server dari host yang masuk black list, ingatlah bahwa kita telah mengonfigurasi Snort sebagai IDS (Intrusion Detection System), Snort hanya mendeteksi dan memberi Alert untuk lalu lintas berbahaya. Kita belum mengonfigurasi Snort sebagai IPS (Intrusion Prevention Sistem).

Jika Anda tidak melihat peringatan seperti di atas, jalankan perintah di bawah ini untuk menguji snort.conf Anda,


sudo snort -T -c /etc/snort/snort.conf -i eth0

Jika Snort berhasil memverifikasi file konfigurasi (ditunjukkan dalam beberapa baris terakhir keluaran), lalu gulir ke atas melalui keluaran untuk melihat apakah ada alamat IP yang ditampilkan di bagian reputasi keluaran (lihat baris 6 di bawah untuk satu alamat IP kami dimuat dari file black list):


Reputation config: 
    WARNING: /etc/snort/snort.conf(512) => Keyword priority for whitelist is not applied when white action is unblack.
        Processing whitelist file /etc/snort/rules/iplists/default.whitelist
        Reputation entries loaded: 0, invalid: 0, re-defined: 0 (from file /etc/snort/rules/iplists/default.whitelist)
        Processing blacklist file /etc/snort/rules/iplists/default.blacklist
        Reputation entries loaded: 1, invalid: 0, re-defined: 0 (from file /etc/snort/rules/iplists/default.blacklist)
        Reputation total memory usage: 329636 bytes
        Reputation total entries loaded: 1, invalid: 0, re-defined: 0
        Memcap: 500 (Default) M bytes 
        Scan local network: DISABLED (Default)
        Reputation priority:  whitelist(Default) 
        Nested IP: inner (Default) 
        White action: unblack (Default) 
        Shared memory is Not supported.

Anda juga ingin memverifikasi bahwa dua aturan (dari local.rules) telah dimuat di bagian aturan keluaran (perhatikan bahwa aturan tersebut dikenali sebagai preprocessor rules):


+++++++++++++++++++++++++++++++++++++++++++++++++++
Initializing rule chains...
2 Snort rules read
    0 detection rules
    0 decoder rules
    2 preprocessor rules
2 Option Chains linked into 1 Chain Headers
0 Dynamic rules
+++++++++++++++++++++++++++++++++++++++++++++++++++
 
+-------------------[Rule Port Counts]---------------------------------------
|             tcp     udp    icmp      ip
|     src       0       0       0       0
|     dst       0       0       0       0
|     any       2       0       0       0
|      nc       2       0       0       0
|     s+d       0       0       0       0
+----------------------------------------------------------------------------

jika keduanya benar, mulailah melihat alamat IP Anda untuk memverifikasi bahwa semuanya benar. Jika Anda menggunakan alamat IP pribadi (seperti 10.x.x.x), ingatlah bahwa Anda harus mengaktifkan scan_local di reputation preprocessor.

Understanding nested_ip

Paket sering di enkapsulasi dalam paket lain, seperti GRE atau IP di IP tunnel. Jika Snort dapat melihat informasi header IP dari paket enkapsulasi (internal), Anda dapat memilih untuk membandingkan paket dalam, paket luar, atau header IP dalam dan luar terhadap list IP yang ada, dengan men-set opsi nested_ip ke salah satu dari yang berikut : dalam, luar, atau keduanya, yang memberi tahu reputation preprocessor untuk memeriksa alamat IP dalam, alamat IP luar, atau untuk memeriksa kedua alamat IP (baik dalam maupun luar). Salah satu contohnya di bawah ini:


preprocessor reputation: \
   nested_ip inner, \
   ...

Pulledpork Install

WARNING: PulledPork tidak di rekomendasikan bagi mereka yang tidak berlangganan oinkcode. Bagi anda yang berlangganan oinkcode bisa akses Pulledpork untuk memperoleh IP address yang di black list

Instal aplikasi pendukung

apt-get install libcrypt-ssleay-perl liblwp-useragent-determined-perl -y

Sebagai user bisa, download Pulledpork versi terakhir

cd ~/snort_src
wget https://github.com/shirkdog/pulledpork/archive/master.tar.gz -O pulledpork-master.tar.gz
tar xzvf pulledpork-master.tar.gz
cd pulledpork-master/
 
sudo cp pulledpork.pl /usr/local/bin
sudo chmod +x /usr/local/bin/pulledpork.pl
sudo cp etc/*.conf /etc/snort

Test

/usr/local/bin/pulledpork.pl -V

Keluar / Output

PulledPork v0.8.0 - The only positive thing to come out of 2020...well this and take-out liquor!

Edit konfigurasi

sudo vi /etc/snort/pulledpork.conf

PulledPork dan Blacklist

PulledPork dapat secara otomatis mengunduh black list (tetapi bukan white list), dan dikonfigurasi untuk melakukannya secara default. Saat mengonfigurasi pullpork.conf (biasanya terletak di /etc/snort/), Anda harus mengonfigurasi baris berikut dengan benar.

Ubah sesuaikan dengan Ubuntu 22.04

# What path you want the .so files to actually go to *i.e. where is it
# defined in your snort.conf, needs a trailing slash
# sorule_path=/usr/local/lib/snort_dynamicrules/
sorule_path=/usr/lib/snort/snort_dynamicrule

# Path to the snort binary, we need this to generate the stub files
# snort_path=/usr/local/bin/snort
snort_path=/usr/sbin/snort

# We need to know where your snort.conf file lives so that we can
# generate the stub files
# config_path=/usr/local/etc/snort/snort.conf
config_path=/etc/snort/snort.conf

##### Deprecated - The stubs are now  categorically written to the  single rule file!
# sostub_path=/usr/local/etc/snort/rules/so_rules.rules

# Define your distro, this is for the precompiled shared object libs!
# Valid Distro Types:
# Alpine-3-10
# Centos-6, Centos-7, Centos-8
# Debian-8, Debian-9, Debian-10
# FC-27, FC-30
# FreeBSD-11, FreeBSD-12
# OpenBSD-6-2, OpenBSD-6-4, OpenBSD-6-5,
# OpenSUSE-15-0, OpenSUS-15-1, OpenSUSE-42-3
# RHEL-6, RHEL-7, RHEL-8
# Slackware-14-2
# Ubuntu-14-4, Ubuntu-16-4, Ubuntu-17-10, Ubuntu-18-4
distro=Ubuntu-22-4

Ubah path directory rules,

# but still keeping a separate file for your so_rules!
# rule_path=/usr/local/etc/snort/rules/snort.rules
rule_path=/etc/snort/rules/snort.rules


Selanjutnya, memberi tahu PulledPork black list IP mana yang akan diunduh. Secara default kita mengunduh black list Snort, yang ditemukan di baris 24 dari pullpork.conf. Tidak ada perubahan yang diperlukan pada baris ini, karena diaktifkan secara default:

# pulledpork.conf - Line 24
# rule_url=http://talosintel.com/feeds/ip-filter.blf%7CIPBLACKLIST%7Copen
rule_url=https://snort.org/downloads/ip-block-list%7CIPBLOCKLIST%7Copen


Baris 141 di PulledPork.conf menunjuk ke file lokal tempat Anda akan menyimpan black list yang Anda unduh. Ini akan menjadi file yang sama yang Anda konfigurasikan di reputation preprocessor dengan arahan: BLACK_LIST_PATH di snort.conf. Di sinilah PulledPork akan menulis black list ke:

# pulledpork.conf - Line 141
block_list=/usr/local/etc/snort/rules/iplists/default.blocklist

ubah menjadi

black_list=/etc/snort/rules/iplists/black_list.rules

Item konfigurasi lain di PulledPork.conf yang terkait dengan black list adalah baris 150. Ini digunakan agar Snort memuat ulang list IP tanpa reboot (walaupun itu membutuhkan lebih banyak konfigurasi, dan mengkompilasi ulang snort dengan -enable-shared- rep dan –enable-control-socket, yang tidak tercakup di sini). Anda hanya perlu memastikan jalur folder ini mengarah ke folder iplists Anda sehingga tidak ada kesalahan, meskipun kami tidak akan menggunakan fitur ini:

# pulledpork.conf - Line 150
IPRVersion=/usr/local/etc/snort/rules/iplists

ubah menjadi

IPRVersion=/etc/snort/rules/iplists

setelah menjalankan PulledPork, Anda akan melihat file black_list.rules diisi dengan sejumlah alamat IP (lebih dari 40.000 saat ini dari black list Talos).

Penggunaan Multiple IP List

Anda dapat meminta reputation preprocessor memuat beberapa white list dan black list. Ini bagus jika Anda memiliki black list pribadi yang tidak ingin ditimpa oleh PulledPork. Contoh atau reputation preprocessor yang dikonfigurasi dengan dua white list dan dua black list:

preprocessor reputation: \
   memcap 500, \
   priority whitelist, \
   nested_ip inner, \
   whitelist $WHITE_LIST_PATH/white_list.rules, \
   whitelist etc/snort/rules/iplists/some_whitelist.rules, \
   blacklist /etc/snort/rules/iplists/some_blacklist.rules, \
   blacklist $BLACK_LIST_PATH/black_list.rules

Reference

Referensi