全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1002|回复: 9

[疑问] 屏蔽BT下载/邮件滥用 防警告

[复制链接]
发表于 2021-6-14 00:34:56 | 显示全部楼层 |阅读模式
本帖最后由 KDE 于 2021-6-14 10:04 编辑

清除所有规则
iptables -F

禁止所有进站/转发 允许所有出站
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

允许已建立的进站 允许PING 允许本机内部环回
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -i lo -p all -j ACCEPT

允许已建立的转发
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p udp --dport 2408 -d 162.159.192.1 -j ACCEPT
iptables -t nat -A PREROUTING -p udp --dport 8443 -j DNAT --to-destination 162.159.192.1:2408
iptables -t nat -A POSTROUTING -d 162.159.192.1 -p udp --dport 2408 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1

允许进站端口
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 8443 -j ACCEPT
iptables -A INPUT -p udp --dport 2408 -j ACCEPT
iptables -A INPUT -p udp --dport 4000 -j ACCEPT

关键词封锁
iptables -A OUTPUT -m string --string "torrent" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string ".torrent" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "peer_id=" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "announce" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "info_hash" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "get_peers" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "find_node" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "BitTorrent" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "announce_peer" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "BitTorrent protocol" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "announce.php?passkey=" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "magnet:" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "xunlei" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "sandai" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "Thunder" --algo bm --to 65535 -j DROP
iptables -A OUTPUT -m string --string "XLLiveUD" --algo bm --to 65535 -j DROP


 楼主| 发表于 2021-6-14 00:37:31 | 显示全部楼层
参考

1 Security Guide Red Hat Enterprise Linux 6 _ Red Hat Customer Portal.html
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html-single/security_guide/index#sect-Security_Guide-Firewalls-Using_IPTables

2『原创』iptables 封禁 BT_PT_SPAM(垃圾邮件)和自定义端口_关键词 一键脚本 _ 逗比根据地.html
https://doubibackup.com/tfma58rb.html
发表于 2021-6-14 00:39:01 | 显示全部楼层
优秀  mark大佬教程
发表于 2021-6-14 00:55:31 来自手机 | 显示全部楼层
既然要禁用,肯定是当梯子才禁;既然当梯子,https://toutyrater.github.io/routing/bittorrent.html

点评

KDE
这个是V2的 但不是每个人都用V2  发表于 2021-6-14 10:05
发表于 2021-6-14 10:01:12 来自手机 | 显示全部楼层
可以在母鸡设置吗,防止客户挂bt
 楼主| 发表于 2021-6-14 10:07:34 | 显示全部楼层
mywltd 发表于 2021-6-14 10:01
可以在母鸡设置吗,防止客户挂bt

母鸡多IP,然后小鸡分公网公网,这种情况就要在网关设置.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-25 15:19 , Processed in 0.063957 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表