Iptables - как заблокировать torrrent трафик (частично)

Поради та підказки щодо софту, роботи в операційних системах, комплектуючих та зборок комп'ютерів.
Аватар користувача
toxi
Администратор
Администратор
Статті: 0
Повідомлень: 532
З нами з: 12-04-2008 07:58:25
Ваша стать: Чоловічий
І'мя: Roman
Контактна інформація:

Iptables - как заблокировать torrrent трафик (частично)

Повідомлення toxi »

Правила iptables для блокировки torrent трафика:

Код: Виділити все

iptables -I FORWARD 1 -m string --string "BitTorrent" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string "BitTorrent protocol" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string "peer_id=" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string ".torrent" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string "announce.php?passkey=" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string "torrent" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string "announce" --algo bm --to 65535 -j DROP
iptables -I FORWARD 1 -m string --string "info_hash" --algo bm --to 65535 -j DROP
service iptables save
Просмотр заблокированных пакетов:

Код: Виділити все

iptables -L FORWARD -vn --line-numbers
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1       95 24353 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "info_hash" ALGO name bm TO 65535
2       28 40328 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "announce" ALGO name bm TO 65535
3       16   912 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "torrent" ALGO name bm TO 65535
4        0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "announce.php?passkey=" ALGO name bm TO 65535
5        0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  ".torrent" ALGO name bm TO 65535
6        0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "peer_id=" ALGO name bm TO 65535
7       95 12940 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "BitTorrent protocol" ALGO name bm TO 65535
8        0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            STRING match  "BitTorrent" ALGO name bm TO 65535
Сохраним данные правила:

Код: Виділити все

apt-get install iptables-persistent
/etc/init.d/iptables-persistent save
Правила форуму :: Виконую послуги IT-адміністратора (види послуг).