Skip to content

Commit

Permalink
nixos/ympd: Unit hardening
Browse files Browse the repository at this point in the history
Next to some systemd unit hardening, the nobody user isn't used anymore,
as suggested in NixOS#55370.
  • Loading branch information
oxzi committed Jan 14, 2023
1 parent 5fb9ccb commit 218de01
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion nixos/modules/services/audio/ympd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,46 @@ in {

systemd.services.ympd = {
description = "Standalone MPD Web GUI written in C";

wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host ${cfg.mpd.host} --port ${toString cfg.mpd.port} --webport ${toString cfg.webPort} --user nobody";
after = [ "network-online.target" ];

serviceConfig = {
ExecStart = ''
${pkgs.ympd}/bin/ympd \
--host ${cfg.mpd.host} \
--port ${toString cfg.mpd.port} \
--webport ${toString cfg.webPort}
'';

DynamicUser = true;
NoNewPrivileges = true;

ProtectProc = "invisible";
ProtectSystem = "strict";
ProtectHome = "tmpfs";

PrivateTmp = true;
PrivateDevices = true;
PrivateIPC = true;

ProtectHostname = true;
ProtectClock = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectKernelLogs = true;
ProtectControlGroups = true;

RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
RestrictRealtime = true;
RestrictSUIDSGID = true;

SystemCallFilter = [
"@system-service"
"~@process"
"~@setuid"
];
};
};

};
Expand Down

0 comments on commit 218de01

Please sign in to comment.