openSUSE / containers-systemd

Systemd service files to run various openSUSE containers by systemd and podman
MIT License
13 stars 4 forks source link

container-mariadb fails to start: wrong permissions on /etc/mariadb-secrets/* #2

Closed RobinR1 closed 4 years ago

RobinR1 commented 4 years ago

I just found this repository and had already reported this problem here: https://bugzilla.opensuse.org/show_bug.cgi?id=1171893 But I was not sure if it was the right place to submit it there. Therefore I will submit it here also (please close one of both depending on where this issue will be tracked?)

When starting the container-mariadb systemd service it fails to initialize/start.

On examination, it turns out the container exits with this error:

/usr/local/bin/entrypoint.sh: line 44: /etc/mariadb-secrets/MYSQL_ROOT_PASSWORD: Permission denied

/etc/mariadb-secrets/MYSQL_ROOT_PASSWORD by default has only rw permissions for user root.

The entrypoint.sh script which is initially run as root user, performs an

exec su mysql -s /bin/bash -c '/usr/local/bin/entrypoint.sh mysqld'`

(line 78) and only after this user switch to user mysql, it tries to read the /etc/mariadb-secrets/MYSQL_ROOT_PASSWORD file for which it now has no permissions, hence it fails and the container stops.

I think the container should set the permissions of the /etc/mariadb-secrets/* files to user mysql upon start, or it should read those files as user root and pass the values on to the mysql-user process somehow.

thkukuk commented 4 years ago

The correct place for openSUSE bugs is the openSUSE bugzilla.

thkukuk commented 4 years ago

This is the wrong place, too, as the sytemd service files to run containers have nothing to do with the containers themself or the content of them.