老杨写的 只允许指定端口访问shell
#!/bin/sh
ALLOWED="20 21 22 80 445"
iptables -F
for port in $ALLOWED; do
echo "Accept port $port..."
iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
done
iptables -A INPUT -t filter -p tcp --syn -j DROP
#!/bin/sh
ALLOWED="20 21 22 80 445"
iptables -F
for port in $ALLOWED; do
echo "Accept port $port..."
iptables -A INPUT -t filter -p tcp --dport $port -j ACCEPT
done
iptables -A INPUT -t filter -p tcp --syn -j DROP
本文介绍了一种使用iptables防火墙规则来仅允许指定端口访问shell的方法。通过定义允许的端口号并设置相应的iptables规则,可以有效地控制外部对系统的访问权限。
2005

被折叠的 条评论
为什么被折叠?



