public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH 04/12] rules.pl: Destroy all ipset lists on rule reload.
Date: Thu, 17 Feb 2022 05:56:42 +0100	[thread overview]
Message-ID: <8dbf6929eee4887265035c8177012f908c8a7e86.camel@ipfire.org> (raw)
In-Reply-To: <56E22B21-4AF6-4FD9-BFAD-B4098B4BE646@ipfire.org>

[-- Attachment #1: Type: text/plain, Size: 3193 bytes --]

Hello Michael, Hello Tim,

thanks for your feedback and discussion.
> Hello Tim,
> 
> > On 15 Feb 2022, at 19:28, Tim FitzGeorge <ipfr(a)tfitzgeorge.me.uk>
> > wrote:
> > 
> > Hello,
> > 
> > I'm concerned about this as well.  Depending on when it does the
> > ipset destroy it may be OK (for example as part of shutting down
> > the system or prior to rebuilding the firewall from scratch, as in
> > these cases it either won't matter or the OP blocklist ipsets will
> > be reloaded), but in general I would consider it a bad idea to
> > delete all the ipsets whether or not you 'own' them - each
> > 'package' should only touch it's own 'property', while this just
> > deletes all the ipsets regardless.
> 
> This is quite hard to implement though. We could in theory iterate
> over all possible country codes and try to delete all sets, but that
> seems to be a very slow and not elegant solution to the problem.
> 
> > Having said that, I think it will probably be alright as according
> > to the documentation ipset destroy won't delete lists which have
> > references to them, and the IP blocklist ipsets should always have
> > references.
> 
> This is good for us though. If we can consider the “destroy” command
> to be more of a cleanup and it is safe to call it, then we should not
> run into any trouble here.
> 
> @Stefan: Can you confirm that any sets that are still referenced
> elsewhere won’t be destroyed and that there is no ugly output that
> could alarm anyone?

I did not have a look at Tim's code at the moment, nor some testing of
his feature so I'm unable to say yes or no, for both of your questions.

I'll dig into this at the weekend and phone back what I got.

-Stefan

> 
> -Michael
> 
> > 
> > Tim
> > 
> > On 15/02/2022 12:41, Michael Tremer wrote:
> > > Hello,
> > > 
> > > Looking at the other patchset that implements IP blocklists,
> > > could this interfere with this in any way?
> > > 
> > > -Michael
> > > 
> > > > On 14 Feb 2022, at 18:42, Stefan Schantl <
> > > > stefan.schantl(a)ipfire.org> wrote:
> > > > 
> > > > Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
> > > > ---
> > > > config/firewall/rules.pl | 4 ++++
> > > > 1 file changed, 4 insertions(+)
> > > > 
> > > > diff --git a/config/firewall/rules.pl
> > > > b/config/firewall/rules.pl
> > > > index f685d08a7..da01b8775 100644
> > > > --- a/config/firewall/rules.pl
> > > > +++ b/config/firewall/rules.pl
> > > > @@ -31,6 +31,7 @@ require "${General::swroot}/location-
> > > > functions.pl";
> > > > my $DEBUG = 0;
> > > > 
> > > > my $IPTABLES = "iptables --wait";
> > > > +my $IPSET = "ipset";
> > > > 
> > > > # iptables chains
> > > > my $CHAIN_INPUT           = "INPUTFW";
> > > > @@ -114,6 +115,9 @@ sub main {
> > > >         # Flush all chains.
> > > >         &flush();
> > > > 
> > > > +       # Destroy all existing ipsets.
> > > > +       run("$IPSET destroy");
> > > > +
> > > >         # Prepare firewall rules.
> > > >         if (! -z  "${General::swroot}/firewall/input"){
> > > >                 &buildrules(\%configinputfw);
> > > > -- 
> > > > 2.30.2
> > > > 
> > > 
> > 
> 



  reply	other threads:[~2022-02-17  4:56 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 18:42 [PATCH 01/12] location-functions.pl: Rename and set the location for exported databases to "/var/lib/location/ipset/" Stefan Schantl
2022-02-14 18:42 ` [PATCH 02/12] location-functions.pl: Remove ending backslash from location_dir variable Stefan Schantl
2022-02-14 21:01   ` Peter Müller
2022-02-14 18:42 ` [PATCH 03/12] rules.pl: Move flush of LOCATIONBLOCK into main flush() function Stefan Schantl
2022-02-14 21:02   ` Peter Müller
2022-02-15 12:42   ` Michael Tremer
2022-02-14 18:42 ` [PATCH 04/12] rules.pl: Destroy all ipset lists on rule reload Stefan Schantl
2022-02-14 21:02   ` Peter Müller
2022-02-15 12:41   ` Michael Tremer
2022-02-15 19:28     ` Tim FitzGeorge
2022-02-16 10:45       ` Michael Tremer
2022-02-17  4:56         ` Stefan Schantl [this message]
2022-02-27 14:28           ` Stefan Schantl
2022-02-14 18:42 ` [PATCH 05/12] rules.pl: Add tiny ipset_restore function Stefan Schantl
2022-02-14 21:03   ` Peter Müller
2022-02-15 12:41   ` Michael Tremer
2022-02-14 18:42 ` [PATCH 06/12] rules.pl: Move to ipset based data for LOCATIONBLOCK feature Stefan Schantl
2022-02-14 21:03   ` Peter Müller
2022-02-15 12:40   ` Michael Tremer
2022-02-14 18:42 ` [PATCH 07/12] rules.pl: Move to ipset based data for location based firewall rules Stefan Schantl
2022-02-14 21:05   ` Peter Müller
2022-02-15 12:40   ` Michael Tremer
2022-02-14 18:42 ` [PATCH 08/12] update-location-database: Export database to ipset compatible format now Stefan Schantl
2022-02-14 21:05   ` Peter Müller
2022-02-15 12:39   ` Michael Tremer
2022-02-14 18:42 ` [PATCH 09/12] rules.pl: Do not try to restore the same ipset multiple times Stefan Schantl
2022-02-14 21:05   ` Peter Müller
2022-02-15 12:39   ` Michael Tremer
2022-02-17  5:35     ` Stefan Schantl
2022-02-17  5:40       ` [PATCH] rules.pl: Adjust check against loading the same lists " Stefan Schantl
2022-02-17 19:25         ` Peter Müller
2022-02-14 18:42 ` [PATCH 10/12] rules.pl: Check if an ipset db file exists before call to restore it Stefan Schantl
2022-02-14 21:06   ` Peter Müller
2022-02-15 12:38     ` Michael Tremer
2022-02-14 18:42 ` [PATCH 11/12] rules.pl: Add workaround to hide a warning about an only once used variable Stefan Schantl
2022-02-14 21:07   ` Peter Müller
2022-02-15 12:37   ` Michael Tremer
2022-02-14 18:42 ` [PATCH 12/12] libloc: Export DB in ipset compatible format Stefan Schantl
2022-02-14 21:06   ` Peter Müller
2022-02-15 12:37     ` Michael Tremer
2022-02-14 21:01 ` [PATCH 01/12] location-functions.pl: Rename and set the location for exported databases to "/var/lib/location/ipset/" Peter Müller

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=8dbf6929eee4887265035c8177012f908c8a7e86.camel@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.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