improve getty coverage

This commit is contained in:
Grimmauld 2025-01-11 14:41:03 +01:00
parent 8e5f867252
commit dbbe60d0d2
No known key found for this signature in database
5 changed files with 54 additions and 9 deletions

View file

@ -46,8 +46,10 @@ in
networking.nftables.enable = true;
# security.audit.enable = true;
systemd.services.opensnitchd.path = lib.optional (config.services.opensnitch.settings.ProcMonitorMethod == "audit") pkgs.audit.bin;
systemd.services.opensnitchd.path = lib.optional (
config.services.opensnitch.settings.ProcMonitorMethod == "audit"
) pkgs.audit.bin;
services.opensnitch = {
enable = true;
settings = {

View file

@ -2,5 +2,6 @@
imports = [
./hostname.nix
./clock.nix
./realtime.nix
];
}

View file

@ -0,0 +1,27 @@
{ lib, config, ... }:
let
inherit (lib) mkDefault types mkIf;
in
{
options.systemd.services = lib.mkOption {
type =
let
osConfig = config;
in
types.attrsOf (
lib.types.submodule {
config.serviceConfig = mkIf (osConfig.specialisation != { }) {
RestrictRealtime = mkDefault true;
};
}
);
};
config = mkIf (config.specialisation != { }) {
systemd.services = {
rtkit-daemon.serviceConfig.RestrictRealtime = false;
};
};
}

View file

@ -3,16 +3,32 @@
config.systemd.services = lib.mkIf (config.specialisation != { }) {
"getty@".serviceConfig = {
#CapabilityBoundingSet =[
# "CAP_SYS_TTY_CONFIGCAP_LEASE"
#];
CapabilityBoundingSet = [
"CAP_CHOWN"
"CAP_FOWNER"
"CAP_FSETID"
"CAP_SETGID"
"CAP_SETUID"
"CAP_SYS_NICE"
"CAP_SYS_RESOURCE"
"CAP_SYS_TTY_CONFIG"
];
# NoNewPrivileges = true;
RestrictNamespaces = "pid";
RestrictNamespaces = [
"~pid"
"~user"
"~net"
"~uts"
"~mnt"
"~cgroup"
"~ipc"
];
ProtectControlGroups = true;
ProtectHome = false;
ProtectClock = false;
# ProtectClock = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
MemoryDenyWriteExecute = true;
@ -20,7 +36,6 @@
SystemCallArchitectures = "native";
SystemCallFilter = lib.mkForce "@system-service";
LockPersonality = true;
#RestrictRealtime=true;
ProtectProc = "invisible";
# PrivateUsers=true;

View file

@ -30,7 +30,7 @@
grimmShared = {
tooling = {
enable = true;
# pass = true;
# pass = true;
};
gaming = true;
portals = true;