Iptables - как заблокировать torrrent трафик: различия между версиями

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2024
Перейти к:навигация, поиск
 
(не показано 8 промежуточных версий этого же участника)
Строка 1: Строка 1:
 
[[Файл:B_1.gif |link=https://bit.ly/3tbFsd6| Доступная цена]]
 
[[Файл:B_1.gif |link=https://bit.ly/3tbFsd6| Доступная цена]]
  
=== Iptables - как заблокировать torrrent трафик ===
+
=== Iptables - как заблокировать torrent трафик ===
 +
 
 +
Видео инструкция: <br>
 +
<youtube>2y8TyV4q90U</youtube>
 +
<br>
  
  
 
Правила iptables для блокировки torrent трафика:
 
Правила iptables для блокировки torrent трафика:
  # iptables -I FORWARD 1 -m string --string "BitTorrent" --algo bm --to 65535 -j DROP
+
  # iptables -I FORWARD -m string --algo bm --string "BitTorrent" -j DROP
  # iptables -I FORWARD 1 -m string --string "BitTorrent protocol" --algo bm --to 65535 -j DROP
+
# iptables -I FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
  # iptables -I FORWARD 1 -m string --string "peer_id=" --algo bm --to 65535 -j DROP
+
  # iptables -I FORWARD -m string --algo bm --string "peer_id=" -j DROP
  # iptables -I FORWARD 1 -m string --string ".torrent" --algo bm --to 65535 -j DROP
+
# iptables -I FORWARD -m string --algo bm --string ".torrent" -j DROP
  # iptables -I FORWARD 1 -m string --string "announce.php?passkey=" --algo bm --to 65535 -j DROP
+
  # iptables -I FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
  # iptables -I FORWARD 1 -m string --string "torrent" --algo bm --to 65535 -j DROP
+
# iptables -I FORWARD -m string --algo bm --string "torrent" -j DROP
  # iptables -I FORWARD 1 -m string --string "announce" --algo bm --to 65535 -j DROP
+
  # iptables -I FORWARD -m string --algo bm --string "announce" -j DROP
  # iptables -I FORWARD 1 -m string --string "info_hash" --algo bm --to 65535 -j DROP
+
# iptables -I FORWARD -m string --algo bm --string "info_hash" -j DROP
# service iptables save
+
 
 +
Через скрипт:
 +
  # vi block_torrent.sh
 +
#!/bin/sh
 +
iptables -I FORWARD -m string --algo bm --string "BitTorrent" -j DROP
 +
iptables -I FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
 +
  iptables -I FORWARD -m string --algo bm --string "peer_id=" -j DROP
 +
iptables -I FORWARD -m string --algo bm --string ".torrent" -j DROP
 +
  iptables -I FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
 +
iptables -I FORWARD -m string --algo bm --string "torrent" -j DROP
 +
  iptables -I FORWARD -m string --algo bm --string "announce" -j DROP
 +
iptables -I FORWARD -m string --algo bm --string "info_hash" -j DROP
  
 +
# chmod a+x block_torrent.sh
 +
# sh block_torrent.sh
  
Другой вариант - блокировка через модуль '''ipp2p''' (автоматически обнаруживает сигнатуру пирингового трафика):
+
Проверяем через  
Установка для Ubuntu:
+
  # iptables -L
  # apt-get install xtables-addons-common -y
 
  
и применить правила для iptables:
+
Сохраняем правила iptables для блокировки torrrent трафика на постоянной основе после перезагрузки сервера (Пример для Ubuntu/Debian):
  # iptables -I FORWARD -p tcp -m ipp2p --bit -j DROP
+
  # apt install iptables-persistent -y
  # iptables -I FORWARD -p udp -m ipp2p --bit -j DROP
+
  # /sbin/iptables-save > /etc/iptables/rules.v4

Текущая версия на 21:39, 15 июня 2022

Доступная цена

Iptables - как заблокировать torrent трафик

Видео инструкция:


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

# iptables -I FORWARD -m string --algo bm --string "BitTorrent" -j DROP
# iptables -I FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
# iptables -I FORWARD -m string --algo bm --string "peer_id=" -j DROP
# iptables -I FORWARD -m string --algo bm --string ".torrent" -j DROP
# iptables -I FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
# iptables -I FORWARD -m string --algo bm --string "torrent" -j DROP
# iptables -I FORWARD -m string --algo bm --string "announce" -j DROP
# iptables -I FORWARD -m string --algo bm --string "info_hash" -j DROP

Через скрипт:

# vi block_torrent.sh
#!/bin/sh
iptables -I FORWARD -m string --algo bm --string "BitTorrent" -j DROP
iptables -I FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
iptables -I FORWARD -m string --algo bm --string "peer_id=" -j DROP
iptables -I FORWARD -m string --algo bm --string ".torrent" -j DROP
iptables -I FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
iptables -I FORWARD -m string --algo bm --string "torrent" -j DROP
iptables -I FORWARD -m string --algo bm --string "announce" -j DROP
iptables -I FORWARD -m string --algo bm --string "info_hash" -j DROP
# chmod a+x block_torrent.sh
# sh block_torrent.sh

Проверяем через

# iptables -L

Сохраняем правила iptables для блокировки torrrent трафика на постоянной основе после перезагрузки сервера (Пример для Ubuntu/Debian):

# apt install iptables-persistent -y
# /sbin/iptables-save > /etc/iptables/rules.v4