add geoblocking to PC openssh server config

This commit is contained in:
greyweather committed 2026-07-25 20:28:10 +01:00
1 parent f343db1757
commit 76973b5243
6 files changed
+12 -13

No files matched your search

+1 -2
View File
@@ -22,8 +22,7 @@
};
networking.firewall.extraCommands = ''
iptables -D INPUT -p tcp --dport 22 -m set ! --match-set geo-whitelist src -j DROP
${pkgs.ipset}/bin/ipset destroy geo-whitelist
if [ "$(iptables -S INPUT)" != "-P INPUT ACCEPT" ]; then iptables -D INPUT -p tcp --dport 22 -m set ! --match-set geo-whitelist src -j DROP; ${pkgs.ipset}/bin/ipset destroy geo-whitelist; fi
${pkgs.ipset}/bin/ipset restore -file /home/grey/nixos/assets/geo-whitelist.ipset
iptables -I INPUT -p tcp --dport 22 -m set ! --match-set geo-whitelist src -j DROP
'';