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

Поради та підказки щодо софту, роботи в операційних системах, комплектуючих та зборок комп'ютерів.
Аватара пользователя
toxi
Администратор
Администратор
Статьи: 0
Сообщения: 555
Зарегистрирован: 12 апр 2008, 04:58
Ваш пол: Мужской
Имя: 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-адміністратора (список послуг).