#!/bin/sh -e # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ## ## @fn start.sh ## ## Automatically configures and starts Guacamole under Tomcat. Guacamole's ## guacamole.properties file will be automatically generated based on the ## linked database container (either MySQL or PostgreSQL) and the linked guacd ## container. The Tomcat process will ultimately replace the process of this ## script, running in the foreground until terminated. ## GUACAMOLE_HOME_TEMPLATE="$GUACAMOLE_HOME" GUACAMOLE_HOME="$HOME/.guacamole" GUACAMOLE_EXT="$GUACAMOLE_HOME/extensions" GUACAMOLE_LIB="$GUACAMOLE_HOME/lib" GUACAMOLE_PROPERTIES="$GUACAMOLE_HOME/guacamole.properties" ## ## Sets the given property to the given value within guacamole.properties, ## creating guacamole.properties first if necessary. ## ## @param NAME ## The name of the property to set. ## ## @param VALUE ## The value to set the property to. ## set_property() { NAME="$1" VALUE="$2" # Ensure guacamole.properties exists if [ ! -e "$GUACAMOLE_PROPERTIES" ]; then mkdir -p "$GUACAMOLE_HOME" echo "# guacamole.properties - generated `date`" > "$GUACAMOLE_PROPERTIES" fi # Set property echo "$NAME: $VALUE" >> "$GUACAMOLE_PROPERTIES" } ## ## Sets the given property to the given value within guacamole.properties only ## if a value is provided, creating guacamole.properties first if necessary. ## ## @param NAME ## The name of the property to set. ## ## @param VALUE ## The value to set the property to, if any. If omitted or empty, the ## property will not be set. ## set_optional_property() { NAME="$1" VALUE="$2" # Set the property only if a value is provided if [ -n "$VALUE" ]; then set_property "$NAME" "$VALUE" fi } # Print error message regarding missing required variables for MySQL authentication mysql_missing_vars() { cat <= 40 characters. ## associate_duo() { # Verify required parameters are present if [ -z "$DUO_INTEGRATION_KEY" ] || \ [ -z "$DUO_SECRET_KEY" ] || \ [ ${#DUO_APPLICATION_KEY} -lt 40 ] then cat <