feat(security): restrict AdGuard Home to Tailscale network

- Add internalOnly to AdGuard nginx config
- Add ts-input firewall rule for direct Tailscale access
- Update Netdata to use ts-input chain for consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ashisgreat22 2026-03-21 20:25:22 +00:00
parent 6b64254eab
commit aa18a6f494

View file

@ -179,6 +179,7 @@ in
networking.firewall.extraCommands = '' networking.firewall.extraCommands = ''
iptables -t nat -A PREROUTING -i tailscale0 -p udp --dport 53 -j REDIRECT --to-ports 5353 iptables -t nat -A PREROUTING -i tailscale0 -p udp --dport 53 -j REDIRECT --to-ports 5353
iptables -t nat -A PREROUTING -i tailscale0 -p tcp --dport 53 -j REDIRECT --to-ports 5353 iptables -t nat -A PREROUTING -i tailscale0 -p tcp --dport 53 -j REDIRECT --to-ports 5353
iptables -I ts-input 3 -p tcp --dport ${toString cfg.port} -s 100.64.0.0/10 -j ACCEPT
''; '';
networking.firewall.extraStopCommands = '' networking.firewall.extraStopCommands = ''
iptables -t nat -D PREROUTING -i tailscale0 -p udp --dport 53 -j REDIRECT --to-ports 5353 || true iptables -t nat -D PREROUTING -i tailscale0 -p udp --dport 53 -j REDIRECT --to-ports 5353 || true
@ -192,11 +193,6 @@ in
contentSecurityPolicy = null; # AdGuard Home handles its own CSP contentSecurityPolicy = null; # AdGuard Home handles its own CSP
}; };
# Allow direct Tailscale access to AdGuard Home dashboard
networking.firewall.extraCommands = lib.mkAfter ''
iptables -I ts-input 3 -p tcp --dport ${toString cfg.port} -s 100.64.0.0/10 -j ACCEPT
'';
# Ensure nginx user can access ACME certs # Ensure nginx user can access ACME certs
users.users.nginx.extraGroups = [ "acme" ]; users.users.nginx.extraGroups = [ "acme" ];
}; };