Skip to content

Commit

Permalink
fix guacd permissions on extensions and enhance pid tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWaldorf committed Jul 29, 2024
1 parent 53030cb commit 244da65
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,10 @@ ENV TZ=UTC
# Copy build artifacts into this stage
COPY --from=builder ${PREFIX_DIR} ${PREFIX_DIR}

# Add user guacd
RUN groupadd guacd && \
useradd -s /bin/false -g guacd guacd

# Set working DIR
RUN mkdir -p /config
RUN mkdir -p ${GUACAMOLE_HOME}/extensions ${GUACAMOLE_HOME}/extensions-available ${GUACAMOLE_HOME}/lib
RUN mkdir /docker-entrypoint-initdb.d
RUN chown guacd:guacd -R ${PREFIX_DIR}
RUN chown guacd:guacd -R ${GUACAMOLE_HOME}
WORKDIR ${GUACAMOLE_HOME}

# Bring runtime environment up to date and install runtime dependencies
Expand All @@ -230,6 +224,12 @@ RUN apk add --no-cache \

RUN apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing gosu

# Add user guacd
RUN groupadd guacd && \
useradd -s /bin/false -g guacd guacd
RUN chown guacd:guacd -R ${PREFIX_DIR}
RUN chown guacd:guacd -R ${GUACAMOLE_HOME}

# Install tomcat
RUN mkdir ${CATALINA_HOME}
ADD https://dlcdn.apache.org/tomcat/tomcat-9/v${TOMCAT_VER}/bin/apache-tomcat-${TOMCAT_VER}.tar.gz /tmp/
Expand Down Expand Up @@ -306,6 +306,7 @@ ENV PATH=/usr/lib/postgresql/${PG_MAJOR}/bin:$PATH
ENV GUACAMOLE_HOME=/config/guacamole
ENV CATALINA_PID=${CATALINA_HOME}/tomcat.pid
ENV POSTGRES_PID=/config/postgresql/postmaster.pid
ENV GUACD_PID=/config/guacamole/guacd.pid

# Copy files
COPY filefs /
Expand Down
2 changes: 2 additions & 0 deletions filefs/etc/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
nodaemon=true
user=root
loglevel = info
pidfile = /tmp/supervisord.pid
logfile = /tmp/supervisord.log

[program:postgresql]
command=/scripts/postgres/wrapper_supervisor.sh
Expand Down
2 changes: 1 addition & 1 deletion filefs/usr/local/bin/_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ fi

# enable extensions
for i in $(echo "$EXTENSIONS" | tr "," " "); do
cp ${GUACAMOLE_HOME}/extensions-available/guacamole-${i}-${GUAC_VER}.jar ${GUACAMOLE_HOME}/extensions
cp -p ${GUACAMOLE_HOME}/extensions-available/guacamole-${i}-${GUAC_VER}.jar ${GUACAMOLE_HOME}/extensions
done
6 changes: 3 additions & 3 deletions scripts/guacd/wrapper_supervisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ function shutdown()
date
echo "Starting Guacd"

/opt/guacamole/sbin/guacd -b 0.0.0.0 -L $GUACD_LOG_LEVEL -f
/opt/guacamole/sbin/guacd -b 0.0.0.0 -L $GUACD_LOG_LEVEL -p /config/guacamole/guacd.pid -f

sleep 5

# Allow any signal which would kill a process to stop GUACD
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP SIGTERM SIGINT

echo "Waiting for `pgrep -f guacd`"
wait `pgrep -f guacd`
echo "Waiting for `cat $GUACD_PID`"
wait `cat $GUACD_PID`

0 comments on commit 244da65

Please sign in to comment.