Skip to content

Commit 8d7ec35

Browse files
committed
[OPS-1161] Harden systemd service
Problem: We want to harden the security of our systemd services. Solution: Use the hardening profile defined in serokell.nix.
1 parent e949663 commit 8d7ec35

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

module.nix

+19-1
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,32 @@ in
5050
export SLACK_TZ_BOT_TOKEN="${cfg.slackBotToken}"
5151
${cfg.package}/bin/tzbot-exe --config ${pkgs.writeText "config.yml" (builtins.toJSON cfg.botConfig)}
5252
'';
53+
5354
startLimitBurst = mkDefault 5;
5455
startLimitIntervalSec = mkDefault 300;
55-
serviceConfig = {
56+
serviceConfig = withHardeningProfile hardeningProfiles.backend {
5657
User = "tzbot";
5758
Group = "tzbot";
5859
StateDirectory = "tzbot";
5960
Restart = mkDefault "on-failure";
6061
RestartSec = mkDefault 10;
62+
63+
SystemCallFilter = [
64+
"~@clock"
65+
"~@debug"
66+
"~@module"
67+
"~@mount"
68+
"~@raw-io"
69+
"~@reboot"
70+
"~@swap"
71+
"~@privileged"
72+
"~@resources"
73+
"~@cpu-emulation"
74+
"~@obsolete"
75+
76+
# override hardening profile
77+
"set_mempolicy"
78+
];
6179
};
6280
};
6381
users.users.tzbot = {

0 commit comments

Comments
 (0)