Skip to content

Commit 997ac61

Browse files
committed
alertmanager: support tuning systemd sandboxing
We had to disable some systemd sandboxing options in an environment with NFS shares mounted.
1 parent c4a5dbc commit 997ac61

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ansible/roles/alertmanager/defaults/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,13 @@ alertmanager_config_default:
5050
receivers: "{{ alertmanager_receivers }}"
5151

5252
alertmanager_config_extra: {} # top-level only
53+
54+
# Whether to set ProtectHome=true in systemd unit. This option may need to be
55+
# disabled in some environments, to avoid a "Failed to set up mount
56+
# namespacing" error when starting alertmanager.
57+
alertmanager_systemd_protect_home: true
58+
59+
# Whether to set ProtectSystem=strict in systemd unit. This option may need to
60+
# be disabled in some environments, to avoid a "Failed to set up mount
61+
# namespacing" error when starting alertmanager.
62+
alertmanager_systemd_protect_system: true

ansible/roles/alertmanager/templates/alertmanager.service.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ LockPersonality=true
3838
NoNewPrivileges=true
3939
MemoryDenyWriteExecute=true
4040
PrivateTmp=true
41+
{% if alertmanager_systemd_protect_home | bool %}
4142
ProtectHome=true
43+
{% endif %}
4244
ReadWriteDirectories={{ alertmanager_storage_path }}
4345
RemoveIPC=true
4446
RestrictSUIDSGID=true
@@ -47,7 +49,9 @@ PrivateUsers=true
4749
ProtectControlGroups=true
4850
ProtectKernelModules=true
4951
ProtectKernelTunables=yes
52+
{% if alertmanager_systemd_protect_system | bool %}
5053
ProtectSystem=strict
54+
{% endif %}
5155

5256
[Install]
5357
WantedBy=multi-user.target

0 commit comments

Comments
 (0)