mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #2014] dnscrypt-proxy and systemd's DynamicUser concept #1356
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#1356
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Jun 27, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2014
Hi, I'm having some issues/questions about firejail's
dnscrypt-proxyprofile and the way to integrate firejail in systemd service files for that program. Let me start with providing some context. If the following sounds confusing, be advised: it's because of my limited experience with systemd'sDynamicUserconcept, let alone in combination with firejail.In the beginning... there was only DNSCrypt v1. This is still the default version served by Ubuntu in its official repositories (1.6.1 for 16.04 LTS up until 1.9.5 for 18.04 LTS). Firejail's dnscrypt-proxy.profile works fine with v1. In fact, I've been succesfully using a custom dnscrypt-proxy.local to tighten-up things further via 'netfilter', 'nodbus', 'nogroups', 'nou2f' and 'protocol inet,inet6'.
Example of a working dnscrypt-proxy v1 systemd unit file with integrated firejail sandboxing:
Beginnings only last for so long, also in the case of DNSCrypt. For a while now v1 has been superseded by DNSCrypt v2. This is the default version on Arch, currently at 2.0.15. As far as firejail is concerned there's still the same executable
/usr/bin/dnscrypt-proxyto be sandboxed, no changes there (at least not in the way the binary is named, exactly like in v1 packages). Behind the scenes though this is a different beast alltogether (see https://github.com/jedisct1/dnscrypt-proxy/wiki/Differences-to-v1 for a comparison).On Arch, dnscrypt-proxy comes with a systemd unit file that uses the DynamicUser concept:
In this form, starting the unit file throws an error:
Jun 27 13:02:36 systemd[1]: Started DNSCrypt proxy client [v2].
Jun 27 13:02:36 systemd[1]: Reached target Host and Network Name Lookups.
Jun 27 13:02:36 firejail[21411]: Error: cannot create /run/firejail/profile/21411
Jun 27 13:02:36 systemd[1]: dnscrypt-proxy.service: Main process exited, code=exited, status=1/FAILURE
Jun 27 13:02:36 systemd[1]: dnscrypt-proxy.service: Failed with result 'exit-code'.
For users on Arch ( and I assume this is the same on any distro using v2) the current
dnscrypt-proxy.profilelooks broken. I'm not getting anywhere when experimenting with*
whitelistingdirs under /var/cache/, /var/log/, /var/run incl. their /var/*/private counterparts* declaring the above dirs
read-write* adding
writable-varHas anyone been looking into this recently?
@Vincent43 commented on GitHub (Jun 28, 2018):
Don't use two sandboxing tools at the same time. I would leave that one to systemd. It's pretty much hardened by default, if you want to do more look at https://github.com/jedisct1/dnscrypt-proxy/issues/289#issuecomment-377522739
@ghost commented on GitHub (Jun 28, 2018):
@Vincent43 Indeed, that's exactly what I'm doing in the case of dnscrypt-proxy, at least on Arch, where the default systemd unit looks already tightened-up. Cheers.
@ghost commented on GitHub (Jun 28, 2018):
Did some more testing, and for users who would like to harden the sandboxing in Arch's systemd unit for dnscrypt-proxy, these extras have been tested to work:
@curiosity-seeker commented on GitHub (Jun 28, 2018):
FWIW, I'm using those setting, too, on Fedora 28. Additionally:
following this advice, and:
I think those syscall filters harden the sandbox considerably.
@ghost commented on GitHub (Jun 29, 2018):
@curiosity-seeker Thanks for sharing your insights on this and providing that link. All good now :-)