• =?UTF-8?Q?Re=3A_Yes=2C_You_Need_A_Firewall_On_Linux_-_Here=E2=80=99?= =?UTF-8?Q?s_Why_And_Which_To_Use?=

    From Mike Scott@usenet.16@scottsonline.org.uk.invalid to comp.os.linux.misc on Wed Aug 27 06:56:46 2025
    From Newsgroup: comp.os.linux.misc

    On 19/08/2025 12:18, Mike Scott wrote:
    Having been pointed at nftables as the right direction, I had a word
    with chatgpt asking for examples for my use case. I treat the answers
    with suspicion, but they seem clear and reasonable, and I'll take a good look when I've time.

    (I'd given up on chatgpt ages ago, when it made Noddy mistakes on
    trivial code examples. Looks like things have improved since then.)

    Thanks all for helpful answers.

    Sorry for following up my own message, but.....

    I tried the chatgpt-generated nft config file yesterday. Interesting.

    It had a grossw syntactical error in it. I flagged this up to chatgpt,
    which apologised (!) and gave a slightly modified version. Same problem.
    I flagged it up again: it went away for almost 3 minutes, chuntering
    about checking things and "thinking". It came back with a decidedly
    modified version that had correct syntax.

    I told it to explain its error, and it said it had got muddled between
    nft and sh script syntax. Hmm.

    Anyway, the upshot is that I seem to have been right about nft's
    limitations compared to pf. It's concept of "set" (analogous to pf'
    "table" looks to have a huge issue.

    pf allows, for example
    pfctl -t inboundblock -T replace -f /etc/firewall/inboundblock
    which is an atomic operation. AFAICT, with nft you have to operate element-by-element, and cannot load a set from a file of wanted
    elements, nor clear nor replace the contents as a group.

    Is this correct?
    --
    Mike Scott
    Harlow, England
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.linux.misc on Thu Aug 28 00:50:33 2025
    From Newsgroup: comp.os.linux.misc

    On Wed, 27 Aug 2025 06:56:46 +0100, Mike Scott wrote:

    pf allows, for example
    pfctl -t inboundblock -T replace -f /etc/firewall/inboundblock
    which is an atomic operation.

    The docs say

    nft -f -2file-+

    is an atomic operation. You might have known that if yourCOd read them.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mike Scott@usenet.16@scottsonline.org.uk.invalid to comp.os.linux.misc on Thu Aug 28 09:40:34 2025
    From Newsgroup: comp.os.linux.misc

    On 28/08/2025 01:50, Lawrence DrCOOliveiro wrote:
    On Wed, 27 Aug 2025 06:56:46 +0100, Mike Scott wrote:

    pf allows, for example
    pfctl -t inboundblock -T replace -f /etc/firewall/inboundblock
    which is an atomic operation.

    The docs say

    nft -f -2file-+

    is an atomic operation. You might have known that if yourCOd read them.

    man nft |grep atomic
    troff:<standard input>:1317: warning [p 10, 4.7i, div '3tbd9,1', 0.3i]:
    cannot break line
    troff:<standard input>:6498: warning [p 27, 0.3i, div '3tbd10,0', 0.2i]: cannot break line
    <standard input>:6352: warning: table wider than line length minus
    indentation
    troff:<standard input>:8857: warning [p 32, 0.3i, div '3tbd1,1', 0.3i]:
    cannot break line


    To be fair, the online wiki does give the answer. Which raises the
    issue, again, of documentation standards. When important matters are
    absent from at least some key docs, then what? There's more to life than grubbing around on the net hoping to hit the right combination of keywords.

    Again, I asked chatgpt about this (hindsight is so good), and it came up
    with helpful information.
    --
    Mike Scott
    Harlow, England
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.linux.misc on Fri Aug 29 00:56:54 2025
    From Newsgroup: comp.os.linux.misc

    On Thu, 28 Aug 2025 09:40:34 +0100, Mike Scott wrote:

    To be fair, the online wiki does give the answer. Which raises the
    issue, again, of documentation standards. When important matters are
    absent from at least some key docs, then what?

    WerenrCOt you one of those complaining that bare reference material wasnrCOt enough? That you wanted tutorial examples and how-tos and all that? Then
    when I mention that it all that is available, you now find a new reason to complain?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From John Ames@commodorejohn@gmail.com to comp.os.linux.misc on Fri Aug 29 08:10:08 2025
    From Newsgroup: comp.os.linux.misc

    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:
    To be fair, the online wiki does give the answer. Which raises the
    issue, again, of documentation standards. When important matters are
    absent from at least some key docs, then what?

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and all
    that? Then when I mention that it all that is available, you now find
    a new reason to complain?
    Again, when important information for *core networking tools* is only
    found on the Web, it hardly takes a great sage to discern the problem.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mike Scott@usenet.16@scottsonline.org.uk.invalid to comp.os.linux.misc on Fri Aug 29 19:16:50 2025
    From Newsgroup: comp.os.linux.misc

    On 29/08/2025 16:10, John Ames wrote:
    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    To be fair, the online wiki does give the answer. Which raises the
    issue, again, of documentation standards. When important matters are
    absent from at least some key docs, then what?

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and all
    that? Then when I mention that it all that is available, you now find
    a new reason to complain?

    Again, when important information for *core networking tools* is only
    found on the Web, it hardly takes a great sage to discern the problem.


    The problem is that it is /not/ all available. I'm quite stumped about
    one particular issue for which there seem no references at all that I
    can find: and believe me, I have looked.

    Ironically, chatgpt has been a help. It makes so many errors that
    sorting them out has been quite educational.

    Oh - the problem in hand. No doubt it's easy when you know: single
    interface, allow all lan traffic, block wan inbound to port 22, redirect
    wan inbound on port 12345 to 22 and pass. Block wan inbound otherwise.
    If anyone has a config snippet to do this, I'd be very grateful.
    --
    Mike Scott
    Harlow, England
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.linux.misc on Sat Aug 30 06:34:18 2025
    From Newsgroup: comp.os.linux.misc

    On Fri, 29 Aug 2025 08:10:08 -0700, John Ames wrote:

    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and
    all that? Then when I mention that it all that is available, you
    now find a new reason to complain?

    Again, when important information for *core networking tools* is
    only found on the Web, it hardly takes a great sage to discern the
    problem.

    The problem is, you donrCOt understand the Web?

    Because *everything* is on the Web these days. If you canrCOt figure out
    basic Web searching, then perhaps you should stay away from computers altogether?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Nuno Silva@nunojsilva@invalid.invalid to comp.os.linux.misc on Sat Aug 30 08:39:21 2025
    From Newsgroup: comp.os.linux.misc

    On 2025-08-30, Lawrence DrCOOliveiro wrote:

    On Fri, 29 Aug 2025 08:10:08 -0700, John Ames wrote:

    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and
    all that? Then when I mention that it all that is available, you
    now find a new reason to complain?

    Again, when important information for *core networking tools* is
    only found on the Web, it hardly takes a great sage to discern the
    problem.

    The problem is, you donrCOt understand the Web?

    Because *everything* is on the Web these days. If you canrCOt figure out basic Web searching, then perhaps you should stay away from computers altogether?

    If there's no network connectivity, your web search skills won't do
    much?
    --
    Nuno Silva
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From The Natural Philosopher@tnp@invalid.invalid to comp.os.linux.misc on Sat Aug 30 08:45:44 2025
    From Newsgroup: comp.os.linux.misc

    On 30/08/2025 08:39, Nuno Silva wrote:
    On 2025-08-30, Lawrence DrCOOliveiro wrote:

    On Fri, 29 Aug 2025 08:10:08 -0700, John Ames wrote:

    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and
    all that? Then when I mention that it all that is available, you
    now find a new reason to complain?

    Again, when important information for *core networking tools* is
    only found on the Web, it hardly takes a great sage to discern the
    problem.

    The problem is, you donrCOt understand the Web?

    Because *everything* is on the Web these days. If you canrCOt figure out
    basic Web searching, then perhaps you should stay away from computers
    altogether?

    If there's no network connectivity, your web search skills won't do
    much?


    "If your internet connection is down, you can report in on our web page hereraA and get advice on what to do..."

    I quite like Linux Mint in that you get the whole basic distro. I am nor
    sure if they have a 'lite' edition that just boots enough to get
    internet connectivity.
    --
    rCLPeople believe certain stories because everyone important tells them,
    and people tell those stories because everyone important believes them. Indeed, when a conventional wisdom is at its fullest strength, onerCOs agreement with that conventional wisdom becomes almost a litmus test of onerCOs suitability to be taken seriously.rCY

    Paul Krugman

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harold Stevens@wookie@trixie.localdomain to comp.os.linux.misc on Sat Aug 30 05:37:26 2025
    From Newsgroup: comp.os.linux.misc

    In <108u9r9$2fqqv$1@dont-email.me> Nuno Silva:

    If there's no network connectivity, your web search skills won't do much?

    Classic Catch-22: To access the net, you need to ... access the net.

    Mr Ivory Tower here clearly never dirtied his hands with a workplace
    reality. It reads like Milo Minderbinder in the novel.
    --
    Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS *
    Pardon any bogus email addresses (wookie) in place for spambots.
    Really, it's (wyrd) at att, dotted with net. * DO NOT SPAM IT. *
    I toss (404) GoogleGroup (404 http://twovoyagers.com/improve-usenet.org/).
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Tauno Voipio@tauno.voipio@notused.fi.invalid to comp.os.linux.misc on Sat Aug 30 16:59:45 2025
    From Newsgroup: comp.os.linux.misc

    On 29.8.2025 21.16, Mike Scott wrote:
    On 29/08/2025 16:10, John Ames wrote:
    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    To be fair, the online wiki does give the answer. Which raises the
    issue, again, of documentation standards. When important matters are
    absent from at least some key docs, then what?

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and all
    that? Then when I mention that it all that is available, you now find
    a new reason to complain?

    Again, when important information for *core networking tools* is only
    found on the Web, it hardly takes a great sage to discern the problem.


    The problem is that it is /not/ all available. I'm quite stumped about
    one particular issue for which there seem no references at all that I
    can find: and believe me, I have looked.

    Ironically, chatgpt has been a help. It makes so many errors that
    sorting them out has been quite educational.

    Oh - the problem in hand. No doubt it's easy when you know: single interface, allow all lan traffic, block wan inbound to port 22, redirect
    wan inbound on port 12345 to 22 and pass. Block wan inbound otherwise.
    If anyone has a config snippet to do this, I'd be very grateful.



    Mike,

    The tool you need is called nftables, with a command line
    interface program called nft.

    Google for nftables documentation, read and understand it, the
    response is there with examples. It is difficult to provide a
    good snippet without your networking details.

    You could also configure the ssh daemon with a secondary port
    of 12345, just pass it, to avoid the port translation step.
    --

    -TV

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Richard Kettlewell@invalid@invalid.invalid to comp.os.linux.misc on Sat Aug 30 17:48:11 2025
    From Newsgroup: comp.os.linux.misc

    Nuno Silva <nunojsilva@invalid.invalid> writes:
    On 2025-08-30, Lawrence DrCOOliveiro wrote:
    On Fri, 29 Aug 2025 08:10:08 -0700, John Ames wrote:
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:
    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and
    all that? Then when I mention that it all that is available, you
    now find a new reason to complain?

    Again, when important information for *core networking tools* is
    only found on the Web, it hardly takes a great sage to discern the
    problem.

    The problem is, you donrCOt understand the Web?

    Because *everything* is on the Web these days. If you canrCOt figure
    out basic Web searching, then perhaps you should stay away from
    computers altogether?

    If there's no network connectivity, your web search skills won't do
    much?

    WasnrCOt this about nftables? You donrCOt need that to establish network connectivity.
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mike Scott@usenet.16@scottsonline.org.uk.invalid to comp.os.linux.misc on Sat Aug 30 18:45:38 2025
    From Newsgroup: comp.os.linux.misc

    On 30/08/2025 14:59, Tauno Voipio wrote:
    On 29.8.2025 21.16, Mike Scott wrote:
    On 29/08/2025 16:10, John Ames wrote:
    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    To be fair, the online wiki does give the answer. Which raises the
    issue, again, of documentation standards. When important matters are >>>>> absent from at least some key docs, then what?

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and all >>>> that? Then when I mention that it all that is available, you now find
    a new reason to complain?

    Again, when important information for *core networking tools* is only
    found on the Web, it hardly takes a great sage to discern the problem.


    The problem is that it is /not/ all available. I'm quite stumped about
    one particular issue for which there seem no references at all that I
    can find: and believe me, I have looked.

    Ironically, chatgpt has been a help. It makes so many errors that
    sorting them out has been quite educational.

    Oh - the problem in hand. No doubt it's easy when you know: single
    interface, allow all lan traffic, block wan inbound to port 22,
    redirect wan inbound on port 12345 to 22 and pass. Block wan inbound
    otherwise. If anyone has a config snippet to do this, I'd be very
    grateful.



    Mike,

    The tool you need is called nftables, with a command line
    interface program called nft.

    Google for nftables documentation, read and understand it, the
    response is there with examples. It is difficult to provide a
    good snippet without your networking details.

    You could also configure the ssh daemon with a secondary port
    of 12345, just pass it, to avoid the port translation step.


    We're going in circles here.... there's an issue with lack of decent
    docs (and examples) for nft - it seems that port blocking occurs after
    the redirection, with unhappy consequences, and I find no usable
    information suggesting any other possibility.

    I have running on freebsd, and am trying to move to linux, a server that ignores port 22 from the net at large, but accepts (similar to) 12345,
    just to provide an extra layer of obfuscation to wannabe attackers.

    It's a 2-line doddle on freebsd's pf firewall; I can't for the life of
    me work out the nftables equivalent, and begin to wonder if indeed it
    can be done.

    I suppose opening multiple ssh listener ports is another solution
    (thanks), but the original problem should - surely - be solvable: it
    also pops up for other services but which won't necessarily have the workaround.
    --
    Mike Scott
    Harlow, England
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.linux.misc on Sun Aug 31 03:25:25 2025
    From Newsgroup: comp.os.linux.misc

    On Fri, 29 Aug 2025 19:16:50 +0100, Mike Scott wrote:

    Oh - the problem in hand. No doubt it's easy when you know: single
    interface, allow all lan traffic, block wan inbound to port 22,
    redirect wan inbound on port 12345 to 22 and pass. Block wan inbound otherwise. If anyone has a config snippet to do this, I'd be very
    grateful.

    Look at the stages of application of filter hooks here <https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks>:
    there is rCLingressrCY, followed by rCLpreroutingrCY, followed by rCLinputrCY.

    The obvious place to block incoming packets for port 22 would be
    either rCLingressrCY or rCLpreroutingrCY; you should be able, at the same
    stage or a later one, to remap ones destined for port 12345 so they go
    to port 22, after the block.

    <https://wiki.nftables.org/wiki-nftables/index.php/Mangling_packet_headers>
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Tauno Voipio@tauno.voipio@notused.fi.invalid to comp.os.linux.misc on Sun Aug 31 21:24:57 2025
    From Newsgroup: comp.os.linux.misc

    On 30.8.2025 20.45, Mike Scott wrote:
    On 30/08/2025 14:59, Tauno Voipio wrote:
    On 29.8.2025 21.16, Mike Scott wrote:
    On 29/08/2025 16:10, John Ames wrote:
    On Fri, 29 Aug 2025 00:56:54 -0000 (UTC)
    Lawrence DrCOOliveiro <ldo@nz.invalid> wrote:

    To be fair, the online wiki does give the answer. Which raises the >>>>>> issue, again, of documentation standards. When important matters are >>>>>> absent from at least some key docs, then what?

    WerenrCOt you one of those complaining that bare reference material
    wasnrCOt enough? That you wanted tutorial examples and how-tos and all >>>>> that? Then when I mention that it all that is available, you now find >>>>> a new reason to complain?

    Again, when important information for *core networking tools* is only
    found on the Web, it hardly takes a great sage to discern the problem. >>>>

    The problem is that it is /not/ all available. I'm quite stumped
    about one particular issue for which there seem no references at all
    that I can find: and believe me, I have looked.

    Ironically, chatgpt has been a help. It makes so many errors that
    sorting them out has been quite educational.

    Oh - the problem in hand. No doubt it's easy when you know: single
    interface, allow all lan traffic, block wan inbound to port 22,
    redirect wan inbound on port 12345 to 22 and pass. Block wan inbound
    otherwise. If anyone has a config snippet to do this, I'd be very
    grateful.



    Mike,

    The tool you need is called nftables, with a command line
    interface program called nft.

    Google for nftables documentation, read and understand it, the
    response is there with examples. It is difficult to provide a
    good snippet without your networking details.

    You could also configure the ssh daemon with a secondary port
    of 12345, just pass it, to avoid the port translation step.


    We're going in circles here.... there's an issue with lack of decent
    docs (and examples) for nft - it seems that port blocking occurs after
    the redirection, with unhappy consequences, and I find no usable
    information suggesting any other possibility.

    I have running on freebsd, and am trying to move to linux, a server that ignores port 22 from the net at large, but accepts (similar to) 12345,
    just to provide an extra layer of obfuscation to wannabe attackers.

    It's a 2-line doddle on freebsd's pf firewall; I can't for the life of
    me work out the nftables equivalent, and begin to wonder if indeed it
    can be done.

    I suppose opening multiple ssh listener ports is another solution
    (thanks), but the original problem should - surely - be solvable: it
    also pops up for other services but which won't necessarily have the workaround.


    I'm writing this just on a network, where the Linux router is having
    a ruleset resembling what you ask for.

    Please look at <https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks>

    The nftables pages contain the information you need.

    You need to block the inbound TCP port 22 coming from the external
    interface. The correct place is in the ip nat table, PREROUTING chain.
    --

    -TV

    --- Synchronet 3.21a-Linux NewsLink 1.2