mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-25 17:16:00 +03:00
[GH-ISSUE #993] Running archivebox as an unprivilleged container #3640
Labels
No labels
expected: maybe someday
expected: next release
expected: release after next
expected: unlikely unless contributed
good first ticket
help wanted
pull-request
scope: all users
scope: windows users
size: easy
size: hard
size: medium
size: medium
status: backlog
status: blocked
status: done
status: idea-phase
status: needs followup
status: wip
status: wontfix
touches: API/CLI/Spec
touches: configuration
touches: data/schema/architecture
touches: dependencies/packaging
touches: docs
touches: js
touches: views/replayers/html/css
why: correctness
why: functionality
why: performance
why: security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ArchiveBox#3640
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 @tofran on GitHub (Jun 21, 2022).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/993
Bug description
ArchiveBox Docker images have always been quite opinionated in terms of permissions, but as of
v0.6.2it became impossible to run ArchiveBox with an arbitrary non privileged user./bin/docker_entrypoint.shis the main reason for this, but I understand as it makes using these docker images more noob poof. I would really like if there was a way to configure this entrypoint via env vars and avoid chown/gosu.Until now what I have been doing is completely bypassing the entrypoint, and it worked great until
v0.6.2, because the code was agnostic to the user and did not require root permissions. Now it enforces the user id from/etc/passwd(with not apparent reason?).Previous working behaviour (v0.6.0):
Steps to reproduce(v0.6.2):
Output
Affecting code
As we can see we are no longer fighting the entrypoint but the code itself:
github.com/ArchiveBox/ArchiveBox@03eb7e5875/archivebox/config.py (L59)Affecting commit:
79e19ecd47Why isn't
getpass.getuser()enough?github.com/ArchiveBox/ArchiveBox@03eb7e5875/archivebox/config.py (L55)getpass.getuser()already returnsarchivebox, thus why would we need to enforce/etc/passwdwithpwd.getpwuid?Even if this is really required for some edge case why enforce it? If needed we could catch it or find a way to bypass it.
ArchiveBox version
Note: since
archivebox versionalso loads the config that enforces/etc/passwdit is the best way to demosntrate the problem. Although in a production environment the command would bearchivebox server 0.0.0.0:8000 --quick-init.Why all this hassle?
I run my containers unprivileged, and this is the direction the industry has been moving to. That's why I face this problem.
Note that running the container as root and then doing
setuidinside it, although a good start, is not the same thing as fully running without any capabilities.I think ArchiveBox should have a way to run it this way, or at least allow it (like prior to
v0.6.2).I'm willing to get my hands dirty, but first I want the opinion of this project contributors for the direction this should take.
Thank you.
@pirate commented on GitHub (Jun 21, 2022):
Oh this is just a bug in getpwuid not being able to resolve a numbered user to a name across different OSs. It's not intended to enforce any kind of privilege or /etc/passwd behavior.
I added this to show whether users are running with root, www-data, or a personal account in the
archivebox versionoutput for easier support troubleshooting.If it's causing bugs we can just remove it and all references to it though.
@Goorzhel commented on GitHub (Sep 13, 2023):
Untested, but:
This way
SYSTEM_USERfalls back to whatever was previously set:github.com/ArchiveBox/ArchiveBox@03eb7e5875/archivebox/config.py (L55)@pirate commented on GitHub (Sep 14, 2023):
fixed, thanks
5c1a14e4f2