GUACAMOLE-1082: Merge add guacamole-auth-cas to Docker script

This commit is contained in:
Virtually Nick
2020-07-29 08:10:48 -04:00
committed by GitHub
2 changed files with 53 additions and 0 deletions

View File

@@ -168,3 +168,19 @@ if [ -f extensions/guacamole-auth-header/target/guacamole-auth-header*.jar ]; th
mkdir -p "$DESTINATION/header"
cp extensions/guacamole-auth-header/target/guacamole-auth-header*.jar "$DESTINATION/header"
fi
#
# Copy CAS auth extension if it was built
#
if [ -f extensions/guacamole-auth-cas/target/*.tar.gz ]; then
mkdir -p "$DESTINATION/cas"
tar -xzf extensions/guacamole-auth-cas/target/*.tar.gz \
-C "$DESTINATION/cas/" \
--wildcards \
--no-anchored \
--no-wildcards-match-slash \
--strip-components=1 \
"*.jar"
fi

View File

@@ -652,6 +652,38 @@ associate_header() {
ln -s /opt/guacamole/header/guacamole-auth-*.jar "$GUACAMOLE_EXT"
}
##
## Adds properties to guacamole.properties witch configure the CAS
## authentication service.
##
associate_cas() {
# Verify required parameters are present
if [ -z "$CAS_AUTHORIZATION_ENDPOINT" ] || \
[ -z "$CAS_REDIRECT_URI" ]
then
cat <<END
FATAL: Missing required environment variables
-----------------------------------------------------------------------------------
If using the CAS authentication extension, you must provide each of the
following environment variables:
CAS_AUTHORIZATION_ENDPOINT The URL of the CAS authentication server.
CAS_REDIRECT_URI The URI to redirect back to upon successful authentication.
END
exit 1;
fi
# Update config file
set_property "cas-authorization-endpoint" "$CAS_AUTHORIZATION_ENDPOINT"
set_property "cas-redirect-uri" "$CAS_REDIRECT_URI"
set_optional_property "cas-clearpass-key" "$CAS_CLEARPASS_KEY"
# Add required .jar files to GUACAMOLE_EXT
ln -s /opt/guacamole/cas/guacamole-auth-*.jar "$GUACAMOLE_EXT"
}
##
## Starts Guacamole under Tomcat, replacing the current process with the
## Tomcat process. As the current process will be replaced, this MUST be the
@@ -799,6 +831,11 @@ if [ "$HEADER_ENABLED" = "true" ]; then
associate_header
fi
# Use CAS if specified.
if [ -n "$CAS_AUTHORIZATION_ENDPOINT" ]; then
associate_cas
fi
# Set logback level if specified
if [ -n "$LOGBACK_LEVEL" ]; then
unzip -o -j /opt/guacamole/guacamole.war WEB-INF/classes/logback.xml -d $GUACAMOLE_HOME