Skip to content

Commit

Permalink
nixos/firewall: clean up rpfilter rules properly
Browse files Browse the repository at this point in the history
The rpfilter rules wouldn't be removed if it was previously enabled
but disabled in a new generation.
  • Loading branch information
fpletz committed May 29, 2017
1 parent fde29b2 commit a49c236
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions nixos/modules/services/networking/firewall.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ let
# The "nixos-fw" chain does the actual work.
ip46tables -N nixos-fw
# Perform a reverse-path test to refuse spoofers
# For now, we just drop, as the raw table doesn't have a log-refuse yet
# Clean up rpfilter rules
ip46tables -t raw -D PREROUTING -j nixos-fw-rpfilter 2> /dev/null || true
ip46tables -t raw -F nixos-fw-rpfilter 2> /dev/null || true
ip46tables -t raw -X nixos-fw-rpfilter 2> /dev/null || true
${optionalString (kernelHasRPFilter && (cfg.checkReversePath != false)) ''
# Clean up rpfilter rules
ip46tables -t raw -D PREROUTING -j nixos-fw-rpfilter 2> /dev/null || true
ip46tables -t raw -F nixos-fw-rpfilter 2> /dev/null || true
# Perform a reverse-path test to refuse spoofers
# For now, we just drop, as the raw table doesn't have a log-refuse yet
ip46tables -t raw -N nixos-fw-rpfilter 2> /dev/null || true
ip46tables -t raw -A nixos-fw-rpfilter -m rpfilter ${optionalString (cfg.checkReversePath == "loose") "--loose"} -j RETURN
# Allows this host to act as a DHCPv4 server
Expand Down

0 comments on commit a49c236

Please sign in to comment.