From: /dev/rob0 Subject: Re: forwarded ports become "filtered" instead of "open" Date: Wed, 10 Aug 2005 14:25:41 -0500 Message-ID: <200508101425.41958.rob0@gmx.co.uk> References: <42F9046F.9090004@nodivisions.com> <42FA17D6.1030707@mnemon.de> <42FA3907.6040606@nodivisions.com> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <42FA3907.6040606@nodivisions.com> Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-bounces@lists.netfilter.org Errors-To: netfilter-bounces@lists.netfilter.org Content-Type: text/plain; charset="iso-8859-1" To: netfilter@lists.netfilter.org On Wednesday 2005-August-10 12:27, Anthony DiSante wrote: > J=F6rg Harmuth wrote: > >>Can anyone offer some pointers here? I imagine more of my > >> narc.conf and/or iptables' output would be helpful, but rather > >> than me attaching the whole thing right now, just ask if you want > >> me to post any of that. I would point out that this "narc.conf" appears to be controlling a=20 rather complex script. I cannot answer anything about it. I can look=20 over your rules ... needlessly complex IMO ... and point out problems.=20 But for issues with this script, consult its documentation (and source=20 code) and ask elsewhere. > # iptables-save > # Generated by iptables-save v1.3.1 on Wed Aug 10 13:21:27 2005 > *mangle > > -A PREROUTING -d 0.0.0.0/255.0.0.0 -i eth0 -m state --state NEW -j > DROP =46iltering in the nat or mangle tables is not advised. It might not even=20 work as expected. I have no idea what the script writer is doing here,=20 nor why s/he is doing it here in particular. Here are the rules in INPUT: > -A INPUT -j SPOOF_CHK > -A INPUT -p tcp -j SANITY_CHK > -A INPUT -j STATE_CHK > -A INPUT -s 127.0.0.0/255.255.255.0 -d 127.0.0.0/255.255.255.0 -i lo > -m state --state NEW -j ACCEPT > -A INPUT -p tcp -j TCP_CHK > -A INPUT -p udp -j UDP_CHK > -A INPUT -p icmp -j ICMP_CHK We'll consider SSH. That is first examined by SPOOF_CHK, then by=20 SANITY_CHK, then by STATE_CHK, and finally by TCP_CHK. > -A STATE_CHK -m state --state RELATED,ESTABLISHED -j ACCEPT You're probably right that when you manually try in both directions,=20 you're going to fool connection tracking into thinking that it's=20 related. > -A STATE_CHK -p tcp -m state --state NEW -m tcp ! --tcp-flags > SYN,RST,ACK SYN -j DROP I'm not sure what this does. It might be dropping your SSH depending on=20 the TCP flags which are set. > -A TCP_CHK -s 10.0.0.12 -d 10.0.0.12 -p tcp -m tcp --dport 3029:3038 > -j ACCEPT These rules are bypassed. The last rule in SPOOF_CHK : > -A SPOOF_CHK -s 10.0.0.12 -i eth0 -j CUST_LOG has already dropped anything which would match. I don't understand what=20 they were supposed to do anyway, both source and destination the local=20 eth0 IP address? > -A TCP_CHK -i eth0 -p tcp -m multiport --dports 22,873,80,9618 -m > state --state NEW -m tcp --tcp-flags SYN,RST,ACK SYN -j ACCEPT This looks like it should be accepting your SSH, but for some reason=20 it's not. What is the IP you are using, the NAT'ed external IP, or the=20 direct 10.0.0.12 and .13? If you're using the NAT'ed IP, the problem is=20 on the router which is doing the NAT. (And I agree, that was a lousy=20 way to set this up.) > -A TCP_CHK -i eth0 -p tcp -m multiport --dports 22,80,873,9618 -m > state --state NEW -m tcp --tcp-flags SYN,RST,ACK SYN -j ACCEPT Same rule twice? That's strange. Anyway, your solution is quite simple. Put an ACCEPT rule ahead of=20 anything which would drop or reject the packets you want. =2D-=20 mail to this address is discarded unless "/dev/rob0" or "not-spam" is in Subject: header