Commit 005dc432 authored by Vitaly Lipatov's avatar Vitaly Lipatov

systemd: harden eterban services

parent 49c9665f
......@@ -8,6 +8,11 @@ ExecStart=/usr/bin/python3 /usr/share/eterban/eterban_api.py
Restart=always
RestartSec=5
RestartPreventExitStatus=78
NoNewPrivileges=true
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
UMask=0077
[Install]
WantedBy=multi-user.target
......@@ -8,6 +8,11 @@ ExecStart=/usr/bin/python3 /usr/share/eterban/eterban_internal.py
Restart=on-failure
RestartSec=5
RestartPreventExitStatus=78
NoNewPrivileges=true
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
UMask=0077
[Install]
WantedBy=multi-user.target
......@@ -6,6 +6,11 @@ After=syslog.target network.target
Restart=always
RestartPreventExitStatus=78
ExecStart=/usr/bin/python3 /usr/share/eterban/eterban_switcher.py
NoNewPrivileges=true
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
UMask=0077
[Install]
WantedBy=multi-user.target
......@@ -64,3 +64,12 @@ if rg -q 'exec /usr/share/eterban/.*\.py' gateway/usr/bin/eterban.sh || ! rg -qx
fi
sh tests/cli-interface.sh
for unit in gateway/etc/systemd/system/eterban.service gateway/etc/systemd/system/eterban-api.service gateway/etc/systemd/system/eterban-internal.service; do
for directive in 'NoNewPrivileges=true' 'PrivateTmp=true' 'ProtectHome=true' 'ProtectSystem=full' 'UMask=0077'; do
rg -qx "$directive" "$unit" || {
echo "$unit is missing $directive" >&2
exit 1
}
done
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment