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

cron and redis fixes for running with non-root UID #1469

Closed
wants to merge 4 commits into from
Closed

cron and redis fixes for running with non-root UID #1469

wants to merge 4 commits into from

Conversation

RlndVt
Copy link

@RlndVt RlndVt commented Apr 6, 2021

When not running as 'www-data', the redis and cron functionality (as shown in examples such as ".examples/docker-compose/insecure/mariadb-cron-redis/fpm/docker-compose.yml") break. These commits fix these issues.

Partial fix for #359

Possible supplement to #1278.

Adding the cron command to  /var/spool/cron/crontabs/www-data assumes
that cron, and by extension the nextcloud app, is run as 'www-data'.

'crond' cannot be used with:
exec "echo \"*/%%CRONTAB_INT%% * * * * php -f /var/www/html/cron.php\" | crontab - && crond -f -l 0 -L /dev/stdout"
because that assumes the uid used matches a entry in '/etc/passwd'.

Signed-off-by: Roland Vet <[email protected]>
Signed-off-by: Roland Vet <[email protected]>
If "REDIS_HOST=redis" is used in combination with a custom uid, the
container attempts to write to redis-session.ini which fails due to lack
of permission.

Signed-off-by: Roland Vet <[email protected]>
Signed-off-by: Roland Vet <[email protected]>
@J0WI
Copy link
Contributor

J0WI commented Nov 28, 2022

I don't think that making the PHP config world writeable is a good practice.

@J0WI J0WI added the wontfix label Nov 28, 2022
@RlndVt
Copy link
Author

RlndVt commented Nov 28, 2022

I don't think that making the PHP config world writeable is a good practice.

In general I agree. Any alternative suggestion is welcome.

@danieljkemp
Copy link

danieljkemp commented Nov 28, 2022 via email

@RlndVt
Copy link
Author

RlndVt commented Dec 6, 2022

If the goal was to make the container run as a non-root UID (www-data:33) it wouldn't be too bad, just chown the required files. That likely wouldn't meet the goal of some, but it could be an improvement.

Problem is that at the time docker runs through this part of the entrypoint:

https://github.com/nextcloud/docker/blob/master/docker-entrypoint.sh#L75-L100

we've dropped to a uid/gid, (L53-73) but the Dockerfile does not know what that uid/gid it will be. Making it writable by all is a generic fix, but not great security wise.

I solved this in k8s by just mounting a templates redis config as a configmap, and not using that particular redis_host variable.

I don't know how you would apply that here.


PR fixes #763

@J0WI
Copy link
Contributor

J0WI commented Dec 6, 2022

I solved this in k8s by just mounting a templates redis config as a configmap, and not using that particular redis_host variable.

This is what always works. Just mount your own zzz_myconfig.ini to overwrite any config.

@danieljkemp
Copy link

danieljkemp commented Dec 7, 2022 via email

@RlndVt RlndVt closed this by deleting the head repository Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants