tsuki/atuin: systemd harden

This commit is contained in:
Oystein Kristoffer Tveit 2023-07-28 22:25:50 +02:00
parent dec150ae98
commit 6663a8f280
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 38 additions and 0 deletions

View File

@ -4,4 +4,42 @@
enable = true; enable = true;
openRegistration = false; openRegistration = false;
}; };
systemd.services.atuin = {
requires = [ "postgresql.service" ];
serviceConfig = {
# Hardening
CapabilityBoundingSet = "";
LockPersonality = true;
NoNewPrivileges = true;
PrivateDevices = true;
PrivateMounts = true;
PrivateTmp = true;
PrivateUsers = true;
ProcSubset = "pid";
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProtectSystem = "full";
RemoveIPC = true;
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
# Required for connecting to database sockets,
# and listening to unix socket at `cfg.settings.path`
"AF_UNIX"
];
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @reboot @setuid @swap @privileged";
UMask = "0007";
};
};
} }