]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
rules.pl: Move to ipset based data for LOCATIONBLOCK feature.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 14 Feb 2022 18:42:50 +0000 (19:42 +0100)
committerPeter Müller <peter.mueller@ipfire.org>
Tue, 15 Feb 2022 18:07:07 +0000 (18:07 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
config/firewall/rules.pl

index 5b1153b08a50e28c6c789266ada620c68a3f99af..e009c18380cb73d9417e2fb953587476e295734e 100644 (file)
@@ -671,7 +671,11 @@ sub locationblock {
        # is enabled.
        foreach my $location (@locations) {
                if(exists $locationsettings{$location} && $locationsettings{$location} eq "on") {
-                       run("$IPTABLES -A LOCATIONBLOCK -m geoip --src-cc $location -j DROP");
+                       # Call function to load the networks list for this country.
+                       &ipset_restore($location);
+
+                       # Call iptables and create rule to use the loaded ipset list.
+                       run("$IPTABLES -A LOCATIONBLOCK -m set --match-set CC_$location src -j DROP");
                }
        }
 }