I can run iptables-save and dump output to stdout but if I redirect to a file - the file is empty:
[root@nhd-vlx2 tmp]# iptables-save
# Generated by iptables-save v1.4.7 on Sun Dec 18 15:11:42 2011
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [90971:17757587]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9090:9999 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Sun Dec 18 15:11:42 2011
[root@nhd-vlx2 tmp]# iptables-save > save
[root@nhd-vlx2 tmp]# cat save
[root@nhd-vlx2 tmp]#
[root@nhd-vlx2 tmp]#
Piping works (iptables-save | cat
), and so saving to file through tee
works too, but why would iptables-save
not allows saving to a file?
The only reason I can think is that this machine may be infected by a virus (an attempt to weaken a firewall)