purge of noble ubuntu user

Some users depend on a groupid of 1000 as empty.

Its not really used by us so lets remove the entire
ubuntu user and the ubuntu group that came with it.

e.g; https://github.com/FREVA-CLINT/freva/pull/204
This commit is contained in:
Daniel Black 2024-06-20 18:15:21 +10:00
parent aecdf2e613
commit fb46c56626
5 changed files with 12 additions and 5 deletions

View File

@ -2,7 +2,7 @@
FROM ubuntu:noble FROM ubuntu:noble
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu
# add gosu for easy step-down from root # add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases # https://github.com/tianon/gosu/releases

View File

@ -2,7 +2,7 @@
FROM ubuntu:noble FROM ubuntu:noble
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu
# add gosu for easy step-down from root # add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases # https://github.com/tianon/gosu/releases

View File

@ -2,7 +2,7 @@
FROM ubuntu:noble FROM ubuntu:noble
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu
# add gosu for easy step-down from root # add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases # https://github.com/tianon/gosu/releases

View File

@ -2,7 +2,7 @@
FROM ubuntu:%%SUITE%% FROM ubuntu:%%SUITE%%
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql RUN groupadd -r mysql && useradd -r -g mysql mysql --home-dir /var/lib/mysql && userdel --remove ubuntu
# add gosu for easy step-down from root # add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases # https://github.com/tianon/gosu/releases

View File

@ -105,7 +105,9 @@ update_version()
-e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh" -e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
sed -i -e '/--skip-ssl/d' \ sed -i -e '/--skip-ssl/d' \
-e '0,/#ENDOFSUBSTITUTIONS/s/\tmariadb/\tmysql/' "$dir/healthcheck.sh" -e '0,/#ENDOFSUBSTITUTIONS/s/\tmariadb/\tmysql/' "$dir/healthcheck.sh"
sed -i -e '/^CMD/s/mariadbd/mysqld/' "$dir/Dockerfile" sed -i -e '/^CMD/s/mariadbd/mysqld/' \
-e 's/ && userdel.*//' \
"$dir/Dockerfile"
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \ sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh" "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
;; ;;
@ -116,6 +118,8 @@ update_version()
sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh" sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \ sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh" "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/ && userdel.*//' \
"$dir/Dockerfile"
;; ;;
10.11) 10.11)
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \ sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
@ -126,6 +130,7 @@ update_version()
sed -i -e '/^ARG MARIADB_MAJOR/d' \ sed -i -e '/^ARG MARIADB_MAJOR/d' \
-e '/^ENV MARIADB_MAJOR/d' \ -e '/^ENV MARIADB_MAJOR/d' \
-e 's/-\$MARIADB_MAJOR//' \ -e 's/-\$MARIADB_MAJOR//' \
-e 's/ && userdel.*//' \
"$dir/Dockerfile" "$dir/Dockerfile"
;; ;;
*) *)
@ -138,6 +143,8 @@ update_version()
if [[ $vmin =~ 11.[12] ]]; then if [[ $vmin =~ 11.[12] ]]; then
sed -i -e '/--skip-ssl/d' \ sed -i -e '/--skip-ssl/d' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh" "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/ && userdel.*//' \
"$dir/Dockerfile"
fi fi
if [ "$vmin" == 11.1 ]; then if [ "$vmin" == 11.1 ]; then
sed -i -e 's/50-mysqld_safe.cnf/50-mariadb_safe.cnf/' "$dir/Dockerfile" sed -i -e 's/50-mysqld_safe.cnf/50-mariadb_safe.cnf/' "$dir/Dockerfile"