-
Notifications
You must be signed in to change notification settings - Fork 19
feat: rootless container support #90
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
base: main
Are you sure you want to change the base?
Conversation
|
Please, could you sign your PR? |
|
ah yes, I will, just gotta check how :) |
fb70d2d to
13c499c
Compare
|
done |
|
I must've been tired when making this PR, I noticed that I moved the cadir variable to the non-CA branch. That was not my intention, also the explanation I gave with setting the cadir explicitly is a bit unclear, I'll fix this tomorrow and break it down more clearly. I'll report back once it's done with the tests I executed |
|
OK, that should be it - the comments in cadir=$(puppet config print cadir)
puppet config set cadir $cadir(see the script's comments for a more detailed explanation) but maybe it's better to use the default path of I woud consider the default of the puppet CLI a bug, as the docs already mention setting code and conf dir in puppetserver.conf to be the same as puppet.conf in order to prevent mismatches, but it's not enough |
|
Tested the image for properly importing CA files as nonroot: |
Features and changes
Rootless
The intent of this PR is to enable running openvox-server rootlessly. In this setup it does that by default, but that can be adjusted via " docker run --user 0" for example, then it should run as usual. The puppet server itself always runs as puppet in the current setup, regardless of this PR.
If running rootless by default is not a desired behaviour change, for example due to certain directory paths being different (see below), we could also consider removing the USER directive, as this image can then simply be wrapped like this:
Rootless default directories are different
One thing to keep in mind is that when running as a non-root user we have different default directories.
For example puppet.conf does not live in
/etc/puppetlabs/puppet/puppet.conf. As this is officially documented behaviour I don't see a need to try to change this, but it should be pointed out.Permission management change
Another big change is the move of 30-set-permissions.sh from runtime to build-time.
The functionality of the script is to chown puppet related directories to the puppet user and group recursively:
The script could be readded to run-time execution, but for nonroot to work, we need to include it at build-time anyways.
Currently this would remove the functionality of automatically changing ownership of certain directories, in case they are mounted and don't have the container's puppet UID/GID. In my opinion it shouldn't be an issue, but it should be mentioned.
About the need to include it at build-time:
CAP_CHOWNcapability by default./var/log/puppetlabs/puppetserveris owned by puppet by default in package installations and enables us to log./opt/puppetlabs/server/data/puppetserveris puppets default home directory, so this is also needed./etc/puppetlabs/puppetservermight not fully be necessary, but as of now files in./conf.d /as well as./services.d/ca.cfgare potentially edited at run-time, which requires us at least write access to those, as well as the minimum read access. The CA directory./ca/is fully owned by puppet by default.Other small changes and future idea
I also refactored some of the scripts in order to make them more robust (avoiding hardcoded paths was a needed for this to work) and moved some version arguments to the global scope, as the
LABELdirective was not able access one of them.Ideally we could run images with arbitrary UIDs in the future, but I'm not sure if this is possible at the moment, due to limitations in puppetserver (not fully respecting
manage_internal_permissions = falseamong other 'quirks').