nf_conntrack_helper replacement?
Hi All,
$ uname -r 6.0.12-300.fc37.x86_64
Since kernel 6.0.1,
/proc/sys/net/netfilter/nf_conntrack_helper
has been removed.
This breaks passive ftp.
What do you guys do to work around the problem?
Many thanks,
-T
Signature · 4 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Computers are like air conditioners. They malfunction when you open windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Am 20.12.22 um 20:00 schrieb ToddAndMargo:
Quoted 8 lines
Hi All,
$ uname -r 6.0.12-300.fc37.x86_64Since kernel 6.0.1,
/proc/sys/net/netfilter/nf_conntrack_helper
has been removed.
the deprecation warning dates back many years
Quoted 3 lines
This breaks passive ftp.
What do you guys do to work around the problem
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
Quoted 5 lines · Reindl Harald
Am 20.12.22 um 20:00 schrieb ToddAndMargo:
Quoted 2 lines
Hi All,
Quoted 8 lines
Quoted 6 lines
$ uname -r 6.0.12-300.fc37.x86_64Since kernel 6.0.1,
/proc/sys/net/netfilter/nf_conntrack_helper
has been removed.the deprecation warning dates back many years
Do you have a link to that? I could not
find one.
Quoted 4 lines
Quoted 3 lines
This breaks passive ftp.
What do you guys do to work around the problem
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
What is Jump to CT "-j CT"?
Thank you!
Am 20.12.22 um 20:34 schrieb ToddAndMargo:
Quoted 9 lines · Reindl Harald
Quoted 8 lines
Am 20.12.22 um 20:00 schrieb ToddAndMargo:
Quoted 5 lines
Hi All,
$ uname -r 6.0.12-300.fc37.x86_64
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Since kernel 6.0.1,
/proc/sys/net/netfilter/nf_conntrack_helper
has been removed.the deprecation warning dates back many years
Do you have a link to that? I could not
find one.
i read my syslogs / dmesg and that article is 9 years old: https://gitlab.alpinelinux.org/alpine/awall/-/issues/1540
dmesg: nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
This breaks passive ftp.
What do you guys do to work around the problem
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
What is Jump to CT "-j CT"?
Quoted 25 lines · Reindl Harald
Am 20.12.22 um 20:34 schrieb ToddAndMargo:
Quoted 9 lines · Reindl Harald
Quoted 8 lines
Am 20.12.22 um 20:00 schrieb ToddAndMargo:
Quoted 5 lines
Hi All,
$ uname -r 6.0.12-300.fc37.x86_64Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Since kernel 6.0.1,
/proc/sys/net/netfilter/nf_conntrack_helper
has been removed.the deprecation warning dates back many years
Do you have a link to that? I could not
find one.i read my syslogs / dmesg and that article is 9 years old: https://gitlab.alpinelinux.org/alpine/awall/-/issues/1540
dmesg:
nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
This breaks passive ftp.
What do you guys do to work around the problem
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
What is Jump to CT "-j CT"?
Thank you!
Quoted 1 line · Reindl Harald
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
What do I need to alter on my ftp tables to get this to work? Do I remove "-m conntrack"?
$tbls -A dsl-out -o $eth1 -p tcp -s $eth1_addr --sport $unassgn --dport ftp -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
$tbls-nft -A dsl-in -i $eth1 -p tcp ! --syn --sport ftp -d $eth1_addr --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED
-j ACCEPT
$tbls-nft -A dsl-for -i $eth1 -p tcp ! --syn --sport ftp -d $internal_net --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
$tbls-nft -A dsl-out -o $eth1 -p tcp -s $eth1_addr -d $ANY_IP
-m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED
-j ACCEPT
$tbls-nft -A dsl-in -i $eth1 -p tcp ! --syn -s $ANY_IP -d $eth1_addr -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
$tbls-nft -A dsl-for -i $eth1 -p tcp ! --syn -s $ANY_IP -d $internal_net -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
Am 20.12.22 um 20:50 schrieb ToddAndMargo:
Quoted 6 lines · Reindl Harald
Quoted 1 line
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
What do I need to alter on my ftp tables to get this to work? Do I remove "-m conntrack"?
no you need to understand the rule above it's RAW PREROUTING, all your rules below are INPUT
and frankly i have no idea why you have that much "-ctstate RELATED,ESTABLISHED" rules with a useless "! --syn"
you need exactly ONE "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" rule as the first of your ruleset which handles UDP and TCP (aka don't specify -p)
and one which drops "ctstate INVALID" which can't be at the same time "RELATED,ESTABLISHED"
that rule handles 99% of all packets - everything after that are new connections by definition and need your specific ACCEPT RULES
at the end of the ruleset you can set a final DROP action but with "policy DROP" everything not accepted will be dropped anyways
Chain INPUT (policy DROP 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination 1 6730K 2218M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
Quoted 16 lines
$tbls -A dsl-out -o $eth1 -p tcp -s $eth1_addr --sport $unassgn --dport ftp -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
$tbls-nft -A dsl-in -i $eth1 -p tcp ! --syn --sport ftp -d $eth1_addr --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED
-j ACCEPT$tbls-nft -A dsl-for -i $eth1 -p tcp ! --syn --sport ftp -d $internal_net --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
$tbls-nft -A dsl-out -o $eth1 -p tcp -s $eth1_addr -d $ANY_IP
-m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED
-j ACCEPT$tbls-nft -A dsl-in -i $eth1 -p tcp ! --syn -s $ANY_IP -d $eth1_addr -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
$tbls-nft -A dsl-for -i $eth1 -p tcp ! --syn -s $ANY_IP -d $internal_net -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
Quoted 3 lines · Reindl Harald
no you need to understand the rule above it's RAW PREROUTING, all your rules below are INPUT
Do you have a link for that?
Am 20.12.22 um 21:05 schrieb ToddAndMargo:
Quoted 7 lines · Reindl Harald
Quoted 3 lines
no you need to understand the rule above it's RAW PREROUTING, all your rules below are INPUT
Do you have a link for that?
i gave you the link already: https://gitlab.alpinelinux.org/alpine/awall/-/issues/1540
for any other information type "iptables CT target" in any random search engine
for understanding of basics like RAW/M;ANGLE/PREROUTING you need to read docs and google for "iptables flowchart"
sorry, a maling-list can't replace reading docs and understand how iptables is working - that should be done before creating rulesets to begin with
Quoted 1 line · Reindl Harald
you need exactly ONE "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" rule as the first of your ruleset which handles UDP and TCP (aka don't specify -p)
Hi Reindl,
[!] -p, --protocol protocol
The protocol of the rule or of the packet to check. The specified protocol can be one of tcp, udp, udplite, icmp, icmpv6,esp, ah, sctp, mh or the special keyword "all"
Is leavingf off the "-p xxx" the same and "-p all"? If so, I am no sure tht I feel confortable opening up "udplite, icmp, icmpv6, esp, ah, sctp, mh" as well.
Thank you for all the help so far!
-T
Am 20.12.22 um 23:55 schrieb ToddAndMargo:
Quoted 10 lines · Reindl Harald
Quoted 1 line
you need exactly ONE "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" rule as the first of your ruleset which handles UDP and TCP (aka don't specify -p)
[!] -p, --protocol protocol
The protocol of the rule or of the packet to check. The specified protocol can be one of tcp, udp, udplite, icmp, icmpv6,esp, ah, sctp, mh or the special keyword "all"Is leavingf off the "-p xxx" the same and "-p all"?
surely
Quoted 3 lines
If so, I am no sure tht I feel confortable opening up "udplite, icmp, icmpv6, esp, ah, sctp, mh" as well.
you do not open anything - when you don't even understand that "RELATED,ESTABLISHED" only hits RESPONSE packets and so there must have been any rule accepting the initial packet of a connection please refrain for setup fireall rules
how do you imagine a ESTABLISHED state packet can exist in a protocl you didn't accept the initial connect packet?
Quoted 16 lines · Reindl Harald
Am 20.12.22 um 23:55 schrieb ToddAndMargo:
Quoted 10 lines · Reindl Harald
Quoted 1 line
you need exactly ONE "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" rule as the first of your ruleset which handles UDP and TCP (aka don't specify -p)
[!] -p, --protocol protocol
The protocol of the rule or of the packet to check. The specified protocol can be one of tcp, udp, udplite, icmp, icmpv6,esp, ah, sctp, mh or the special keyword "all"Is leavingf off the "-p xxx" the same and "-p all"?
surely
Quoted 7 lines
Quoted 3 lines
If so, I am no sure tht I feel confortable opening up "udplite, icmp, icmpv6, esp, ah, sctp, mh" as well.
you do not open anything - when you don't even understand that "RELATED,ESTABLISHED" only hits RESPONSE packets and so there must have been any rule accepting the initial packet of a connection please refrain for setup fireall rules
how do you imagine a ESTABLISHED state packet can exist in a protocl you didn't accept the initial connect packet?
Bad guys fussing with packets to trick your stuff.
Hi Reindl,
I think that my level of paranoia is higher that yours. It may comes from you understand this stuff many times more than I do.
Thank you for all the wonderful help!
-T
Am 21.12.22 um 20:58 schrieb ToddAndMargo:
Quoted 21 lines · Reindl Harald
Quoted 20 lines
Am 20.12.22 um 23:55 schrieb ToddAndMargo:
Quoted 10 lines · Reindl Harald
Quoted 1 line
you need exactly ONE "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" rule as the first of your ruleset which handles UDP and TCP (aka don't specify -p)
[!] -p, --protocol protocol
The protocol of the rule or of the packet to check. The specified protocol can be one of tcp, udp, udplite, icmp, icmpv6,esp, ah, sctp, mh or the special keyword "all"Is leavingf off the "-p xxx" the same and "-p all"?
surely
Quoted 3 lines
If so, I am no sure tht I feel confortable opening up "udplite, icmp, icmpv6, esp, ah, sctp, mh" as well.
Quoted 5 lines
Quoted 3 lines
you do not open anything - when you don't even understand that "RELATED,ESTABLISHED" only hits RESPONSE packets and so there must have been any rule accepting the initial packet of a connection please refrain for setup fireall rules
how do you imagine a ESTABLISHED state packet can exist in a protocl you didn't accept the initial connect packet?
Bad guys fussing with packets to trick your stuff.
bad guys can't change how things are working
Quoted 5 lines
Hi Reindl,
I think that my level of paranoia is higher that yours. It may comes from you understand this stuff many times more than I do
your level of paranoia is fore sure not higher that mine but i don't throw rules which make no sense and which i don't understand in my infrastructure because every single rule i don't undertand in doubt does either hram or is useless
technical rules have nothing to do with paranoia
when you don't accept any inital packet of a connection there is no way that it falls under ctstate RELATED,ESTABLISHED
if you don't accept a sctp packet there is no way that any sctp could hit RELATED,ESTABLISHED
the problem with your curent ruleset ist that you did copy&paste rules from wherever without understanding what they are doing - that's the worst case szart of a firewall ruleset
Quoted 1 line · Reindl Harald
the problem with your curent ruleset ist that you did copy&paste rules from wherever without understanding what they are doing - that's the worst case szart of a firewall ruleset
Hi Reindl,
"Copy and Paste"? You got me there. Guess who I
am copying and pasting from. ... I am copying
and pasting my own work.
At the bottom of my external rules, I have
the following:
# Set everything else to deny all other network access:
#
$tbls -A dsl-in -j LOG --log-level $debug --log-prefix "dsl-in Everything Else " $tbls -A dsl-in -j DROP
$tbls -A dsl-out -j LOG --log-level $debug --log-prefix "dsl-out Everything Else " $tbls -A dsl-out -j DROP
$tbls -A dsl-for -j LOG --log-level $debug --log-prefix "dsl-for Everything Else " $tbls -A dsl-for -j DROP
If something shows up in the log, I investigate.
Create a new rule is required. And yes I do copy
and paste from a previous rule set.
Thank you for all the help!
-T
Am 22.12.22 um 21:40 schrieb ToddAndMargo:
Quoted 8 lines · Reindl Harald
Quoted 1 line
the problem with your curent ruleset ist that you did copy&paste rules from wherever without understanding what they are doing - that's the worst case szart of a firewall ruleset
Hi Reindl,
"Copy and Paste"? You got me there. Guess who I
am copying and pasting from. ... I am copying
and pasting my own work
clean up your ruleset and pretty sure after that it has only 20% of the rules and becomes auditable - what i have seen so far is a lot of redundancy and questionable rules you even don't know what they are doing
Quoted 2 lines · Reindl Harald
Quoted 1 line
What do you guys do to work around the problem
iptables-nft -t raw -A PREROUTING -p tcp --dport 21 -j CT --helper ftp
My computer does not have an ftp server operating on it. Do I still need the "-A PREROUTING" to talk to someone else's ftp server in passive mode?
Quoted 6 lines · On Tue, 20 Dec 2022 11:00:43 -0800 ToddAndMargo <[email protected]> wrote:
Hi All,
$ uname -r 6.0.12-300.fc37.x86_64Since kernel 6.0.1,
Since 6.0-rc4.
Quoted 4 lines
/proc/sys/net/netfilter/nf_conntrack_helper
has been removed.This breaks passive ftp.
Specifically, it removes automatic conntrack helper assignment, which was a security hazard.
Quoted 2 lines
What do you guys do to work around the problem?
You should assign the desired conntrack helper as a part of your ruleset. For example, "-t raw -A OUTPUT -p tcp --dport 21 -j CT --helper ftp". Or, "-A PREROUTING" if running an FTP server. The CT module is described by iptables-extensions(8) and, if needs be, you may refer to iptables(8) for the distinction between the OUTPUT and PREROUTING chains.
Should you decide to use nft(8) at some point in the future, see https://wiki.nftables.org/wiki-nftables/index.php/Conntrack_helpers.
Signature · 1 line
Kerin Millar
Fix it!!!
Now to try and figure out nftables!
This was the missing link:
$tbls -t raw -A OUTPUT -p tcp --dport 21 -j CT --helper ftp
Thank you all for the help!
Here are my new rules:
-T
# FTP Passive Mode stuff
# raw:
#
# This table is used mainly for configuring exemptions from # connection tracking in combination with the NOTRACK target. # It registers at the netfilter hooks with higher priority and # is thus called before ip_conntrack, or any other IP tables. # It provides the following built-in chains: PREROUTING (for # packets arriving via any network interface) OUTPUT (for # packets generated by local processes)
#
## this is a defunct method as of kernel 6.0.1 to assist with active ftp connection
# if [ "$(cat /proc/sys/net/netfilter/nf_conntrack_helper)" == "0" ]; then # echo "echo 1 > /proc/sys/net/netfilter/nf_conntrack_helper" # echo 1 > /proc/sys/net/netfilter/nf_conntrack_helper # fi
# https://bbs.archlinux.org/viewtopic.php?id=148345
$tbls -t raw -A OUTPUT -p tcp --dport 21 -j CT --helper ftp
$tbls -A dsl-out -o $eth1 -p tcp -s $eth1_addr --sport $unassgn --dport ftp -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT $tbls -A dsl-in -i $eth1 -p tcp --sport ftp -d $eth1_addr --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-for -i $eth1 -p tcp --sport ftp -d $internal_net --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-out -o $eth1 -p tcp -s $eth1_addr -d $ANY_IP -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-in -i $eth1 -p tcp -s $ANY_IP -d $eth1_addr -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-for -i $eth1 -p tcp -s $ANY_IP -d $internal_net -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
$tbls -A dsl-out -o $eth1 -p udp -s $eth1_addr --sport $unassgn --dport ftp -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT $tbls -A dsl-in -i $eth1 -p udp --sport ftp -d $eth1_addr --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-for -i $eth1 -p udp --sport ftp -d $internal_net --dport $unassgn -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-out -o $eth1 -p udp -s $eth1_addr -d $ANY_IP -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-in -i $eth1 -p udp -s $ANY_IP -d $eth1_addr -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT $tbls -A dsl-for -i $eth1 -p udp -s $ANY_IP -d $internal_net -m helper --helper ftp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT