diff --git a/Dockerfile b/Dockerfile index 7eefcc809..0943dc3bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,10 @@ 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 ENV \ BUILD_DIR=/tmp/guacamole-docker-BUILD @@ -41,7 +45,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 79115df41..f72fb673d 100755 --- a/guacamole-docker/bin/build-guacamole.sh +++ b/guacamole-docker/bin/build-guacamole.sh @@ -38,9 +38,15 @@ ## 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" +BUILD_PROFILE="$3" # # Create destination, if it does not yet exist @@ -53,7 +59,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 +118,11 @@ tar -xzf extensions/guacamole-auth-ldap/target/*.tar.gz \ "*.jar" \ "*.ldif" +# +# Copy Radius auth extension if it was build +# + +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 1fbcc8581..0732283a7 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 <