我的服务器运行Ubuntu 10.04.4 LTS,我想拒绝stream量到端口25.目标是这样的:
$ telnet {ip} 25 Trying {ip}... telnet: connect to address {ip}: Connection refused telnet: Unable to connect to remote host
我试过直接使用iptables ,但是失败了。 相反,我现在正在尝试uwf :
$ ufw reject 25
但是,它不能按预期工作:
$ telnet {ip} 25 Trying {ip}... # Waiting for a minute… telnet: connect to address {ip}: Connection refused telnet: Unable to connect to remote host
如果我尝试与其他任何港口(如23)相同,它没有等待时间。 这很奇怪,因为根据netstat ,端口25上什么也没有。
我怎么能直接拒绝stream量到端口25,没有这个延迟?
请注意,在另一台服务器上的相同技术工作。
更新:这里是iptables的相关部分:
Chain ufw-user-input (1 references) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT udp -- anywhere anywhere udp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT udp -- anywhere anywhere udp dpt:www REJECT tcp -- anywhere anywhere tcp dpt:smtp reject-with tcp-reset REJECT udp -- anywhere anywhere udp dpt:25 reject-with icmp-port-unreachable REJECT tcp -- anywhere anywhere tcp dpt:telnet reject-with tcp-reset REJECT udp -- anywhere anywhere udp dpt:23 reject-with icmp-port-unreachable
更新:评论的答案
ufw deny 25也不起作用。 tcpdump时间:
tcpdump -s0 -w /tmp/tracefile.pcap tcp port 25
CTRL-C完成testing后,在Wireshark中加载文件。