File tree Expand file tree Collapse file tree 3 files changed +23
-17
lines changed
Expand file tree Collapse file tree 3 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,29 @@ COPY Containerfile /
8787# up in the worst case. The other timing parameters are set so that it
8888# takes at most a minute to realize that PuppetDB has failed.
8989# Probe failure during --start-period will not be counted towards the maximum number of retries
90+
91+ # mirror user permissions to group, set group to root, and set gid bit on dirs
92+ RUN for d in \
93+ /etc/puppetlabs \
94+ /var/log/puppetlabs \
95+ /var/run/puppetlabs \
96+ /opt/puppetlabs/ \
97+ ; do \
98+ mkdir -p "$d" ; \
99+ chgrp -R 0 "$d" ; \
100+ chmod -R g=u "$d" ; \
101+ find "$d" -type d -exec chmod g+s {} +; \
102+ done
103+
104+ # the startup script has a check if the current user is puppetdb, this won't work with arbitrary UIDs
105+ # we can workaround the check by not setting a USER
106+ RUN sed -i 's/^USER="puppetdb"/USER=""/' /etc/default/puppetdb
107+ USER puppetdb:0
108+
109+ # the foreground script that starts puppetdb tries to install a restartfile with a certain user.
110+ # we don't need it in a container and it also is incompatible with arbitrary UIDs
111+ RUN sed -i 's/^init_restart_file/#init_restart_file/' /opt/puppetlabs/server/apps/puppetdb/cli/apps/foreground
112+
90113# NOTE: k8s uses livenessProbe, startupProbe, readinessProbe and ignores HEALTHCHECK
91114HEALTHCHECK --start-period=5m --interval=10s --timeout=10s --retries=6 CMD ["/healthcheck.sh" ]
92115
Original file line number Diff line number Diff line change @@ -10,9 +10,3 @@ if [ "$USE_OPENVOXSERVER" = true ]; then
1010 # enable SSL in Jetty
1111 sed -i ' /^# ssl-/s/^# //g' /etc/puppetlabs/puppetdb/conf.d/jetty.ini
1212fi
13-
14- if [ -w " $SSLDIR " ] && [ " $( id -un) " = " root" ]; then
15- # make sure Java apps running as puppetdb can read these files
16- echo " Setting ownership for $SSLDIR to puppetdb:puppetdb"
17- chown -R puppetdb:puppetdb ${SSLDIR}
18- fi
Original file line number Diff line number Diff line change @@ -152,14 +152,6 @@ ca_running() {
152152 httpsreq_insecure " $( get " ${CA} /certificate/ca" ) " > /dev/null
153153}
154154
155- set_file_perms () {
156- msg " Securing permissions on ${SSLDIR} "
157-
158- # 700 for directories, 600 for files
159- find " ${SSLDIR} /." -type d -exec chmod u=rwx,g=,o= -- {} +
160- find " ${SSLDIR} /." -type f -exec chmod u=rw,g=,o= -- {} +
161- }
162-
163155# ## Verify we got a signed certificate
164156verify_cert () {
165157 if [ -f " ${CERTFILE} " ] && [ " $( head -1 " ${CERTFILE} " ) " = " ${CERTHEADER} " ]; then
@@ -260,7 +252,6 @@ msg "* WAITFORCERT: '${WAITFORCERT}' seconds"
260252certnames=$( cd " ${PRIVKEYDIR} " && ls -A -m -- * .pem 2> /dev/null)
261253if [ -s " ${CERTFILE} " ]; then
262254 msg " Certificates (${certnames} ) have already been generated - exiting!"
263- set_file_perms
264255 exit 0
265256# warn when rekeying an existing host as it's typically user error
266257elif [ -n " ${certnames} " ]; then
@@ -373,6 +364,4 @@ if ! cert=$(retry_httpsreq "$CERTREQ" $((WAITFORCERT)) 10); then
373364fi
374365printf " %s\n" " ${cert} " > " ${CERTFILE} "
375366
376- set_file_perms
377-
378367verify_cert
You can’t perform that action at this time.
0 commit comments