public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Calum Mackay <calum.mackay@oracle.com>
To: linux-nfs@trodman.com, linux-nfs@vger.kernel.org
Cc: Calum Mackay <calum.mackay@oracle.com>
Subject: Re: recipe/example | nftables for Internet nfs4? << iif enp1s0 tcp dport 2049 counter accept comment "allow nfs"
Date: Thu, 25 Jul 2024 00:59:10 +0100	[thread overview]
Message-ID: <edbee688-d4b2-42c7-9a81-ebdf5a017fa7@oracle.com> (raw)
In-Reply-To: <202407241617.46OGHVKY064027@epjdn.zq3q.org>



On 24/07/2024 5:17 pm, linux-nfs@trodman.com wrote:
> On Tue 7/23/24 22:28 +0100 Calum Mackay wrote:
>> On 23/07/2024 8:53 pm, linux-nfs@trodman.com wrote:
>>> I have a fedora server on Internet sharing out NFS; working ok for 3+years w/firewalld.  I'm going w/pure nftables on a new server. Does anyone have a recipe/example for setting up an NFS server using nftables?
>>
>> I'm still stuck on iptables, but I imagine it ought to be something
>> simple like adding this to your NFSv4 server's inbound chain:
>>
>> 	tcp dport 2049 accept
>>
>> assuming you have a default accept policy on your outbound chain.
>>
>> That's just for NFSv4 over TCP, of course. And you might want to add ct
>> connection tracking state, etc.
> 
> Thank you Calum.
> 
> As you suggested, I added:
> 
> iif enp1s0 tcp dport 2049               counter accept comment "allow nfs"
> 
> I then tried mount -v ... and it got farther but failed
> 
>      mount.nfs4: mount(2): Permission denied
> 
> Then I restarted nftables.service, It worked!

That's great, Tom; thanks for letting me know, and for the detail below.

One point: you should be able to change the numeric port "2049" to the 
service "{nfs}", to make it more in line with your other services, if 
you prefer.

best wishes,
calum.

> 
> --
> thanks!
> Tom
> 
> --8<---------------cut here---------------start------------->8---
> # cat /etc/sysconfig/nftables.conf |_rmcm ## comments stripped. enp1s0 faces Internet
> flush ruleset
> table inet filter {
>      chain input {
>          type filter hook input priority 0;
>          iif enp1s0 tcp dport {ssh}              counter accept comment "allow ssh"
>          iif enp1s0 tcp dport {http, https}      counter accept comment "allow http, https"
>          iif enp1s0 tcp dport 2049               counter accept comment "allow nfs"
>          iif enp1s0 tcp dport {smtp}             counter accept comment "smtp"
>          iif enp1s0 ct state {established, related} counter accept comment "allow established Internet packets"
>          iif enp1s0 counter drop comment "dropped Internet packets"
>          iif enp2s0 accept comment "allow local packets"
>      }
>      chain forward {
>          type filter hook forward priority 0;
>          iif enp1s0 oif enp2s0 ct state {established, related} counter accept comment "allow Internet est/relat"
>          iif enp2s0 oif enp1s0 counter accept comment "allow lan to Internet"
>          iif enp1s0 drop
>      }
>      chain output {
>          type filter hook output priority 0;
>      }
> }
> table nat {
>      chain output {
>          type nat hook output priority -100;
>      }
>      chain prerouting {
>          type nat hook prerouting priority -100;
>      }
>      chain postrouting {
>          type nat hook postrouting priority 100;
>          ip saddr 10.164.123.0/24  oif enp1s0 counter snat MY_SERVERS_INTERNET_IP comment "snat/static ip"
>      }
> }
> 

-- 
Calum Mackay
Linux Kernel Engineering
Oracle Linux and Virtualisation


      reply	other threads:[~2024-07-24 23:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23 19:53 recipe/example for nftables supporting Internet nfs4? linux-nfs
2024-07-23 21:28 ` Calum Mackay
2024-07-24 16:17   ` recipe/example | nftables for Internet nfs4? << iif enp1s0 tcp dport 2049 counter accept comment "allow nfs" linux-nfs
2024-07-24 23:59     ` Calum Mackay [this message]

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=edbee688-d4b2-42c7-9a81-ebdf5a017fa7@oracle.com \
    --to=calum.mackay@oracle.com \
    --cc=linux-nfs@trodman.com \
    --cc=linux-nfs@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