netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kerin Millar" <kfm@plushkava.net>
To: "Telbat Diordna" <diordnatelbat2@gmail.com>, netfilter@vger.kernel.org
Subject: Re: filesystem access to add/remove/view ip addresses
Date: Fri, 18 Oct 2024 22:39:20 +0100	[thread overview]
Message-ID: <4916d96d-7fd3-4576-b574-b033be66c196@app.fastmail.com> (raw)
In-Reply-To: <CA+OqyoGkVcvgVYPBMc6v-JeRwncoJz1OyECma2-megULkvQ0xw@mail.gmail.com>

On Fri, 18 Oct 2024, at 8:30 PM, Telbat Diordna wrote:
> In iptables there exists the recent module (-m recent). This gives you
> the possibility to add and remove ip addresses in rulesets (usually
> blocklists).  The advantage of this method is, that you can allow
> access via FACLs to ordinary users for selected configuration items.
> E.g.:
> echo +/- <ip> > /proc/net/xt_recent/<iptname>
>
> Looks like, that in nftables there is no recent module. How can I use
> nftables in a similar way?
>
> Thanks for any information/link etc.

That's an interesting use case (that of defining FACLs).

To manipulate an nftables ruleset requires the CAP_NET_ADMIN capability. The only thing that I can think of is to write a program that would compose and dispatch the necessary set-manipulating commands through nft(8) or netlink(7), while exposing a simple command-line interface to its users. The binary could be granted the CAP_NET_ADMIN capability with the setcap(8) utility and either:

a) be limited to the relevant users and/or groups with chmod and chown
b) perform its own user and/or group membership checks upon execution

Unfortunately, this technique cannot be applied for executable scripts (BINFMT_SCRIPT), so the binary would need to be an ELF.

-- 
Kerin Millar

  reply	other threads:[~2024-10-18 21:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 19:30 filesystem access to add/remove/view ip addresses Telbat Diordna
2024-10-18 21:39 ` Kerin Millar [this message]
     [not found]   ` <CA+OqyoGJhT75-FBdO1mLxaLpHpWck6wPe8hTwRLCmKWq6b679g@mail.gmail.com>
2024-10-19 19:35     ` Kerin Millar
2024-10-19 20:46       ` 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=4916d96d-7fd3-4576-b574-b033be66c196@app.fastmail.com \
    --to=kfm@plushkava.net \
    --cc=diordnatelbat2@gmail.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;
as well as URLs for NNTP newsgroup(s).