-
Notifications
You must be signed in to change notification settings - Fork 216
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
allow deploying s6-overlay in images without nobody/nogroup #15
Comments
If we're going to create our own users, no need to care about nobody/nogroup in particular. We can create users with the name we want - and it's better, since we're sure our processes will be the only ones running as those users. The only worry that I have is: is it worth it? I initially picked "nobody" and "daemon" because it was easy - those users are almost guaranteed to exist on every system, and it was a simple way of using non-root uids without having to work too hard on it. The possibilities I really want to explore are:
|
I would vote against trying to manipulate user databases at runtime, or even at build-time. The overlay is just a .tar.gz - if we got into having some type of "post-extract" step, I think we're getting into the realm of inventing a package management system. If the goal is to provide a sort of "best practices"-oriented project, I think it's reasonable to document what user(s) each service requires. Alongside that, you would have documentation on how to add a new service. This could include creating a service user, using envdirs effectively, logging, and so on. |
I agree with both points of view. None of the possible solution is optimum for the reasons you guys are saying. But most of all I think it is worth pursuing to uphold the claim that the s6-overlay can work with any image whatsoever. And including The problems you guys are highlighting is the reason I think is 'best efforts' to fall back to a hardcoded UID number when the user does not exist. Which realistically shall only happen for exceptional cases (e.g. mis-configured images like busybox). With also a decent warning message to stderr whenever that happens. It isn't very elegant solution I admit. But it just does require us to interfere as much with the image, or suffer the other problems ^^ you are hitting here. |
Once Docker fixes [EDIT] minor correction to docker's future
vs FROM ubuntu-debootstrap:14.04
ADD --extract https://<download_url>/s6-overlay.tar.gz /
ENTRYPOINT ["/init"] So - what I am saying is that the cost of having more elegant user accounts comes at the price of less elegance in the
N.B. Another point I think we need to remember is the What do you think? |
Hi all, Let's discard some options in order to start focusing on feasible solutions:
This would override existing
In conclusion, the only solutions would be:
We can do a proof-of-concept, and decide if it's really worth it. |
No, performing /etc/passwd manipulation at runtime in stage 1, or option parsing in /init, is clearly not worth it: too slow, too complex, too brittle. I'll modify s6-envuidgid to be able to specify default values when the user isn't found in the uid database. |
There. If you use s6-2.1.3.0, you'll be able to write "s6-envuidgid -D uid:gid blah..." to get default values.
We need at least one id for the catch-all logger (s6log ?) and one for the fd-holding daemon (fdholder ?). I suggest reserving ids like 32768 and 32769: nobody ever uses those (it's either on the low range or close to 65535, never in the middle). |
@skarnet +1 I agree with this. While talking on the same subject about setuidgid, we might want to check beforehand, when starting up if the process UID of PID 1 is not 0. Since in that situation we are not allowed to. That is a different issue though I just wanted to briefly mention it. |
I'd recommend you just try changing user ID but if it fails just move on. On March 13, 2015 5:13:59 PM CDT, Dreamcat4 notifications@github.com wrote:
Sent from my Android device with K-9 Mail. Please excuse my brevity. |
Yeah, this one isn't going to be pretty. I'm not changing s6-applyuidgid to allow it to go on even if it does not succeed in dropping its privileges. You know that if there's an option to do something insecure, people will use that option in contexts where it is not safe, and will create security weaknesses. So yes, special-casing a non-root pid 1 will be needed, because all the s6-setuidgid lines will need to be removed in that case. I think we should create a specific version of /etc/s6/service with run scripts tailored to a non-root USER. We could even make those run scripts write condescending and patronizing messages to the logs. Maybe have a special service that spams outside of the container in the most annoying way possible. "Do you know you've been running that container in an UNSAFE AND MORONIC WAY for $seconds seconds ?" Just kidding. But sometimes, the dark side is oh so tempting. |
@skarnet i think you have missed something parsing in
UPDATE 1: but now thinking it twice (sorry because i woke up now...), is it really possible to convert in a user that doesn't exist? :
And it works:
|
@glerchundi yeah, it's possible to change id to a non-existant user, it happens fairly often. |
@skarnet , I don't know if you were refering to the last comment of @dreamcat4 or just to the whole issue discussion. Anyway, i've changed the implementation which uses So, i'm going to close this and move forward. If you want to change s6 source code and include this, I will happily change it again :-) |
fixes #15, if vital users don't exist, defaults to custom uid/gid
Images like busybox:ubuntu-14.04 don't include neither
nobody
in/etc/passwd
nornorgroup
in/etc/group
and init fails to start outputting this:As our overlay can just deploy static files in the destination image the solution would be to perform these actions in runtime:
What do you think?
The text was updated successfully, but these errors were encountered: