Skip to content

systemd: tight sandboxing#103

Merged
1 commit merged intowindtf:masterfrom
jdek:master
Mar 18, 2024
Merged

systemd: tight sandboxing#103
1 commit merged intowindtf:masterfrom
jdek:master

Conversation

@jdek
Copy link
Contributor

@jdek jdek commented Mar 18, 2024

wireproxy needs very little permissions, we can restrict it to basically nothing. DynamicUser means the system will generate a UID on demand for service, also CAP_NET_BIND_SERVICE can be used to allow this user to bind to a port < 1024 if desired. LoadCredential lets us read a file with tight permissions i.e. root:root 0400 and pass it to only wireproxy in an ephemeral and constrained manner.

wireproxy needs very little permissions, we can restrict it to basically
nothing. DynamicUser means the system will generate a UID on demand
for service, also CAP_NET_BIND_SERVICE can be used to allow this user
to bind to a port < 1024 if desired. Also LoadCredential lets us read
a file with tight permissions i.e. root:root 0400 and pass it to only
wireproxy in an ephemeral and constrained manner.

Signed-off-by: J. Dekker <jdek@itanimul.li>
@ghost
Copy link

ghost commented Mar 18, 2024

This is interesting, for OpenBSD wireproxy would automatically use pledge and unveil to limit its privileges. I think it would be worth it if we also have something similar for Linux but not just in systemd as well. I believe something similar can be achieved with seccomp but I haven't looked into it.

@ghost ghost merged commit 4f066d0 into windtf:master Mar 18, 2024
@villepeh
Copy link
Contributor

villepeh commented Apr 2, 2024

Thanks for these improvements! I'm not a pro with systemd units so I'm glad someone took a look

Choraden added a commit to saucelabs/forwarder that referenced this pull request 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] windtf/wireproxy#103.
[2] https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04
Choraden added a commit to saucelabs/forwarder that referenced this pull request 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] windtf/wireproxy#103.
[2] https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04
mmatczuk pushed a commit to saucelabs/forwarder that referenced this pull request 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] windtf/wireproxy#103.
[2] https://gist.github.com/ageis/f5595e59b1cddb1513d1b425a323db04
This pull request was closed.
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