mirror of
https://github.com/acme-dns/acme-dns.git
synced 2026-04-27 04:45:48 +03:00
[GH-ISSUE #79] Run Dockerized server process as unprivileged user by default #32
Labels
No labels
Documentation
Documentation
bug
enhancement
feature request
feature request
help wanted
pull-request
question
security
security
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/acme-dns#32
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 @Ajedi32 on GitHub (May 5, 2018).
Original GitHub issue: https://github.com/acme-dns/acme-dns/issues/79
Would be nice from a security perspective if the Dockerized version of acme-dns automatically started as an unprivileged user (instead of as root).
The container does provide some level of isolation from the host system already (though as I understand it that isolation isn't perfect, especially against root), but no sense in giving the public-facing server any more permissions than necessary.
@Ajedi32 commented on GitHub (May 6, 2018):
Actually, after reading up a bit more on how Docker works, I'm not sure this feature needs to be added to acme-dns itself. I'm able to get the process to run as an unprivileged user using a
docker-compose.ymlfile similar to the following:Where '1000' is the user id of the user on the host that I want to run acme-dns as. Note also that I had to change the config file to ensure acme-dns doesn't try to bind to any privileged ports (though those ports are then remapped by Docker, as you can see in the config file above).
@Ajedi32 commented on GitHub (May 6, 2018):
Oops, looks like there's a problem; the directory cache for ACME certs,
api-certs, isn't configurable, and by default it's placed under/root, which doesn't have the exec permission bit set for "other". So even if I add/containers/acme-dns/api-certs:/root/api-certsas a volume, the server still can't find that directory.@Ajedi32 commented on GitHub (May 14, 2018):
Now that #81 is merged, it's possible to run acme-dns as an unprivileged user with the above
docker-compose.ymlby settingacme_cache_dir = "/var/lib/acme-dns/api-certs"in the config file, and configuring acme-dns to bind to high-numbered (>1024) ports within the container.That's enough to satisfy my use-case, but I'm going to leave this issue open as a request to run the container as an unprivileged user by default. I realize that's a bit tricky to do since user IDs within the Docker container don't necessarily match up with user IDs on the host system, so if you hard code a user ID in the Dockerfile that might result in the container process running as an essentially random user. That's certainly confusing behavior, but it's an arguably better solution than just always running as root, and you can reduce confusion by updating the docs to tell users to explicitly specify which user ID to run the container as.
@joohoi commented on GitHub (May 14, 2018):
Yeah, that sounds good. My Docker-fu runs short right about here though. If someone with strong knowledge of best practices in this area would like to help here, it would be more than welcome!
@tcely commented on GitHub (Mar 1, 2019):
For anyone else that needs a bit of help, here is my full
Dockerfilefor running unprivileged.Here is the service entry from
docker-compose.ymlI'm using for this:The UID and GID for
postgresare both70so when you create thedata/acme-dns/libdirectory you may need to change the owner and/or group.Put your
config.cfgfile underdata/acme-dns/etcand be sure it is readable.Then just drop the
Dockerfilein thebuild/acme-dnssub-directory before runningdocker-compose up -d --buildand you should be ready to go.@bitsofinfo commented on GitHub (Dec 21, 2022):
did this ever go anywhere? does anyone have a published latest version out there that runs non-root?