我的所有端口都被阻塞在我的iptables中,除了那些我特別想打開的端口。但是,在我的iptables.log文件中,有數十個請求使用端口137,138,139,因爲我們的公司網絡一直在想我們的盒子可能是一個windows盒子。不幸的是,我無法防止這種情況發生,所以下一個選擇是打開端口或防止日誌被寫入。iptables:阻止端口但不記錄所有端口
是否有可能阻止爲特定端口寫入iptables.log,但仍會記錄所有其他阻止的端口?或者我需要完全禁用iptables.log?
這是我/etc/rsyslog.conf文件
:msg, startswith, "iptables: " -/var/log/iptables.log
& ~
:msg, regex, "^\[ *[0-9]*\.[0-9]*\] iptables: " -/var/log/iptables.log
& ~
的RedHat 6.5
輸出:
Chain INPUT (policy DROP 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 98 6744 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
2 385 51303 ACCEPT udp -- eth0 * 0.0.0.0/0 0.0.0.0/0 udp spt:53
3 2102 166K ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 state NEW,ESTABLISHED
4 0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 state ESTABLISHED
5 119 18187 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp spt:80 state ESTABLISHED
6 0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp spt:443 state ESTABLISHED
7 0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306 state NEW,ESTABLISHED
8 0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp spt:3306 state ESTABLISHED
9 70 3104 ACCEPT tcp -- eth0 * 10./16 0.0.0.0/0 multiport dports 1556,10082,10102,13720,13724,13782 state NEW,ESTABLISHED
10 0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 multiport sports 1556,10082,10102,13720,13724,13782 state ESTABLISHED
11 115 18624 LOGGING all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy DROP 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy DROP 887 packets, 53828 bytes)
num pkts bytes target prot opt in out source destination
1 98 6744 ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
2 418 36439 ACCEPT udp -- * eth0 0.0.0.0/0 0.0.0.0/0 udp dpt:53
3 1801 230K ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp spt:22 state ESTABLISHED
4 0 0 ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 state NEW,ESTABLISHED
5 193 21974 ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 state NEW,ESTABLISHED
6 0 0 ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 state NEW,ESTABLISHED
7 0 0 ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp spt:3306 state ESTABLISHED
8 0 0 ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306 state NEW,ESTABLISHED
9 50 4570 ACCEPT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 multiport sports 1556,10082,10102,13720,13724,13782 state ESTABLISHED
10 0 0 ACCEPT tcp -- * eth0 10./16 0.0.0.0/0 multiport dports 1556,10082,10102,13720,13724,13782 state NEW,ESTABLISHED
Chain LOGGING (1 references)
num pkts bytes target prot opt in out source destination
1 94 16986 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 5/min burst 5 LOG flags 0 level 7 prefix `iptables: '
2 115 18624 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
這是可能的。 'sudo iptables -nvL -line-numbers'的輸出是什麼? – Yoel 2014-09-25 17:49:29
查看上面的更新... – Mark 2014-09-25 17:54:06