From 0f31028565a539c25a9a67d72b4901db024506e1 Mon Sep 17 00:00:00 2001 From: Joern Lentes Date: Fri, 21 Dec 2018 11:15:25 +0100 Subject: [PATCH 1/5] GUACAMOLE-682: add option to include RADIUS authentication in docker To include library for RADIUS authentication in the docker image the build needs to activate the maven profile "lgpl-extentions" and copy the library into the image. The docker start script needs to pass through settings and link the library to GUACAMOLE_HOME. --- guacamole-docker/bin/build-guacamole.sh | 15 +++- guacamole-docker/bin/start.sh | 96 +++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/guacamole-docker/bin/build-guacamole.sh b/guacamole-docker/bin/build-guacamole.sh index 79115df41..1f4ab7798 100755 --- a/guacamole-docker/bin/build-guacamole.sh +++ b/guacamole-docker/bin/build-guacamole.sh @@ -53,7 +53,12 @@ mkdir -p "$DESTINATION" # cd "$BUILD_DIR" -mvn package + +if [ -z "$BUILD_PROFILE" ]; then + mvn package +else + mvn -P "$BUILD_PROFILE" package +fi # # Copy guacamole.war to destination @@ -107,3 +112,11 @@ tar -xzf extensions/guacamole-auth-ldap/target/*.tar.gz \ "*.jar" \ "*.ldif" +# +# Copy Radius auth extension if it was build +# + +if [[ "$BUILD_PROFILE ~= "lgpl-extentions" ]]; then + mkdir -p "$DESTINATION/radius" + cp extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar "$DESTINATION/radius" +fi diff --git a/guacamole-docker/bin/start.sh b/guacamole-docker/bin/start.sh index 1fbcc8581..8fb3bc108 100755 --- a/guacamole-docker/bin/start.sh +++ b/guacamole-docker/bin/start.sh @@ -322,6 +322,88 @@ END } +## +## Adds properties to guacamole.properties which select the LDAP +## authentication provider, and configure it to connect to the specified LDAP +## directory. +## +associate_radius() { + + # Verify required parameters are present + if [ -z "$RADIUS_SHARED_SECRET" -o -z "$RADIUS_AUTH_PROTOCOL" ]; then + cat < Date: Fri, 21 Dec 2018 14:50:46 +0100 Subject: [PATCH 2/5] GUACAMOLE-682: fix env variable passing --- Dockerfile | 4 +++- guacamole-docker/bin/build-guacamole.sh | 3 ++- guacamole-docker/bin/start.sh | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7eefcc809..8c12c750b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,8 @@ ARG TOMCAT_JRE=jre8 # Use official maven image for the build FROM maven:3-jdk-8 AS builder +ARG BUILD_PROFILE + # Build environment variables ENV \ BUILD_DIR=/tmp/guacamole-docker-BUILD @@ -41,7 +43,7 @@ COPY guacamole-docker/bin/ /opt/guacamole/bin/ COPY . "$BUILD_DIR" # Run the build itself -RUN /opt/guacamole/bin/build-guacamole.sh "$BUILD_DIR" /opt/guacamole +RUN /opt/guacamole/bin/build-guacamole.sh "$BUILD_DIR" /opt/guacamole "$BUILD_PROFILE" # For the runtime image, we start with the official Tomcat distribution FROM tomcat:${TOMCAT_VERSION}-${TOMCAT_JRE} diff --git a/guacamole-docker/bin/build-guacamole.sh b/guacamole-docker/bin/build-guacamole.sh index 1f4ab7798..acb1d3f21 100755 --- a/guacamole-docker/bin/build-guacamole.sh +++ b/guacamole-docker/bin/build-guacamole.sh @@ -41,6 +41,7 @@ BUILD_DIR="$1" DESTINATION="$2" +BUILD_PROFILE="$3" # # Create destination, if it does not yet exist @@ -116,7 +117,7 @@ tar -xzf extensions/guacamole-auth-ldap/target/*.tar.gz \ # Copy Radius auth extension if it was build # -if [[ "$BUILD_PROFILE ~= "lgpl-extentions" ]]; then +if [ -f extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar ]; then mkdir -p "$DESTINATION/radius" cp extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar "$DESTINATION/radius" fi diff --git a/guacamole-docker/bin/start.sh b/guacamole-docker/bin/start.sh index 8fb3bc108..0732283a7 100755 --- a/guacamole-docker/bin/start.sh +++ b/guacamole-docker/bin/start.sh @@ -370,7 +370,7 @@ make sure they are readable for the user in the container. END exit 1; fi - if [ $RADIUS_AUTH_PROTOCOL == "eap-ttls" -a -z "$RADIUS_EAP_TTLS_INNER_PROTOCOL" ]; then + if [ "$RADIUS_AUTH_PROTOCOL" == "eap-ttls" -a -z "$RADIUS_EAP_TTLS_INNER_PROTOCOL" ]; then cat < Date: Fri, 21 Dec 2018 15:04:28 +0100 Subject: [PATCH 3/5] GUACAMOLE-682: added comment with example to build with RADIUS --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8c12c750b..0943dc3bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,8 @@ ARG TOMCAT_JRE=jre8 # Use official maven image for the build FROM maven:3-jdk-8 AS builder +# Use args to build radius auth extension such as +# `--build-arg BUILD_PROFILE=lgpl-extensions` ARG BUILD_PROFILE # Build environment variables From 516dbfd5c7f8eca91c93f63b81bb5773d4a21d08 Mon Sep 17 00:00:00 2001 From: Joern Lentes Date: Sat, 22 Dec 2018 09:58:27 +0100 Subject: [PATCH 4/5] GUACAMOLE-682: adapted indent to be consistent --- guacamole-docker/bin/build-guacamole.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guacamole-docker/bin/build-guacamole.sh b/guacamole-docker/bin/build-guacamole.sh index acb1d3f21..c0c75974a 100755 --- a/guacamole-docker/bin/build-guacamole.sh +++ b/guacamole-docker/bin/build-guacamole.sh @@ -56,9 +56,9 @@ mkdir -p "$DESTINATION" cd "$BUILD_DIR" if [ -z "$BUILD_PROFILE" ]; then - mvn package + mvn package else - mvn -P "$BUILD_PROFILE" package + mvn -P "$BUILD_PROFILE" package fi # @@ -118,6 +118,6 @@ tar -xzf extensions/guacamole-auth-ldap/target/*.tar.gz \ # if [ -f extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar ]; then - mkdir -p "$DESTINATION/radius" - cp extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar "$DESTINATION/radius" + mkdir -p "$DESTINATION/radius" + cp extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar "$DESTINATION/radius" fi From 5fb537b707a3797113ed8233155e12bde4dbd64c Mon Sep 17 00:00:00 2001 From: Joern Lentes Date: Sun, 23 Dec 2018 22:09:55 +0100 Subject: [PATCH 5/5] GUACAMOLE-682: added parameter documentation --- guacamole-docker/bin/build-guacamole.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guacamole-docker/bin/build-guacamole.sh b/guacamole-docker/bin/build-guacamole.sh index c0c75974a..f72fb673d 100755 --- a/guacamole-docker/bin/build-guacamole.sh +++ b/guacamole-docker/bin/build-guacamole.sh @@ -38,6 +38,11 @@ ## subdirectories within this directory, and files will thus be grouped by ## extension type. ## +## @param BUILD_PROFILE +## The build profile that will be passed to Maven build process. Defaults +## to empty string. Can be set to "lgpl-extensions" to e.g. include +## RADIUS authentication extension. +## BUILD_DIR="$1" DESTINATION="$2"