mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Hardening] remove broken and obsolete dbus hardening
This commit is contained in:
parent
f3ccaff561
commit
87ab357291
1 changed files with 4 additions and 37 deletions
|
|
@ -28,20 +28,13 @@ in
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
|
||||||
dbus = mkOption rec {
|
|
||||||
default = cfg.hardcore;
|
|
||||||
example = !default;
|
|
||||||
description = "Enable dbus service hardening";
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule [ "aviallon" "hardening" "services" "dbus" ] "dbus should use AppArmor hardening instead")
|
||||||
|
];
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# imports = [
|
|
||||||
# (modulesPath + "/profiles/hardened.nix")
|
|
||||||
# ];
|
|
||||||
aviallon.boot.kernel.package = mkIf cfg.hardcore pkgs.linuxKernel.kernels.linux_hardened;
|
aviallon.boot.kernel.package = mkIf cfg.hardcore pkgs.linuxKernel.kernels.linux_hardened;
|
||||||
security.lockKernelModules = mkIf cfg.hardcore (mkQuasiForce true);
|
security.lockKernelModules = mkIf cfg.hardcore (mkQuasiForce true);
|
||||||
# security.protectKernelImage = mkIf cfg.hardcore (mkOverride 500 false); # needed for kexec
|
# security.protectKernelImage = mkIf cfg.hardcore (mkOverride 500 false); # needed for kexec
|
||||||
|
|
@ -112,31 +105,5 @@ in
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
sbctl # Secure Boot keys generation
|
sbctl # Secure Boot keys generation
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.dbus.serviceConfig = mkIf cfg.services.dbus {
|
|
||||||
# Hardening
|
|
||||||
CapabilityBoundingSet = [ "CAP_SETGID" "CAP_SETUID" "CAP_SETPCAP" "CAP_SYS_RESOURCE" "CAP_AUDIT_WRITE" ];
|
|
||||||
DeviceAllow = [ "/dev/null rw" "/dev/urandom r" ];
|
|
||||||
DevicePolicy = "strict";
|
|
||||||
IPAddressDeny = "any";
|
|
||||||
LimitMEMLOCK = 0;
|
|
||||||
LockPersonality = true;
|
|
||||||
MemoryDenyWriteExecute = true;
|
|
||||||
NoNewPrivileges = true;
|
|
||||||
PrivateDevices = true;
|
|
||||||
PrivateTmp = true;
|
|
||||||
ProtectControlGroups = true;
|
|
||||||
ProtectHome = true;
|
|
||||||
ProtectKernelModules = true;
|
|
||||||
ProtectKernelTunables = true;
|
|
||||||
ProtectSystem = "strict";
|
|
||||||
ReadOnlyPaths = [ "-/" ];
|
|
||||||
RestrictAddressFamilies = [ "AF_UNIX" ];
|
|
||||||
RestrictNamespaces = true;
|
|
||||||
RestrictRealtime = true;
|
|
||||||
SystemCallArchitectures = "native";
|
|
||||||
SystemCallFilter = [ "@system-service" "~@chown" "~@clock" "~@cpu-emulation" "~@debug" "~@module" "~@mount" "~@obsolete" "~@raw-io" "~@reboot" "~@resources" "~@swap" "~memfd_create" "~mincore" "~mlock" "~mlockall" "~personality" ];
|
|
||||||
UMask = "0077";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue