dbus-broker hardening, acpid fixes
This commit is contained in:
parent
d62b9c76d2
commit
e8e11182c2
6 changed files with 89 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{
|
||||||
networking = {
|
networking = {
|
||||||
nameservers = lib.mkForce [ "127.0.0.1" "::1" ];
|
nameservers = lib.mkForce [ "127.0.0.1" "::1" ];
|
||||||
|
|
|
@ -55,7 +55,7 @@ in
|
||||||
{
|
{
|
||||||
type = "regexp";
|
type = "regexp";
|
||||||
operand = "dest.port";
|
operand = "dest.port";
|
||||||
data = "53|443|4434|5443";
|
data = "53|443|4434|5443|4343";
|
||||||
}
|
}
|
||||||
# {
|
# {
|
||||||
# type = "lists";
|
# type = "lists";
|
||||||
|
|
|
@ -41,7 +41,7 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
services.pcscd.enable = true;
|
# services.pcscd.enable = true;
|
||||||
age.ageBin =
|
age.ageBin =
|
||||||
let
|
let
|
||||||
rage_wrapped = pkgs.symlinkJoin {
|
rage_wrapped = pkgs.symlinkJoin {
|
||||||
|
|
|
@ -6,7 +6,16 @@
|
||||||
""
|
""
|
||||||
];
|
];
|
||||||
NoNewPrivileges = true;
|
NoNewPrivileges = true;
|
||||||
RestrictNamespaces = "pid";
|
RestrictNamespaces = [
|
||||||
|
"~pid"
|
||||||
|
"~user"
|
||||||
|
"~net"
|
||||||
|
"~uts"
|
||||||
|
"~mnt"
|
||||||
|
"~cgroup"
|
||||||
|
"~ipc"
|
||||||
|
];
|
||||||
|
|
||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
ProtectKernelModules = true;
|
ProtectKernelModules = true;
|
||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
|
@ -15,12 +24,21 @@
|
||||||
SystemCallArchitectures = "native";
|
SystemCallArchitectures = "native";
|
||||||
SystemCallFilter = "@system-service";
|
SystemCallFilter = "@system-service";
|
||||||
LockPersonality = true;
|
LockPersonality = true;
|
||||||
ProtectSystem = true;
|
ProtectSystem = "strict";
|
||||||
PrivateUsers = true;
|
PrivateUsers = true;
|
||||||
PrivateNetwork = true;
|
|
||||||
RestrictRealtime = true;
|
RestrictRealtime = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
ProtectHome = true;
|
||||||
|
ProtectProc = "invisible";
|
||||||
|
ProtectKernelLogs = true;
|
||||||
IPAddressAllow = [ ];
|
IPAddressAllow = [ ];
|
||||||
RestrictAddressFamilies = "AF_NETLINK AF_UNIX";
|
|
||||||
|
PrivateDevices = false; # acpi obviously needs device access
|
||||||
|
PrivateNetwork = false; # required for netlink to work properly
|
||||||
|
RestrictAddressFamilies = [
|
||||||
|
"AF_NETLINK"
|
||||||
|
"AF_UNIX"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
62
hardening/systemd/dbus-broker.nix
Normal file
62
hardening/systemd/dbus-broker.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
config.systemd.services = lib.mkIf (config.specialisation != { }) {
|
||||||
|
dbus-broker.serviceConfig = {
|
||||||
|
DevicePolicy = "closed";
|
||||||
|
KeyringMode = "private";
|
||||||
|
LockPersonality = true;
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ProtectHome = "read-only";
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectProc = "invisible";
|
||||||
|
ProtectSystem = "full";
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
|
||||||
|
RestrictAddressFamilies = [
|
||||||
|
# "AF_INET"
|
||||||
|
# "AF_INET6"
|
||||||
|
"AF_UNIX"
|
||||||
|
];
|
||||||
|
RestrictNamespaces = [
|
||||||
|
"~pid"
|
||||||
|
"~user"
|
||||||
|
"~net"
|
||||||
|
"~uts"
|
||||||
|
"~mnt"
|
||||||
|
"~cgroup"
|
||||||
|
"~ipc"
|
||||||
|
];
|
||||||
|
SystemCallFilter = [
|
||||||
|
"@system-service"
|
||||||
|
"@privileged"
|
||||||
|
];
|
||||||
|
|
||||||
|
PrivateMounts = true;
|
||||||
|
|
||||||
|
# CapabilityBoundingSet = [
|
||||||
|
# "CAP_NET_BIND_SERVICE"
|
||||||
|
# "CAP_SETGID"
|
||||||
|
# "CAP_SETUID"
|
||||||
|
# "CAP_SYS_CHROOT"
|
||||||
|
# "cap_dac_override"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# PrivateUsers = false; # important
|
||||||
|
# PrivateNetwork = false; # important
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -21,10 +21,11 @@ in
|
||||||
./bluetooth.nix
|
./bluetooth.nix
|
||||||
# ./tty.nix
|
# ./tty.nix
|
||||||
./ask-password.nix
|
./ask-password.nix
|
||||||
# ./nix-daemon.nix
|
./nix-daemon.nix
|
||||||
./nscd.nix
|
./nscd.nix
|
||||||
./rtkit.nix
|
./rtkit.nix
|
||||||
./sshd.nix
|
./sshd.nix
|
||||||
|
./dbus-broker.nix
|
||||||
|
|
||||||
./global
|
./global
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue