Block Bittorrent Traffic Dengan IPtables

IPTABLES adalah program aplikasi user-space yang memungkinkan administrator sistem untuk mengkonfigurasi tabel yang disediakan oleh firewall kernel Linux (diimplementasikan sebagai modul Netfilter yang berbeda) rantai dan aturan ini menyimpan.

Untuk memblokir lalu lintas Bittorrent dengan IPTABLES Anda dapat mengedit / etc / sysconfig / iptables (CentOS):
nano /etc/sysconfig/iptables


Pertama Anda akan ingin menambahkan mata rantai tepat di atas aturan pertama

:RH-Firewall-1-INPUT - [0:0]

Kemudian tambahkan berikut di atas COMMIT line

# Torrent ALGO Strings using Boyer-Moore
-A RH-Firewall-1-INPUT -m string --algo bm --string "BitTorrent" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "BitTorrent protocol" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "peer_id=" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string ".torrent" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "announce.php?passkey=" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "torrent" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "announce" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "info_hash" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string "/default.ida?" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string ".exe?/c+dir" -j DROP
-A RH-Firewall-1-INPUT -m string --algo bm --string ".exe?/c_tftp" -j DROP

# Torrent Keys
-A RH-Firewall-1-INPUT -m string --string "peer_id" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "BitTorrent" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "BitTorrent protocol" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "bittorrent-announce" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "announce.php?passkey=" --algo kmp -j DROP

# Distributed Hash Table (DHT) Keywords
-A RH-Firewall-1-INPUT -m string --string "find_node" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "info_hash" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "get_peers" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "announce" --algo kmp -j DROP
-A RH-Firewall-1-INPUT -m string --string "announce_peers" --algo kmp -j DROP 

Restart IPtables

/etc/init.d/iptables restart

Lihat IPtables/Verify Rules

iptables -L

Contoh Output

...
Chain RH-Firewall-1-INPUT (0 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            STRING match "BitTorrent" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "BitTorrent protocol" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "peer_id=" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match ".torrent" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "announce.php?passkey=" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "torrent" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "announce" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "info_hash" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "/default.ida?" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match ".exe?/c+dir" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match ".exe?/c_tftp" ALGO name bm TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "peer_id" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "BitTorrent" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "BitTorrent protocol" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "bittorrent-announce" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "announce.php?passkey=" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "find_node" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "info_hash" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "get_peers" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "announce" ALGO name kmp TO 65535 
DROP       all  --  anywhere             anywhere            STRING match "announce_peers" ALGO name kmp TO 65535
  • 0 Users Found This Useful
這篇文章有幫助嗎?

相關文章

Apa Saja System Operasi/Os yang Tersedia?

Kami memiliki berbagai sistem operasi linux yang tersedia untuk menginstal, jika Anda ingin...

One Liner Command Centos

kill all pts for x in $(ps aux | grep pts| awk '{print $2}'); do kill $x; done Strace all...

Block Bot Dari User Agent String

Tahukah Anda bahwa Anda dapat memblokir bad bot dari file .htaccess Anda? Mari blok bot yang...

Cara Extrak File tar.gz

Katakanlah Anda ingin mengekstrak tar lastest.tar.gz dari wordpress.org. tar -zxvf latest.tar.gz...

Install Remi Dan EPEL yum repository Centos 7

Menambahkan repo pada Centos 6/7 x86_64 dan i386 Installing optional EPEL yum repo Untuk type...