Linux Netfilter discussions
 help / color / mirror / Atom feed
* validate IPsec outgoing packets using NFtables
@ 2020-04-06 15:33 Olivier Alabeatrix
  2020-04-06 15:49 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Alabeatrix @ 2020-04-06 15:33 UTC (permalink / raw)
  To: netfilter

Hi!

Using Debian 10/nftables v0.9.0, i'm having troubles having nftables
validate outgoing ipsec packets using the secpath meta.
This is part of a ruleset on R1, an IPsec gateway, that is supposed to
only forward traffic between 172.16.11.0/24 and 172.16.12.0/24 if it is
secured by Ipsec:

172.16.11.0/24-R1-----ESP-----R2-172.16.12.0/24

chain forward {
                type filter hook forward priority 0; policy drop;
		ip saddr 172.16.12.0/24 ip daddr 172.16.11.0/24 meta
secpath exists counter accept
		ip saddr 172.16.11.0/24 ip daddr 172.16.12.0/24 counter
accept
		log prefix "NFtables: FWD:"
                counter drop
        }


chain postrouting {
		type filter hook forward priority 0; policy drop;
#never matching:
		ip saddr 172.16.11.0/24 ip daddr 172.16.12.0/24 meta
secpath exists counter accept
		ip saddr 172.16.12.0/24 ip daddr 172.16.12.0/24 counter
accept
		log prefix "NFtables: POST:"
		counter drop
	}

While the forward chaine does match incoming ipsec-secured packets
using:

ip saddr 172.16.12.0/24 ip daddr 172.16.11.0/24 meta secpath exists
counter accept

The postrouting chain secpath rule never matches:
ip saddr 172.16.11.0/24 ip daddr 172.16.12.0/24 meta secpath exists
counter accept

What may I be doing wrong? Any help is welcomed.

 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: validate IPsec outgoing packets using NFtables
  2020-04-06 15:33 validate IPsec outgoing packets using NFtables Olivier Alabeatrix
@ 2020-04-06 15:49 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2020-04-06 15:49 UTC (permalink / raw)
  To: Olivier Alabeatrix; +Cc: netfilter

Olivier Alabeatrix <oalabeatrix@gmail.com> wrote:
> The postrouting chain secpath rule never matches:
> ip saddr 172.16.11.0/24 ip daddr 172.16.12.0/24 meta secpath exists
> counter accept
> 
> What may I be doing wrong? Any help is welcomed.

Outgoing packets do not have a secpath, you will need to use
'rt ipsec exists'.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-06 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-06 15:33 validate IPsec outgoing packets using NFtables Olivier Alabeatrix
2020-04-06 15:49 ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox