Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: "Nirgal Vourgère" <contact_vgernf@nirgal.com>
Cc: netfilter@vger.kernel.org
Subject: Re: Issue migrating "iptables -m socket --transparent" into nftables
Date: Mon, 17 Aug 2020 21:34:06 +0200	[thread overview]
Message-ID: <20200817193406.GE15804@breakpoint.cc> (raw)
In-Reply-To: <30147982.tmreYhUOsE@deimos>

Nirgal Vourgère <contact_vgernf@nirgal.com> wrote:
> 
>     ip rule add fwmark 1 lookup haproxy
>     ip route add local default dev lo table haproxy
> 
> My firewall rules have
> 
>     iptables -t mangle -A PREROUTING -m socket --transparent -j MARK --set-mark 1

[..]

> I tried this nft rule:
> 
>     table inet haproxy {
>         chain prerouting {
>             type filter hook prerouting priority -150; policy accept;
>             socket transparent 1 mark set 0x00000001
>         }
>     }
> 
> It does work, but all traffic is routed to the haproxy socket, including outbound masqueraded connection… I mean when a box on the lan side connects to a foreign https server, the connection is grabbed by haproxy, which is not what I want.

I don't understand how the iptables rule would not do exactly the same
thing, there is nothing that checks interface names or addresses.

Are you sure there is nothing in the iptables rule set that
makes the socket rule only handle those packets that should be redirected?

  reply	other threads:[~2020-08-17 19:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 14:54 Issue migrating "iptables -m socket --transparent" into nftables Nirgal Vourgère
2020-08-17 19:34 ` Florian Westphal [this message]
2020-08-17 23:25   ` Nirgal Vourgère
2020-08-18 10:17     ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200817193406.GE15804@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=contact_vgernf@nirgal.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox