Skip to content
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

Minimise root ownership of application files #172

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kowh-ai
Copy link
Contributor

@kowh-ai kowh-ai commented Sep 9, 2024

Fixes: this issue

To improve the security of CKAN images and containers, it is advised that all files and directories related to the application be assigned to a dedicated non-root user. Moreover, running CKAN processes under a separate non-root user account strengthens system security by minimising the privileges of the running services.

To be applied along with the main ckan-docker-base update: ckan/ckan-docker-base#80

mjanez added a commit to mjanez/ckan-docker that referenced this pull request Oct 17, 2024
@wardi
Copy link
Contributor

wardi commented Nov 6, 2024

@kowh-ai I'm just testing the README's "Create an extension" section and it's now failing with a permission error.

I can get past it with a change to the command like:

docker compose -f docker-compose.dev.yml exec -u `stat -c '%u' src` -e HOME=/srv/app/src_extensions ckan-dev ckan generate extension --output-dir /srv/app/src_extensions

This has the benefit of creating the files as the correct UID from outside the container, so these last two paragraphs can be removed from the section:

The files will be owned by root, to correct the ownership so you can edit the files with your normal account outside the container run:

docker compose -f docker-compose.dev.yml exec ckan-dev chown --reference /srv/app/src_extensions/ -R /srv/app/src_extensions/ckanext-mytheme/

But maybe that command is getting long to type in? We could consider putting the "create an extension" command into a script in this repo, what do you think?

@wardi
Copy link
Contributor

wardi commented Nov 8, 2024

I've made these changes in #185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a non-root user for all application files/directories, use another non-root user to run the CKAN processes
2 participants