Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 2019 22:43:46 +0100
From:      Steffen Rick <steffen.rick@srick.org>
To:        freebsd-net@freebsd.org
Subject:   Re: ipfilter not creating entries in the state table
Message-ID:  <20190709214346.GA42407@gefjun.hzn.srick.org>
In-Reply-To: <20190703164229.GA5930@gefjun.hzn.srick.org>
References:  <20190703164229.GA5930@gefjun.hzn.srick.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Any chance someone with a better understanding of how stateful
firewall rules work able to take a look at this with me? I'm trying to
make my firewall ruleset rock solid in the long run and this is one of
the occasions where Ihaven't been able to do so yet.

Any comment appreciated!

Steffen

On Wed, Jul 03, 2019 at 05:42:29PM +0100, Steffen Rick wrote:
> Hi,
> 
> hoping you guys can help me with this. I'm somehow unable to create an
> ipfilter configuration that will use stateful filtering on IPv6. What
> I have is a very simple ipf.rules file:
> 
> ipf.rules:
> pass in quick on lo0 all
> pass out quick on lo0 all
> 
> pass out quick on re0 all keep state
> 
> pass in quick on re0 proto tcp from any to any port = 22
> 
> block in log quick on re0 all
> 
> default kernel wise is to accept traffic
> (I do this to not log myself out when working remotely)
> 
> When I lookup www.google.com over IPv4 I get an entry in the state table
> 
> dig -A www.google.com @8.8.8.8
> ipfstat -t
> Src: 0.0.0.0, Dest: 0.0.0.0, Proto: any, Sorted by: # bytes
> 
> Source IP             Destination IP         ST   PR   #pkts    #bytes       ttl
> 188.40.60.69,22       80.79.143.188,47160   4/4  tcp      75     14048 119:59:59
> 188.40.60.96,51126    8.8.8.8,53            0/0  udp       1        83      0:03
> 
> When I try to lookup the A record on the IPv6 server I get no state table entry
> 
> dig -A www.google.com @2001:4860:4860::8888
> no state table entry and no response from the server
> 
> tcpdump -nnn host 2001:4860:4860::8888
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on re0, link-type EN10MB (Ethernet), capture size 262144 bytes
> 16:48:48.588867 IP6 2a01:4f8:221:181::2.62706 > 2001:4860:4860::8888.53: 15010+ [1au] A? www.google.com. (55)
> 16:48:48.602580 IP6 2001:4860:4860::8888.53 > 2a01:4f8:221:181::2.62706: 15010 1/0/1 A 216.58.206.4 (59)
> 16:48:53.663637 IP6 2a01:4f8:221:181::2.62706 > 2001:4860:4860::8888.53: 15010+ [1au] A? www.google.com. (55)
> 16:48:53.668845 IP6 2001:4860:4860::8888.53 > 2a01:4f8:221:181::2.62706: 15010 1/0/1 A 216.58.206.4 (59)
> 16:48:58.744154 IP6 2a01:4f8:221:181::2.62706 > 2001:4860:4860::8888.53: 15010+ [1au] A? www.google.com. (55)
> 16:48:58.764794 IP6 2001:4860:4860::8888.53 > 2a01:4f8:221:181::2.62706: 15010 1/0/1 A 216.58.206.4 (59)
> ^C
> 
> The request seems to have gone through just fine but my dig client times out.
> 
> I change the ruleset to include
> 
> pass in quick on re0 inet6 proto tcp from any port = 53
> pass in quick on re0 inet6 proto udp from any port = 53
> 
> and then I'm obviously able to get a response from the server.
> 
> tcpdump -nnn host 2001:4860:4860::8888
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on re0, link-type EN10MB (Ethernet), capture size 262144 bytes
> 16:47:36.738177 IP6 2a01:4f8:221:181::2.40852 > 2001:4860:4860::8888.53: 54683+ [1au] A? www.google.com. (55)
> 16:47:36.751447 IP6 2001:4860:4860::8888.53 > 2a01:4f8:221:181::2.40852: 54683 1/0/1 A 172.217.18.164 (59)
> ^C
> 
> That obiously ignores the statefulness of the firewall. Is this a
> known issue? Has anyone ipfilter working with stateful rules correctly
> being created when making outbound requests?
> 
> Any help appreciated!
> 
> Thanks,
> Steffen
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190709214346.GA42407>