Hi. I'm trying to set up iptables 1.4.2 (from debian lenny) with stealth support but i see there are a lot of changes from grsec patch 1.4.0.
Has someone managed to change it and use it with new versions of iptables?
Cheers
Marco
madcat wrote:i get oops:
root@osconsfortress:~# iptables -L -v -n | grep ste
1531 86536 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 stealth
63 10728 DROP udp -- * * 0.0.0.0/0 0.0.0.0/0 stealth
root@osconsfortress:~# iptables -t mangle -L INPUT -v -n
root@osconsfortress:~# iptables -t mangle -L INPUT -v -n
Chain INPUT (policy ACCEPT 3777K packets, 4899M bytes)
pkts bytes target prot opt in out source destination
root@osconsfortress:~# iptables -t mangle -A INPUT -i eth1 -p tcp -m stealth -j DROP
root@osconsfortress:~# iptables -t mangle -A INPUT -i eth0 -p tcp -m stealth -j DROP
root@osconsfortress:~# iptables -t mangle -A INPUT -i ppp0 -p tcp -m stealth -j DROP
root@osconsfortress:~# iptables -t mangle -A INPUT -i tap0 -p tcp -m stealth -j DROP
root@osconsfortress:~# iptables -t mangle -L INPUT -v -n
Chain INPUT (policy ACCEPT 3777K packets, 4899M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 stealth
0 0 DROP tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 stealth
1 40 DROP tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 stealth
0 0 DROP tcp -- tap0 * 0.0.0.0/0 0.0.0.0/0 stealth
root@osconsfortress:~# dmesg | tail -1
Real Time Clock Driver v1.12ac
root@osconsfortress:~# uptime
10:40:38 up 9 days, 33 min, 3 users, load average: 0.28, 0.55, 0.42
root@osconsfortress:~#
madcat wrote:I tested 2.6.27.10 and it works if I use stealth rules in the mangle table; if I use stealth in the default table (the filter table) i get an invalid argument error.
root@osconsfortress:~# iptables -A INPUT -m stealth -j DROP
iptables: Invalid argument
root@osconsfortress:~# iptables -A INPUT -p tcp -m stealth -j DROP
root@osconsfortress:~# iptables -A INPUT -p udp -m stealth -j DROP
root@osconsfortress:~# iptables -V
iptables v1.4.2
# iptables -A INPUT -m stealth -j DROP
iptables: Invalid argument
# iptables -A INPUT -p tcp -m stealth -j DROP
iptables: Invalid argument
# iptables -A INPUT -p udp -m stealth -j DROP
iptables: Invalid argument
# iptables -t mangle -A INPUT -p tcp -m stealth -j DROP
# uname -a
Linux caronte 2.6.27.10-grsec #3 Sun Mar 22 16:07:46 CET 2009 i686 GNU/Linux
caronte:~# iptables -V
iptables v1.4.2
oscon@osconsfortress:/tmp$ sha256sum iptables_1.4.2-6_i386.deb
12d8815d5a170d30271e8b3226d46db51adc02fd13531e9d6a140b79234e279d iptables_1.4.2-6_i386.deb
#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CT_ACCT=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_EVENTS=y
# CONFIG_NF_CT_PROTO_DCCP is not set
CONFIG_NF_CT_PROTO_SCTP=y
CONFIG_NF_CT_PROTO_UDPLITE=y
# CONFIG_NF_CONNTRACK_AMANDA is not set
CONFIG_NF_CONNTRACK_FTP=y
# CONFIG_NF_CONNTRACK_H323 is not set
CONFIG_NF_CONNTRACK_IRC=y
# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
# CONFIG_NF_CONNTRACK_PPTP is not set
# CONFIG_NF_CONNTRACK_SANE is not set
# CONFIG_NF_CONNTRACK_SIP is not set
CONFIG_NF_CONNTRACK_TFTP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
CONFIG_NETFILTER_XT_TARGET_DSCP=y
CONFIG_NETFILTER_XT_TARGET_MARK=y
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_NOTRACK=y
CONFIG_NETFILTER_XT_TARGET_RATEEST=y
CONFIG_NETFILTER_XT_TARGET_TRACE=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
CONFIG_NETFILTER_XT_MATCH_COMMENT=y
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_DCCP=y
CONFIG_NETFILTER_XT_MATCH_DSCP=y
CONFIG_NETFILTER_XT_MATCH_ESP=y
CONFIG_NETFILTER_XT_MATCH_HELPER=y
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
CONFIG_NETFILTER_XT_MATCH_LENGTH=y
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
CONFIG_NETFILTER_XT_MATCH_MAC=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_OWNER=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
CONFIG_NETFILTER_XT_MATCH_QUOTA=y
CONFIG_NETFILTER_XT_MATCH_RATEEST=y
CONFIG_NETFILTER_XT_MATCH_REALM=y
CONFIG_NETFILTER_XT_MATCH_SCTP=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
CONFIG_NETFILTER_XT_MATCH_STRING=y
CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_TIME=y
CONFIG_NETFILTER_XT_MATCH_U32=y
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
#
# IP: Netfilter Configuration
#
CONFIG_NF_CONNTRACK_IPV4=y
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
CONFIG_IP_NF_QUEUE=y
CONFIG_IP_NF_IPTABLES=y
# CONFIG_IP_NF_MATCH_RECENT is not set
CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_AH=y
CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_MATCH_ADDRTYPE=y
CONFIG_IP_NF_MATCH_STEALTH=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_LOG=y
CONFIG_IP_NF_TARGET_ULOG=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_REDIRECT=y
CONFIG_IP_NF_TARGET_NETMAP=y
CONFIG_NF_NAT_SNMP_BASIC=y
CONFIG_NF_NAT_PROTO_UDPLITE=y
CONFIG_NF_NAT_PROTO_SCTP=y
CONFIG_NF_NAT_FTP=y
CONFIG_NF_NAT_IRC=y
CONFIG_NF_NAT_TFTP=y
# CONFIG_NF_NAT_AMANDA is not set
# CONFIG_NF_NAT_PPTP is not set
# CONFIG_NF_NAT_H323 is not set
# CONFIG_NF_NAT_SIP is not set
CONFIG_IP_NF_MANGLE=y
CONFIG_IP_NF_TARGET_ECN=y
CONFIG_IP_NF_TARGET_TTL=y
# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
CONFIG_IP_NF_RAW=y
CONFIG_IP_NF_SECURITY=y
CONFIG_IP_NF_ARPTABLES=y
CONFIG_IP_NF_ARPFILTER=y
CONFIG_IP_NF_ARP_MANGLE=y
# CONFIG_IP_DCCP is not set
CONFIG_IP_SCTP=y
# CONFIG_SCTP_DBG_MSG is not set
# CONFIG_SCTP_DBG_OBJCNT is not set
# CONFIG_SCTP_HMAC_NONE is not set
# CONFIG_SCTP_HMAC_SHA1 is not set
CONFIG_SCTP_HMAC_MD5=y
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
CONFIG_NET_SCHED=y
The funny thing is i always get the same error even trying your binary deb package or the one build from your sources. Weird.
Here is my netfilter config (no support for modules):
make-kpkg clean
gcc version 4.3.2 (Debian 4.3.2-1.1)
madcat wrote:Sorry, it was snort-inline that didn't like new iptables stealth rules. Disabling iptables queue to snort-inline fixed the problem at least with kernel 2.6.27.10.
Still the oops with newer kernels (2.6.28) are the same.... when i'll have more time i'll try to find out what is changed and how to fix stealth module.
Thank you