update security options
This commit is contained in:
parent
742bc9c1df
commit
f0069d03cc
1 changed files with 28 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
nix.allowedUsers = [ "@users" ];
|
nix.allowedUsers = [ "@users" ];
|
||||||
security.lockKernelModules = false;
|
security.lockKernelModules = false;
|
||||||
|
@ -6,16 +6,21 @@
|
||||||
security.forcePageTableIsolation = true;
|
security.forcePageTableIsolation = true;
|
||||||
security.virtualisation.flushL1DataCache = "always";
|
security.virtualisation.flushL1DataCache = "always";
|
||||||
security.apparmor.enable = true;
|
security.apparmor.enable = true;
|
||||||
|
security.apparmor.killUnconfinedConfinables = true;
|
||||||
services.haveged.enable = true;
|
services.haveged.enable = true;
|
||||||
networking.firewall.enable = true;
|
networking.firewall.enable = true;
|
||||||
services.clamav.daemon.enable = true;
|
services.clamav.daemon.enable = true;
|
||||||
services.clamav.updater.enable = true;
|
services.clamav.updater.enable = true;
|
||||||
security.chromiumSuidSandbox.enable = true;
|
security.chromiumSuidSandbox.enable = true;
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
|
"slub_debug=FZP"
|
||||||
"page_poison=1"
|
"page_poison=1"
|
||||||
"page_alloc.shuffle=1"
|
"page_alloc.shuffle=1"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
environment.memoryAllocator.provider = "scudo";
|
||||||
|
environment.variables.SCUDO_OPTIONS = "ZeroContents=1";
|
||||||
|
|
||||||
boot.blacklistedKernelModules = [
|
boot.blacklistedKernelModules = [
|
||||||
# Obscure network protocols
|
# Obscure network protocols
|
||||||
"ax25"
|
"ax25"
|
||||||
|
@ -38,25 +43,47 @@
|
||||||
"jfs"
|
"jfs"
|
||||||
"minix"
|
"minix"
|
||||||
"nilfs2"
|
"nilfs2"
|
||||||
|
"omfs"
|
||||||
"qnx4"
|
"qnx4"
|
||||||
"qnx6"
|
"qnx6"
|
||||||
"sysv"
|
"sysv"
|
||||||
"ufs"
|
"ufs"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Restrict ptrace() usage to processes with a pre-defined relationship
|
||||||
|
# (e.g., parent/child)
|
||||||
|
boot.kernel.sysctl."kernel.yama.ptrace_scope" = lib.mkOverride 500 1;
|
||||||
|
|
||||||
|
# Hide kptrs even for processes with CAP_SYSLOG
|
||||||
|
boot.kernel.sysctl."kernel.kptr_restrict" = lib.mkOverride 500 2;
|
||||||
|
|
||||||
|
# Disable bpf() JIT (to eliminate spray attacks)
|
||||||
boot.kernel.sysctl."net.core.bpf_jit_enable" = false;
|
boot.kernel.sysctl."net.core.bpf_jit_enable" = false;
|
||||||
|
|
||||||
|
# Disable ftrace debugging
|
||||||
boot.kernel.sysctl."kernel.ftrace_enabled" = false;
|
boot.kernel.sysctl."kernel.ftrace_enabled" = false;
|
||||||
|
|
||||||
|
# Enable strict reverse path filtering (that is, do not attempt to route
|
||||||
|
# packets that "obviously" do not belong to the iface's network; dropped
|
||||||
|
# packets are logged as martians).
|
||||||
boot.kernel.sysctl."net.ipv4.conf.all.log_martians" = true;
|
boot.kernel.sysctl."net.ipv4.conf.all.log_martians" = true;
|
||||||
boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" = "1";
|
boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" = "1";
|
||||||
boot.kernel.sysctl."net.ipv4.conf.default.log_martians" = true;
|
boot.kernel.sysctl."net.ipv4.conf.default.log_martians" = true;
|
||||||
boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" = "1";
|
boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" = "1";
|
||||||
|
|
||||||
|
# Ignore broadcast ICMP (mitigate SMURF)
|
||||||
boot.kernel.sysctl."net.ipv4.icmp_echo_ignore_broadcasts" = true;
|
boot.kernel.sysctl."net.ipv4.icmp_echo_ignore_broadcasts" = true;
|
||||||
|
|
||||||
|
# Ignore incoming ICMP redirects (note: default is needed to ensure that the
|
||||||
|
# setting is applied to interfaces added after the sysctls are set)
|
||||||
boot.kernel.sysctl."net.ipv4.conf.all.accept_redirects" = false;
|
boot.kernel.sysctl."net.ipv4.conf.all.accept_redirects" = false;
|
||||||
boot.kernel.sysctl."net.ipv4.conf.all.secure_redirects" = false;
|
boot.kernel.sysctl."net.ipv4.conf.all.secure_redirects" = false;
|
||||||
boot.kernel.sysctl."net.ipv4.conf.default.accept_redirects" = false;
|
boot.kernel.sysctl."net.ipv4.conf.default.accept_redirects" = false;
|
||||||
boot.kernel.sysctl."net.ipv4.conf.default.secure_redirects" = false;
|
boot.kernel.sysctl."net.ipv4.conf.default.secure_redirects" = false;
|
||||||
boot.kernel.sysctl."net.ipv6.conf.all.accept_redirects" = false;
|
boot.kernel.sysctl."net.ipv6.conf.all.accept_redirects" = false;
|
||||||
boot.kernel.sysctl."net.ipv6.conf.default.accept_redirects" = false;
|
boot.kernel.sysctl."net.ipv6.conf.default.accept_redirects" = false;
|
||||||
|
|
||||||
|
# Ignore outgoing ICMP redirects (this is ipv4 only)
|
||||||
boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = false;
|
boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = false;
|
||||||
boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = false;
|
boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue