/ nixosModules / kernel-hardening.nix
kernel-hardening.nix
1 { 2 boot.kernel.sysctl = { 3 "net.ipv4.conf.all.rp_filter" = 1; 4 "net.ipv4.conf.default.rp_filter" = 1; 5 "net.ipv4.conf.all.accept_source_route" = 0; 6 "net.ipv4.conf.default.accept_source_route" = 0; 7 "net.ipv4.conf.all.accept_redirects" = 0; 8 "net.ipv4.conf.default.accept_redirects" = 0; 9 "net.ipv4.conf.all.secure_redirects" = 0; 10 "net.ipv4.conf.default.secure_redirects" = 0; 11 "net.ipv4.icmp_echo_ignore_broadcasts" = 1; 12 "net.ipv4.icmp_ignore_bogus_error_responses" = 1; 13 "net.ipv4.conf.all.send_redirects" = 0; 14 "net.ipv4.conf.default.send_redirects" = 0; 15 "net.ipv6.conf.all.accept_redirects" = 0; 16 "net.ipv6.conf.default.accept_redirects" = 0; 17 "kernel.sysrq" = 0; 18 "kernel.core_uses_pid" = 1; 19 }; 20 }