From: Brice Waegeneire <brice@waegenei.re>
To: 49540@debbugs.gnu.org
Cc: iyzsong@member.fsf.org, solene@perso.pw
Subject: [bug#49540] [PATCH 1/2] services: nftables: Only manage delete our own table.
Date: Mon, 12 Jul 2021 23:08:22 +0200 [thread overview]
Message-ID: <20210712210823.16987-1-brice@waegenei.re> (raw)
In-Reply-To: <20210712210543.16598-1-brice@waegenei.re>
* gnu/services/networking.scm (%default-nftables-ruleset): Rename table
from "forward" to "guix". Clear table before applying before setting
it up.
(nftables-shepherd-service): Don't flush all the table, just delete our
own.
---
gnu/services/networking.scm | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 1ae58041d3..3058c14caf 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -13,7 +13,7 @@
;;; Copyright © 2019, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2019 Sou Bunnbu <iyzsong@member.fsf.org>
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
-;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2021 Christopher Lemmer Webber <cwebber@dustycloud.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
@@ -1717,7 +1717,12 @@ COMMIT
(define %default-nftables-ruleset
(plain-file "nftables.conf"
"# A simple and safe firewall
-table inet filter {
+
+# Start with our table clean of previous state
+add table inet guix
+delete table inet guix
+
+table inet guix {
chain input {
type filter hook input priority 0; policy drop;
@@ -1768,7 +1773,7 @@ table inet filter {
(start #~(lambda _
(invoke #$nft "--file" #$ruleset)))
(stop #~(lambda _
- (invoke #$nft "flush" "ruleset"))))))))
+ (invoke #$nft "delete" "table" "inet" "guix"))))))))
(define nftables-service-type
(service-type
--
2.31.1
next prev parent reply other threads:[~2021-07-12 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-12 21:05 [bug#49540] [PATCH 0/2] services: nftables: Make it extandable Brice Waegeneire
2021-07-12 21:08 ` Brice Waegeneire [this message]
2021-07-12 21:08 ` [bug#49540] [PATCH 2/2] services: nftables: Make it extendable Brice Waegeneire
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210712210823.16987-1-brice@waegenei.re \
--to=brice@waegenei.re \
--cc=49540@debbugs.gnu.org \
--cc=iyzsong@member.fsf.org \
--cc=solene@perso.pw \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).