Skip to contentSkip to conversation

How are ct helper to be configured with NFT ?

DISCUSSION leroy christophe 3 participants 10 messages Nov 26, 2014 – Mar 2, 2016

lore
Share & tools
lore
#0 lore raw

I need to do something equivalent to

    iptables -t raw -A OUTPUT -p udp -d 192.168.2.1 --dport tftp -j CT 

--helper tftp

I tried the following

nft add rule filter output ct helper "tftp" udp dport tftp

But it looks like it doesn't work, I still get.

[ 1113.706274] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.

What is the correct syntaxe for that ?

Christophe

#1 lore raw

Hi,

I still get the warning from the kernel

# tftp -g server -r test.c
[ 1359.853269] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.
test.c               100% |************************************************************************| 804   0:00:00 ETA
# nft list ruleset
table ip filter {
        chain output {
                 type filter hook output priority 0;
                 udp dport tftp ct helper "tftp"
        }
        chain input {
                 type filter hook input priority 0;
                 oifname "lo" accept
                 ct state { established, related} accept
                 ct state new tcp dport ssh accept
                 ip protocol icmp accept
                 drop
        }

        chain forward {
                 type filter hook forward priority 0;
                 drop
        }
}

Can you help ?

Thanks
Christophe

Quoted 17 lines · leroy christophe

I need to do something equivalent to

    iptables -t raw -A OUTPUT -p udp -d 192.168.2.1 --dport tftp -j CT 

--helper tftp

I tried the following

nft add rule filter output ct helper "tftp" udp dport tftp

But it looks like it doesn't work, I still get.

[ 1113.706274] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.

What is the correct syntaxe for that ?

Christophe

#2 lore raw
Quoted 8 lines · leroy christophe

Hi,

I still get the warning from the kernel

# tftp -g server -r test.c
[ 1359.853269] nf_conntrack: automatic helper assignment is
deprecated and it will be removed soon. Use the iptables CT target
to attach helpers instead.

This is related to nf_conntrack. Read this:

https://home.regit.org/netfilter-en/secure-use-of-helpers/

Quoted 8 lines

test.c 100% |************************************************************************|
804 0:00:00 ETA

# nft list ruleset
table ip filter {
        chain output {
                 type filter hook output priority 0;
                 udp dport tftp ct helper "tftp"

The right syntax is:

udp dport tftp ct helper set "tftp"
^^^

your rule above does something different:

1) udp dport tftp

and

2) the ct helper is "tftp"

However, userspace supports this but unfortunately the kernel code is still missing. So you'll have to wait for this feature or (temporarily) rely on the automagic helper assignment (from that message, I understand you already do).

