Skip to content
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

systemd: restrict permissions #778

Merged
merged 2 commits into from
Apr 8, 2024
Merged

systemd: restrict permissions #778

merged 2 commits into from
Apr 8, 2024

Conversation

Choraden
Copy link
Contributor

@Choraden Choraden commented Apr 8, 2024

Forwarder does not need that many permissions, we can restrict it to minimum.

CAP_NET_BIND_SERVICE can be used to allow this user to bind to a port < 1024 if desired.

The work is based on wireproxy's systemd configuration[1]. Also I found systemd service hardening doc[2] helpful.

DynamicUser/Strict system protection didn't work as package installs forwarder binary at /usr/bin.

[1] pufferffish/wireproxy#103.
[2] https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04

Forwarder does not need that many permissions, we can restrict it to minimum.

CAP_NET_BIND_SERVICE can be used to allow this user to bind to a port < 1024 if desired.

The work is based on wireproxy's systemd configuration[1]. Also I found systemd service hardening doc[2] helpful.

DynamicUser/Strict system protection didn't work as package installs forwarder binary at /usr/bin.

[1] pufferffish/wireproxy#103.
[2] https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04
Running systemd service in a container is not very common. We use it for testing, however it has its disadvantages.
Some container runtimes prohibit creating UTS namespaces. That leads to a warning:
"forwarder.service: ProtectHostname=yes is configured, but UTS namespace setup is prohibited (container manager?), ignoring namespace setup."
Giving a container privileged mode fixes this issue.
@mmatczuk mmatczuk merged commit 31f7ce4 into main Apr 8, 2024
6 checks passed
@mmatczuk mmatczuk deleted the hg/systemd_privileges branch April 8, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants