New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hardening options to systemd units #5286

Closed
Kriechi opened this Issue Oct 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@Kriechi
Copy link

Kriechi commented Oct 23, 2018

Feature request / request for comments:

systemd provides various options to increase security and control to the kernel and various filesystem paths:
https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04

I have used the following set in various other service / unit files:

      PrivateTmp=true
      ProtectSystem=strict
      # ProtectHome=true (probably would block syncthing from creating new folders et al)
      PrivateDevices=true
      ProtectKernelTunables=true
      ProtectKernelModules=true
      ProtectControlGroups=true
      NoNewPrivileges=true

strelaysrv already includes some of these options:

PrivateTmp=true
ProtectSystem=full
ProtectHome=true
NoNewPrivileges=true

syncthing does not include any at the moment:
https://github.com/syncthing/syncthing/blob/7f55fbbe8415e9ff30db1aec02563590fa068650/etc/linux-systemd/user/syncthing.service
https://github.com/syncthing/syncthing/blob/7f55fbbe8415e9ff30db1aec02563590fa068650/etc/linux-systemd/system/syncthing%40.service

There is an open PR for discosrv that includes similar options as strelaysrv:
https://github.com/syncthing/discosrv/pull/19/files
(stale PR, should be closed - at least in that repo)


I would be interested in your thoughts or guidelines on improving service security by adding some of these options. Do you see a benefit? Would you recommend them - or even add them to the template service file included in the deb packages?

Version Information

OS Version: Ubuntu / Debian / Linux

@calmh

This comment has been minimized.

Copy link
Member

calmh commented Oct 23, 2018

Some of these should be fine to enable (the kernel stuff) but also mostly irrelevant as syncthing should not run as root. Others I don't know. Needs someone who knows systemd, and some testing.

@calmh calmh added the enhancement label Oct 23, 2018

@calmh calmh closed this in #5351 Dec 7, 2018

calmh added a commit that referenced this issue Dec 7, 2018

@calmh calmh added this to the v0.14.55 milestone Dec 11, 2018

@calmh calmh changed the title Security: systemd service hardening Add hardening options to systemd units Dec 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment