Bug 1222954 - headscale: check if CAP_CHOWN can be dropped from systemd unit
Summary: headscale: check if CAP_CHOWN can be dropped from systemd unit
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Security (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Richard Rahl
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-17 09:21 UTC by Matthias Gerstner
Modified: 2024-04-18 14:07 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Gerstner 2024-04-17 09:21:48 UTC
The security team monitors additions of systemd services to Tumbleweed and
this way we stumbled over the recent addition of headscale.

The systemd service of headscale specified the CAP_CHOWN capability:

/usr/lib/systemd/system/headscale.service
```
[Service]
<snip>
User=headscale
Group=headscale
ExecStart=/usr/bin/headscale serve
Restart=always
RestartSec=5

WorkingDirectory=/var/lib/headscale
ReadWritePaths=/var/lib/headscale /var/run

AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_CHOWN
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_CHOWN
<snip>
```

I couldn't find any reason for the service being granted CAP_CHOWN. Therefore
I asked the upstream maintainer, Kristoffer Dalby, about it, and he also
cannot see why this is needed. Quote:

```
I suspect that this is carried over from the systemd file used in NixOS,
which in turned was copied from a separate project that had a stricter
systemd file than standard. So it might just be a copy pasta error.

If you test it without, please let me know what you find out.
```

Can you please remove the CAP_CHOWN from the systemd unit and check whether
the package still works as expected. Then we can give feedback to upstream to
apply this hardening there, too. Thanks!
Comment 1 Richard Rahl 2024-04-18 14:07:22 UTC
Thank you for pointing this out. With my quick testing, CAP_CHOWN is not needed.
This gets fixed in SR#1168893.