Skip to content

Commit

Permalink
[OPS-1161] Harden systemd service
Browse files Browse the repository at this point in the history
Problem: We want to harden the security of our systemd services.

Solution: Use the hardening profile defined in serokell.nix.
  • Loading branch information
Sereja313 committed Mar 5, 2024
1 parent e949663 commit 8d7ec35
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,32 @@ in
export SLACK_TZ_BOT_TOKEN="${cfg.slackBotToken}"
${cfg.package}/bin/tzbot-exe --config ${pkgs.writeText "config.yml" (builtins.toJSON cfg.botConfig)}
'';

startLimitBurst = mkDefault 5;
startLimitIntervalSec = mkDefault 300;
serviceConfig = {
serviceConfig = withHardeningProfile hardeningProfiles.backend {
User = "tzbot";
Group = "tzbot";
StateDirectory = "tzbot";
Restart = mkDefault "on-failure";
RestartSec = mkDefault 10;

SystemCallFilter = [
"~@clock"
"~@debug"
"~@module"
"~@mount"
"~@raw-io"
"~@reboot"
"~@swap"
"~@privileged"
"~@resources"
"~@cpu-emulation"
"~@obsolete"

# override hardening profile
"set_mempolicy"
];
};
};
users.users.tzbot = {
Expand Down

0 comments on commit 8d7ec35

Please sign in to comment.