Skip to content

Commit e023674

Browse files
committed
feat: make firewall allow rules ipv4 only, add only basic ipv6 rules
Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com>
1 parent 165ce13 commit e023674

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

System/Lenovo-Laptop/Services/networking.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,33 @@
22
{
33
# Don't wait for online.
44
systemd.services.NetworkManager-wait-online.enable = false;
5+
boot.initrd.systemd.network.wait-online.enable = false;
6+
systemd.network.wait-online.enable = false;
57

68
networking = {
79
firewall = config.hm-config.firewall // {
810
enable = true;
11+
extraCommands = ''
12+
# Delete the accept rule for nixos-fw-accept
13+
ip6tables -D nixos-fw-accept -j ACCEPT
14+
15+
# Delete critical rules that redirect to nixos-fw-accept
16+
ip6tables -D nixos-fw -i lo -j nixos-fw-accept
17+
ip6tables -D nixos-fw -m conntrack --ctstate RELATED,ESTABLISHED -j nixos-fw-accept
18+
ip6tables -D nixos-fw -p ipv6-icmp -j nixos-fw-accept
19+
ip6tables -D nixos-fw -d fe80::/64 -p udp --dport 546 -j nixos-fw-accept
20+
ip6tables -D nixos-fw -i podman0 -p udp --dport 53 -j nixos-fw-accept
21+
22+
# Add the critical rules back, with ACCEPT
23+
ip6tables -A nixos-fw -i lo -j ACCEPT
24+
ip6tables -A nixos-fw -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
25+
ip6tables -A nixos-fw -p ipv6-icmp -j ACCEPT
26+
ip6tables -A nixos-fw -d fe80::/64 -p udp --dport 546 -j ACCEPT
27+
ip6tables -A nixos-fw -i podman0 -p udp --dport 53 -j ACCEPT
28+
29+
# Set DROP rule for nixos-fw-accept
30+
ip6tables -A nixos-fw-accept -j nixos-fw-log-refuse
31+
'';
932
};
1033
hostName = "lenovo-laptop";
1134
networkmanager.connectionConfig = {

0 commit comments

Comments
 (0)