Quoted 6 lines
        }

        chain input {
                 type filter hook input priority 0;
                 oifname "lo" accept
                 ct state { established, related} accept

I think I already mentioned that ct state are flags.

# nft describe ct state
ct expression, datatype ct_state (conntrack state) (basetype bitmask, integer), 32 bits

pre-defined symbolic constants:

        invalid                         0x00000001
        new                             0x00000008
        established                     0x00000002
        related                         0x00000004
        untracked                       0x00000040

so you can express that as command separated values, ie.

ct state established,related accept

This only works if the basetype is a bitmask.

#3 lore raw
Quoted 18 lines · Pablo Neira Ayuso
Quoted 8 lines · leroy christophe

test.c 100% |************************************************************************|
804 0:00:00 ETA

# nft list ruleset
table ip filter {
         chain output {
                  type filter hook output priority 0;
                  udp dport tftp ct helper "tftp"

The right syntax is:

udp dport tftp ct helper set "tftp"
^^^

your rule above does something different:

1) udp dport tftp

Quoted 8 lines

and

2) the ct helper is "tftp"

However, userspace supports this but unfortunately the kernel code is still missing. So you'll have to wait for this feature or (temporarily) rely on the automagic helper assignment (from that message, I understand you already do).

Any idea of when the kernel support will be added ?

Christophe

#4 lore raw

my understanding was 3.13 had the core of nftables merged

Quoted 41 lines · leroy christophe

Le 05/12/2014 11:38, Pablo Neira Ayuso a écrit :

Quoted 22 lines · leroy christophe
Quoted 10 lines

test.c 100%

|************************************************************************|
804   0:00:00 ETA
# nft list ruleset
table ip filter {
         chain output {
                  type filter hook output priority 0;
                  udp dport tftp ct helper "tftp"

The right syntax is:

udp dport tftp ct helper set "tftp"
^^^

your rule above does something different:

1) udp dport tftp

Quoted 8 lines

and

2) the ct helper is "tftp"

However, userspace supports this but unfortunately the kernel code is still missing. So you'll have to wait for this feature or (temporarily) rely on the automagic helper assignment (from that message, I understand you already do).

Any idea of when the kernel support will be added ?

Christophe

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 1 line · Jason Sipula

my understanding was 3.13 had the core of nftables merged

Yes but according to Pablo, "userspace supports this but unfortunately the kernel code is still missing". Hence my question.

As of today, what is the status of nftables regarding the support of ct helper ? If it is not in yet, how can I help getting it in ?

Christophe

Quoted 31 lines
Quoted 28 lines · leroy christophe
Quoted 27 lines · Pablo Neira Ayuso
Quoted 9 lines · leroy christophe

test.c 100%

|************************************************************************|
804   0:00:00 ETA
# nft list ruleset
table ip filter {
          chain output {
                   type filter hook output priority 0;
                   udp dport tftp ct helper "tftp"

The right syntax is:

udp dport tftp ct helper set "tftp"
^^^

your rule above does something different:

1) udp dport tftp

and

2) the ct helper is "tftp"

However, userspace supports this but unfortunately the kernel code is still missing. So you'll have to wait for this feature or (temporarily) rely on the automagic helper assignment (from that message, I understand you already do).

Quoted 8 lines
Quoted 8 lines

Any idea of when the kernel support will be added ?

Christophe

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

#6 lore raw

Maybe we're talking about different things? I had read in some places that linux kernel version 3.13 had the core of nftables merged.

https://wiki.archlinux.org/index.php/Nftables

I do not know anything about ct helper, however.

Quoted 69 lines · christophe leroy
Quoted 2 lines · Jason Sipula

my understanding was 3.13 had the core of nftables merged

Yes but according to Pablo, "userspace supports this but unfortunately the kernel code is still missing".
Hence my question.

As of today, what is the status of nftables regarding the support of ct helper ?
If it is not in yet, how can I help getting it in ?

Christophe

Quoted 37 lines
Quoted 34 lines · leroy christophe
Quoted 31 lines · Pablo Neira Ayuso
Quoted 11 lines · leroy christophe

test.c 100%

|************************************************************************|
804   0:00:00 ETA
# nft list ruleset
table ip filter {
          chain output {
                   type filter hook output priority 0;
                   udp dport tftp ct helper "tftp"

The right syntax is:

udp dport tftp ct helper set "tftp"
^^^

your rule above does something different:

1) udp dport tftp

and

2) the ct helper is "tftp"

However, userspace supports this but unfortunately the kernel code is still missing. So you'll have to wait for this feature or (temporarily) rely on the automagic helper assignment (from that message, I understand you already do).

Quoted 8 lines
Quoted 8 lines

Any idea of when the kernel support will be added ?

Christophe

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

#7 lore raw

Le 12/10/2015 20:11, Jason Sipula a écrit :

Quoted 6 lines

Maybe we're talking about different things? I had read in some places that linux kernel version 3.13 had the core of nftables merged.

https://wiki.archlinux.org/index.php/Nftables

I do not know anything about ct helper, however.

"ct helper" stands for conntrack helper. It is some part of netfilter that helps conntrack to track complex streams like FTP or TFTP streams where the conntrack needs to identify and keep track of the data stream associated to the signalling stream

Christophe

#8 lore raw
In reply to christophe leroy
Quoted 10 lines · christophe leroy
Quoted 1 line · Jason Sipula

my understanding was 3.13 had the core of nftables merged

Yes but according to Pablo, "userspace supports this but unfortunately the kernel code is still missing".
Hence my question.

As of today, what is the status of nftables regarding the support of ct helper ?
If it is not in yet, how can I help getting it in ?

I'd appreciate of you can send me patches that we can discuss on [email protected].

I think it only requires extra little code for the nft_meta expression from the kernel.

Thanks.

#9 lore raw
Quoted 7 lines · Pablo Neira Ayuso
Quoted 6 lines · christophe leroy
Quoted 1 line · Jason Sipula

my understanding was 3.13 had the core of nftables merged

Yes but according to Pablo, "userspace supports this but unfortunately the kernel code is still missing".
Hence my question.

Quoted 10 lines
Quoted 3 lines

As of today, what is the status of nftables regarding the support of ct helper ?
If it is not in yet, how can I help getting it in ?

I'd appreciate of you can send me patches that we can discuss on [email protected].

I think it only requires extra little code for the nft_meta expression from the kernel.

Isn't it is in nft_ct instead of nft_meta ?

I'm having difficulties to understand how it works.
nft_ct_set_init() is called when I add the rule in the table. So I believe I have to call nf_ct_helper_ext_add() from here, haven't I ? But how do I get the name of the requested helper from that function ? I suppose once I get it I can do the same as xt_ct_set_helper() does.

Otherwise, nft_ct_set_eval() is called when the helper is needed, but I suppose it is too late when that happens because the conntrack has already said that it has used automatic helper assignment.

Christophe

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus