كيفية حظر حركة مرور BitTorrent باستخدام IPtables

0 الأسهم
0
0
0
0

IPTABLES هو تطبيق مساحة المستخدم الذي يسمح لمسؤول النظام بتكوين الجداول التي يوفرها جدار حماية نواة Linux (يتم تنفيذه كوحدات Netfilter مختلفة) وسلاسلها وقواعدها المخزنة.

إعداد قواعد IPtables

لحظر حركة مرور BitTorrent باستخدام IPTABLES، يمكنك تعديل /etc/sysconfig/iptables (CentOS 7) وتضمين ما يلي:

vim /etc/sysconfig/iptables

.أولاً، عليك إضافة السلسلة الموجودة أعلى القواعد الأولى مباشرةً.

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

 

ثم أضف ما يلي أعلى سطر COMMIT.

# 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

 

إعادة تشغيل IPtables

/etc/init.d/iptables restart

عرض IPtables/التحقق من القواعد

iptables -L

إخراج العينة

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

 

اترك تعليقاً

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *


قد يعجبك أيضاً

أساسيات جدار الحماية UFW: قواعد وأوامر جدار الحماية الشائعة لأمان Linux

أساسيات جدار الحماية الموحد: قواعد وأوامر جدار الحماية الشائعة لأمان Linux المقدمة UFW (جدار الحماية الموحد) هي أداة سطر أوامر…
تحليل حركة البيانات باستخدام mitmproxy: دليل شامل لتصحيح الأخطاء والأمان

تحليل حركة البيانات باستخدام mitmproxy: دليل شامل لتصحيح الأخطاء والأمان

سنستعرض في هذه المقالة أداة mitmproxy، المستخدمة لتحليل وتصحيح أخطاء حركة مرور HTTP/HTTPS. بدءًا من التثبيت والإعداد، وصولًا إلى نصائح الأمان والاستخدامات العملية، سيساعدك هذا الدليل على إدارة حركة مرور البيانات بكفاءة.
أفضل الطرق للوقاية من هجمات DDoS

أفضل الممارسات لمنع هجمات DDoS لمديري المواقع الإلكترونية

تُعدّ هجمات الحرمان من الخدمة الموزّعة (DDoS) من أكثر التهديدات الأمنية شيوعًا وخطورةً على المواقع الإلكترونية والخوادم. فمن خلال إرسال كميات هائلة من الطلبات الخبيثة، تُرهق هذه الهجمات موارد الخادم وتُسبّب تباطؤًا شديدًا، وتوقفًا عن العمل، بل وحتى خسائر في الإيرادات وسمعة العلامة التجارية. لذا، يُعدّ الإلمام بالأساليب الأساسية للتعامل مع هجمات DDoS ضرورةً لا غنى عنها لمديري المواقع ومسؤولي الخوادم. في هذه المقالة، سنستعرض أكثر الحلول التقنية والعملية فعاليةً للوقاية من هجمات DDoS والحدّ من آثارها بأسلوب احترافي.