2024-10-21 14:18:05 +02:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
NONROOT_UID=10475
|
|
|
|
NONROOT_GID=10475
|
|
|
|
USER="ironic-suse"
|
|
|
|
|
|
|
|
groupadd -r -g ${NONROOT_GID} ${USER}
|
|
|
|
useradd -r -g ${NONROOT_GID} \
|
|
|
|
-u ${NONROOT_UID} \
|
|
|
|
-d /var/lib/ironic \
|
|
|
|
-s /sbin/nologin \
|
|
|
|
${USER}
|
2024-11-12 19:44:52 +01:00
|
|
|
|
2024-10-21 14:18:05 +02:00
|
|
|
# create ironic's http_root directory
|
|
|
|
mkdir -p /shared/html
|
|
|
|
chown "${NONROOT_UID}":"${NONROOT_GID}" /shared/html
|
|
|
|
|
2024-11-12 19:44:52 +01:00
|
|
|
# we'll bind mount shared ca and ironic certificate dirs here
|
2024-10-21 14:18:05 +02:00
|
|
|
# that need to have correct ownership as the entire ironic in BMO
|
|
|
|
# deployment shares a single fsGroup in manifest's securityContext
|
|
|
|
mkdir -p /certs/ca
|
|
|
|
chown "${NONROOT_UID}":"${NONROOT_GID}" /certs{,/ca}
|
|
|
|
chmod 2775 /certs{,/ca}
|
|
|
|
|
|
|
|
# apache2 permission changes
|
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /etc/apache2
|
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /run
|
|
|
|
|
2024-11-12 19:44:52 +01:00
|
|
|
# ironic and httpd related changes
|
|
|
|
mkdir -p /etc/httpd/conf.d
|
2024-10-21 14:18:05 +02:00
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /etc/ironic /etc/httpd /etc/httpd
|
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /var/log
|
2024-11-12 19:44:52 +01:00
|
|
|
chmod 2775 /etc/ironic /etc/httpd/conf /etc/httpd/conf.d
|
|
|
|
chmod 664 /etc/ironic/* /etc/httpd/conf/* /etc/httpd/conf.d/*
|
2024-10-21 14:18:05 +02:00
|
|
|
|
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /var/lib/ironic
|
2024-11-12 19:44:52 +01:00
|
|
|
chmod 664 /var/lib/ironic/ironic.sqlite
|
2024-10-21 14:18:05 +02:00
|
|
|
|
|
|
|
# dnsmasq, and the capabilities required to run it as non-root user
|
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /etc/dnsmasq.conf /var/lib/dnsmasq
|
|
|
|
chmod 2775 /var/lib/dnsmasq
|
|
|
|
touch /var/lib/dnsmasq/dnsmasq.leases
|
|
|
|
chmod 664 /etc/dnsmasq.conf /var/lib/dnsmasq/dnsmasq.leases
|
|
|
|
|
|
|
|
# ca-certificates permission changes
|
|
|
|
touch /var/lib/ca-certificates/ca-bundle.pem.new
|
|
|
|
chown -R "${NONROOT_UID}":"${NONROOT_GID}" /var/lib/ca-certificates/
|
|
|
|
chmod -R +w /var/lib/ca-certificates/
|
2024-11-12 19:44:52 +01:00
|
|
|
|
|
|
|
# probes that are created before start
|
|
|
|
touch /bin/ironic-{readi,live}ness
|
|
|
|
chown root:"${NONROOT_GID}" /bin/ironic-{readi,live}ness
|
|
|
|
chmod 775 /bin/ironic-{readi,live}ness
|