-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In effort to run BMO as non-root, we also need to have mariadb run as non-root. We can reuse mysql user (uid/gid 27) as we only read from shared volumes and do not need to use same fsGroup as others. This change should be backwards compatible, and should work fine without BMO manifest change as well. All configuration allows using root user as before.
- Loading branch information
Showing
3 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
ARG BASE_IMAGE=quay.io/centos/centos:stream8 | ||
ARG BASE_IMAGE=quay.io/centos/centos:stream9 | ||
|
||
FROM $BASE_IMAGE | ||
|
||
ENV PKGS_LIST=main-packages-list.txt | ||
ARG EXTRA_PKGS_LIST | ||
|
||
COPY ${PKGS_LIST} ${EXTRA_PKGS_LIST:-$PKGS_LIST} /tmp/ | ||
COPY prepare-image.sh runmariadb /bin/ | ||
COPY prepare-image.sh configure-nonroot.sh runmariadb /bin/ | ||
|
||
RUN /bin/prepare-image.sh && rm -f /bin/prepare-image.sh | ||
RUN /bin/configure-nonroot.sh && rm -f /bin/configure-nonroot.sh | ||
|
||
ENTRYPOINT /bin/runmariadb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/bash | ||
# | ||
# configure mysql image to run with mysql user | ||
# changes are backwards compatible for running as root | ||
|
||
set -eux | ||
|
||
# mysql user uid/gid | ||
# NONROOT_UID=27 | ||
NONROOT_GID=27 | ||
|
||
mkdir -p /certs | ||
chgrp -R "${NONROOT_GID}" /certs | ||
chmod 2775 /certs | ||
|
||
chgrp -R "${NONROOT_GID}" /etc/my.cnf.d | ||
chmod 2775 /etc/my.cnf.d | ||
chmod -R g+w /etc/my.cnf.d/* | ||
|
||
mkdir -p /var/lib/mysql | ||
chgrp -R "${NONROOT_GID}" /var/lib/mysql | ||
chmod -R g+w /var/lib/mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters