From fd4fb2e442a39d7c78127857fdd625e18e0a16ca Mon Sep 17 00:00:00 2001 From: Itiligent <94789708+itiligent@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:12:08 +1000 Subject: [PATCH] rebase 1.5.3.2 rebase 1.5.3 Rebase 1.5.3.1 --- 1-setup.sh | 829 ++++++++++++++++++ 2-install-guacamole.sh | 660 ++++++++++++++ 3-install-nginx.sh | 130 +++ 4a-install-tls-self-signed-nginx.sh | 270 ++++++ 4b-install-tls-letsencrypt-nginx.sh | 146 +++ ACTIVE-DIRECTORY-HOW-TO.md | 101 +++ LICENSE | 662 ++++++++++++++ README.md | 118 +++ branding.jar | Bin 0 -> 19175 bytes .../META-INF/MANIFEST.MF | 8 + guac-custom-theme-builder/README.MD | 23 + .../css/custom-theme.css | 245 ++++++ guac-custom-theme-builder/guac-manifest.json | 22 + guac-custom-theme-builder/images/logo-144.png | Bin 0 -> 5342 bytes guac-custom-theme-builder/images/logo-64.png | Bin 0 -> 1927 bytes guac-custom-theme-builder/images/logo.png | Bin 0 -> 10191 bytes .../translations/en.json | 8 + .../install-mysql-backend-only.sh | 366 ++++++++ .../upgrade-mysql-backend-only.sh | 138 +++ guac-management/backup-guac.sh | 66 ++ guac-management/refresh-tls-self-signed.sh | 179 ++++ guac-management/upgrade-guac.sh | 350 ++++++++ guac-management/useful-config-info.txt | 92 ++ guac-optional-features/add-auth-duo.sh | 60 ++ guac-optional-features/add-auth-ldap.sh | 77 ++ guac-optional-features/add-auth-totp.sh | 46 + guac-optional-features/add-fail2ban.sh | 265 ++++++ guac-optional-features/add-smtp-relay-o365.sh | 127 +++ guac-optional-features/add-tls-guac-daemon.sh | 104 +++ .../add-xtra-histrecstor.sh | 66 ++ .../add-xtra-quickconnect.sh | 47 + 31 files changed, 5205 insertions(+) create mode 100644 1-setup.sh create mode 100644 2-install-guacamole.sh create mode 100644 3-install-nginx.sh create mode 100644 4a-install-tls-self-signed-nginx.sh create mode 100644 4b-install-tls-letsencrypt-nginx.sh create mode 100644 ACTIVE-DIRECTORY-HOW-TO.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 branding.jar create mode 100644 guac-custom-theme-builder/META-INF/MANIFEST.MF create mode 100644 guac-custom-theme-builder/README.MD create mode 100644 guac-custom-theme-builder/css/custom-theme.css create mode 100644 guac-custom-theme-builder/guac-manifest.json create mode 100644 guac-custom-theme-builder/images/logo-144.png create mode 100644 guac-custom-theme-builder/images/logo-64.png create mode 100644 guac-custom-theme-builder/images/logo.png create mode 100644 guac-custom-theme-builder/translations/en.json create mode 100644 guac-enterprise-build/install-mysql-backend-only.sh create mode 100644 guac-enterprise-build/upgrade-mysql-backend-only.sh create mode 100644 guac-management/backup-guac.sh create mode 100644 guac-management/refresh-tls-self-signed.sh create mode 100644 guac-management/upgrade-guac.sh create mode 100644 guac-management/useful-config-info.txt create mode 100644 guac-optional-features/add-auth-duo.sh create mode 100644 guac-optional-features/add-auth-ldap.sh create mode 100644 guac-optional-features/add-auth-totp.sh create mode 100644 guac-optional-features/add-fail2ban.sh create mode 100644 guac-optional-features/add-smtp-relay-o365.sh create mode 100644 guac-optional-features/add-tls-guac-daemon.sh create mode 100644 guac-optional-features/add-xtra-histrecstor.sh create mode 100644 guac-optional-features/add-xtra-quickconnect.sh diff --git a/1-setup.sh b/1-setup.sh new file mode 100644 index 0000000..1401077 --- /dev/null +++ b/1-setup.sh @@ -0,0 +1,829 @@ +#!/bin/bash +###################################################################################################################### +# Guacamole appliance setup script +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# To install the latest code snapshot: +# wget https://raw.githubusercontent.com/itiligent/Guacamole-Install/main/1-setup.sh && chmod +x 1-setup.sh && ./1-setup.sh + +# 1-setup.sh is a central script that manages all inputs, options and sequences other included 'install' scripts. +# 2-install-guacamole is the main guts of the whole build. This script downloads and builds Guacamole from source. +# 3-install-nginx.sh automatically installs and configures Nginx to work as an http port 80 front end to Guacamole +# 4a-install-tls-self-signed-nginx.sh sets up the new Nginx/Guacamole front end with self signed TLS certificates. +# 4b-install-tls-letsencrypt-nginx.sh sets up Nginx with public TLS certificates from LetsEncrypt. +# Scripts with "add" in their name can be run post install to add optional features not included in the main install + +# If something isn't working: +# tail -f /var/log/syslog /var/log/tomcat*/*.out guac-setup/guacamole_setup.log +# Or for Guacamole debug mode & verbose logs in the console: +# sudo systemctl stop guacd && sudo /usr/local/sbin/guacd -L debug -f + +####################################################################################################################### +# Script pre-flight checks and settings ############################################################################### +####################################################################################################################### + +clear + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Make sure the user is NOT running this script as root +if [[ $EUID -eq 0 ]]; then + echo + echo -e "${LRED}This script must NOT be run as root, exiting..." 1>&2 + echo -e ${NC} + exit 1 +fi + +# Make sure the user is a member of the sudo group +if ! [[ $(id -nG "$USER" 2>/dev/null | egrep "sudo" | wc -l) -gt 0 ]]; then + echo + echo -e "${LRED}The current user (${USER}) must be a member of the 'sudo' group, exiting..." 1>&2 + echo -e ${NC} + exit 1 +fi + +# Check to see if any previous version of build/install files exist, if so stop and check to be safe. +if [[ "$(find . -maxdepth 1 \( -name 'guacamole-*' -o -name 'mysql-connector-j-*' \))" != "" ]]; then + echo + echo -e "${LRED}Possible previous install files detected in current build path. Please review and remove old guacamole install files before proceeding.${GREY}" 1>&2 + echo + exit 1 +fi + +####################################################################################################################### +# Core setup variables and mandatory inputs - EDIT VARIABLE VALUES TO SUIT ############################################ +####################################################################################################################### + +# Setup download and temp directory paths +USER_HOME_DIR=$(eval echo ~${SUDO_USER}) +DOWNLOAD_DIR=$USER_HOME_DIR/guac-setup +DB_BACKUP_DIR=$USER_HOME_DIR/mysqlbackups +mkdir -p $DOWNLOAD_DIR +mkdir -p $DB_BACKUP_DIR + +# GitHub download branch +GITHUB="https://raw.githubusercontent.com/itiligent/Guacamole-Install/main" + +# Version of Guacamole to install +GUAC_VERSION="1.5.3" + +# MySQL Connector/J version to install +MYSQLJCON="8.1.0" + +# Set preferred Apache CDN download link +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" + +# See https://mariadb.org/mariadb/all-releases/ for available versions. +# Provide a specific MySQL version e.g. 11.1.2 or leave blank to use distro default MySQL packages. +MYSQL_VERSION="" + +# Guacamole default install URL +GUAC_URL=http://localhost:8080/guacamole/ + +# Get the default route interface IP. Manually update for multi homed systems. +DEFAULT_IP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) + +# Install log Location +INSTALL_LOG="${DOWNLOAD_DIR}/guacamole_setup.log" + +####################################################################################################################### +# Silent setup options - true/false or specific values below prevents prompt at install. EDIT TO SUIT ################# +####################################################################################################################### +SERVER_NAME="" # Preferred server hostname +LOCAL_DOMAIN="" # Local DNS space in use +INSTALL_MYSQL="" # Install locally (true/false) +SECURE_MYSQL="" # Apply mysql secure configuration tool (true/false) +MYSQL_HOST="" # Blank or localhost for a local MySQL install, a specific IP for remote MySQL option. +MYSQL_PORT="" # If blank default is 3306 +GUAC_DB="" # If blank default is guacamole_db +GUAC_USER="" # If blank default is guacamole_user +MYSQL_ROOT_PWD="" # Requires an entry here or at script prompt. +GUAC_PWD="" # Requires an entry here or at script prompt. +DB_TZ=$(cat /etc/timezone) # MySQL timezone default=(cat /etc/timezone) or change to "UTC" if required. +INSTALL_TOTP="" # Add TOTP MFA extension (true/false) +INSTALL_DUO="" # Add DUO MFA extension (can't be installed simultaneously with TOTP, true/false) +INSTALL_LDAP="" # Add Active Directory extension (true/false) +INSTALL_QCONNECT="" # Add Guacamole console quick connect feature +INSTALL_HISTREC="" # Add Guacamole history recording storage feature +HISTREC_PATH="" # If blank sets Apache default /var/lib/guacamole/recordings +GUAC_URL_REDIR="" # Redirect default Guacamole URL to http root (skip typing the extra "/guacamole" in the URL) +INSTALL_NGINX="" # Install and configure Nginx as a Guacamole reverse proxy (http port 80 only, true/false) +PROXY_SITE="" # Local DNS name for reverse proxy and/or self signed TLS certificates +SELF_SIGN="" # Add self signed TLS support to Nginx (Let's Encrypt not available with this option, true/false) +RSA_KEYLENGTH="2048" # Self signed RSA TLS key length. At least 2048, must not be blank. +CERT_COUNTRY="AU" # Self signed cert setup, 2 character country code only, must not be blank. +CERT_STATE="Victoria" # Self signed cert setup, must not be blank +CERT_LOCATION="Melbourne" # Self signed cert setup, must not be blank +CERT_ORG="Itiligent" # Self signed cert setup, must not be blank +CERT_OU="I.T." # Self signed cert setup, must not be blank +CERT_DAYS="3650" # Self signed cert setup, Number of days until self signed certificate expiry +LETS_ENCRYPT="" # Add Lets Encrypt public TLS cert for Nginx (self signed not available with this option) true/false) +LE_DNS_NAME="" # Public DNS name to bind with Lets Encrypt certificates +LE_EMAIL="" # Webmaster/admin email for Lets Encrypt notifications +BACKUP_EMAIL="" # Email address for backup notifications +BACKUP_RETENTION="30" # How many days to keep SQL backups locally for +RDP_SHARE_HOST="" # Customise Windows RDP share host name. (e.g. RDP_SHARE_LABEL on RDP_SHARE_HOST) +RDP_SHARE_LABEL="RDP Share" # Customise Windows RDP share drive label (e.g. RDP_SHARE_LABEL on RDP_SHARE_HOST) +RDP_PRINTER_LABEL="RDP Printer" # Customise Windows RDP printer label + +####################################################################################################################### +# Download GitHub setup scripts. BEFORE RUNNING SETUP, COMMENT DOWNLOAD LINES OF SCRIPTS YOU HAVE EDITED ! ############ +####################################################################################################################### + +# Script branding header +echo +echo -e "${GREYB}Guacamole ${GUAC_VERSION} Auto Installer." +echo -e " ${LGREEN}Powered by Itiligent" +echo +echo + +# Download the set of config scripts from GitHub +cd $DOWNLOAD_DIR +echo -e "${GREY}Downloading the Guacamole build suite...${DGREY}" +wget -q --show-progress ${GITHUB}/2-install-guacamole.sh -O 2-install-guacamole.sh +wget -q --show-progress ${GITHUB}/3-install-nginx.sh -O 3-install-nginx.sh +wget -q --show-progress ${GITHUB}/4a-install-tls-self-signed-nginx.sh -O 4a-install-tls-self-signed-nginx.sh +wget -q --show-progress ${GITHUB}/4b-install-tls-letsencrypt-nginx.sh -O 4b-install-tls-letsencrypt-nginx.sh + +# Download the Guacamole optional feature scripts +wget -q --show-progress ${GITHUB}/guac-optional-features/add-auth-duo.sh -O add-auth-duo.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-auth-ldap.sh -O add-auth-ldap.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-auth-totp.sh -O add-auth-totp.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-xtra-quickconnect.sh -O add-xtra-quickconnect.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-xtra-histrecstor.sh -O add-xtra-histrecstor.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-smtp-relay-o365.sh -O add-smtp-relay-o365.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-tls-guac-daemon.sh -O add-tls-guac-daemon.sh +wget -q --show-progress ${GITHUB}/guac-optional-features/add-fail2ban.sh -O add-fail2ban.sh +wget -q --show-progress ${GITHUB}/guac-management/backup-guac.sh -O backup-guac.sh +wget -q --show-progress ${GITHUB}/guac-management/upgrade-guac.sh -O upgrade-guac.sh +# wget -q --show-progress ${GITHUB}/guac-management/refresh-tls-self-signed.sh -O refresh-tls-self-signed.sh +# refresh-tls-self-signed.sh is now functionally duplicated by the 4a-install-tls-self-signed-nginx.sh. Keeping it here for later conversion into a script for HA Proxy TLS options + +# Download the (customisable) dark theme & branding template +wget -q --show-progress ${GITHUB}/branding.jar -O branding.jar +chmod +x *.sh + +# Pause here to optionally customise downloaded scripts before any actual install actions have began +echo -e "${LYELLOW}Ctrl+Z now to exit now if you wish to customise 1-setup.sh options or to setup an unattended install." +echo + +# Trigger the above pause with a sudo prompt, this also doubles as where we grab admin credentials for the next installer steps +sudo apt-get update -qq >/dev/null + +####################################################################################################################### +# Logic for determining package dependencies between distros & database options. MODIFY ONLY IF NEEDED ################ +####################################################################################################################### + +# Standardise the language used for distro versions +source /etc/os-release +OS_NAME=$ID +OS_VERSION=$VERSION_ID +OS_CODENAME=$VERSION_CODENAME + +# Check for the latest version of Tomcat currently supported by the distro +if [[ $(apt-cache show tomcat10 2>/dev/null | egrep "Version: 10" | wc -l) -gt 0 ]]; then + TOMCAT_VERSION="tomcat10" +elif [[ $(apt-cache show tomcat9 2>/dev/null | egrep "Version: 9" | wc -l) -gt 0 ]]; then + TOMCAT_VERSION="tomcat9" +elif [[ $(apt-cache show tomcat8 2>/dev/null | egrep "Version: 8.[5-9]" | wc -l) -gt 0 ]]; then + TOMCAT_VERSION="tomcat8" +else + # Default to version + TOMCAT_VERSION="tomcat9" +fi + +# Workaround for current Debian 12 & Tomcat 10 incompatibilities +if [[ ${OS_NAME,,} = "debian" ]] && [[ ${OS_CODENAME,,} = *"bookworm"* ]]; then #(checks for upper and lower case) + # Add the oldstable repo and downgrade tomcat version install + echo "deb http://deb.debian.org/debian/ bullseye main" | sudo tee /etc/apt/sources.list.d/bullseye.list >/dev/null + sudo apt-get update -qq >/dev/null + TOMCAT_VERSION="tomcat9" +fi + +# Workaround for Ubuntu 23.x & Tomcat 10 incompatibilities +if [[ ${OS_NAME,,} = "ubuntu" ]] && [[ ${OS_CODENAME,,} = *"lunar"* ]]; then #(checks for upper and lower case) + TOMCAT_VERSION="tomcat9" + sudo apt-mark hold $TOMCAT_VERSION +fi + +# Uncomment here to force a specific Tomcat version. +# TOMCAT_VERSION="tomcat9" + +# Standardise language for the the install of MySQL packages +if [[ -z "${MYSQL_VERSION}" ]]; then + # Use Linux distro default version. + MYSQLSRV="default-mysql-server default-mysql-client mysql-common" # Server + MYSQLCLIENT="default-mysql-client" # Client + DB_CMD="mysql" # The mysql command is depricated on some versions, option to substitute another. +else + # Use official mariadb.org repo + MYSQLSRV="mariadb-server mariadb-client mariadb-common" # Server + MYSQLCLIENT="mariadb-client" # Client + DB_CMD="mariadb" # The mysql command is depricated on some versions, option to substitute another. +fi +# Standardise differing dependency package names and add any extra distro repositories for these if needed +# Current package names for various distros are referenced at https://guacamole.apache.org/doc/gug/installing-guacamole.html +JPEGTURBO="" +LIBPNG="" +if [[ $OS_NAME == "ubuntu" ]] || [[ $OS_NAME == *"ubuntu"* ]]; then # potentially expand out distro choices here + JPEGTURBO="libjpeg-turbo8-dev" + LIBPNG="libpng-dev" + # Just in case this repo is not added by default in the distro + sudo add-apt-repository -y universe &>>${INSTALL_LOG} +elif [[ $OS_NAME == "debian" ]] || [[ $OS_NAME == "raspbian" ]]; then # expand distro choices here if required + JPEGTURBO="libjpeg62-turbo-dev" + LIBPNG="libpng-dev" +fi + +####################################################################################################################### +# DO NOT EDIT PAST THIS POINT! ######################################################################################## +####################################################################################################################### + +# A default dns suffix is needed for initial prompts & default starting values. +get_domain_suffix() { + echo "$1" | awk '{print $2}' +} +# Search for "search" and "domain" entries in /etc/resolv.conf +search_line=$(grep -E '^search[[:space:]]+' /etc/resolv.conf) +domain_line=$(grep -E '^domain[[:space:]]+' /etc/resolv.conf) +# Check if both "search" and "domain" lines exist +if [[ -n "$search_line" ]] && [[ -n "$domain_line" ]]; then + # Both "search" and "domain" lines exist, extract the domain suffix from both + search_suffix=$(get_domain_suffix "$search_line") + domain_suffix=$(get_domain_suffix "$domain_line") + # Print the domain suffix that appears first + if [[ ${#search_suffix} -lt ${#domain_suffix} ]]; then + DOMAIN_SUFFIX=$search_suffix + else + DOMAIN_SUFFIX=$domain_suffix + fi +elif [[ -n "$search_line" ]]; then + # If only "search" line exists + DOMAIN_SUFFIX=$(get_domain_suffix "$search_line") +elif [[ -n "$domain_line" ]]; then + # If only "domain" line exists + DOMAIN_SUFFIX=$(get_domain_suffix "$domain_line") +else + # If no "search" or "domain" lines found + DOMAIN_SUFFIX="local" +fi + +####################################################################################################################### +# Begin install menu prompts ########################################################################################## +####################################################################################################################### + +# We need to ensure consistent default hostname and domain suffix values for TLS implementation. The below approach +# allows the user to either hit enter at the prompt to keep current values, or to manually update values. Silent install +# pre-set values (if provided) will bypass all prompts. + +# Ensure SERVER_NAME is consistent with local host entries +if [[ -z ${SERVER_NAME} ]]; then + echo -e "${LYELLOW}Update Linux system HOSTNAME [Enter to keep: ${HOSTNAME}]${LGREEN}" + read -p " Enter new HOSTNAME : " SERVER_NAME + # If hit enter making no SERVER_NAME change, assume the existing hostname as current + if [[ "${SERVER_NAME}" = "" ]]; then + SERVER_NAME=$HOSTNAME + fi + echo + # A SERVER_NAME was derived via the prompt + # Apply the SERVER_NAME value & remove and update any old 127.0.1.1 local host references + sudo hostnamectl set-hostname $SERVER_NAME &>>${INSTALL_LOG} + sudo sed -i '/127.0.1.1/d' /etc/hosts &>>${INSTALL_LOG} + echo '127.0.1.1 '${SERVER_NAME}'' | sudo tee -a /etc/hosts &>>${INSTALL_LOG} + sudo systemctl restart systemd-hostnamed &>>${INSTALL_LOG} +else + echo + # A SERVER_NAME value was derived from a pre-set silent install option. + # Apply the SERVER_NAME value & remove and update any old 127.0.1.1 local host references + sudo hostnamectl set-hostname $SERVER_NAME &>>${INSTALL_LOG} + sudo sed -i '/127.0.1.1/d' /etc/hosts &>>${INSTALL_LOG} + echo '127.0.1.1 '${SERVER_NAME}'' | sudo tee -a /etc/hosts &>>${INSTALL_LOG} + sudo systemctl restart systemd-hostnamed &>>${INSTALL_LOG} +fi + +# Ensure SERVER_NAME, LOCAL_DOMAIN suffix and host entries are all consistent +if [[ -z ${LOCAL_DOMAIN} ]]; then + echo -e "${LYELLOW}Update Linux LOCAL DNS DOMAIN [Enter to keep: ${DOMAIN_SUFFIX}]${LGREEN}" + read -p " Enter FULL LOCAL DOMAIN NAME: " LOCAL_DOMAIN + # If hit enter making no LOCAL_DOMAIN name change, assume the existing domain suffix as current + if [[ "${LOCAL_DOMAIN}" = "" ]]; then + LOCAL_DOMAIN=$DOMAIN_SUFFIX + fi + echo + # A LOCAL_DOMAIN value was derived via the prompt + # Remove any old hosts & resolv file values and update these with the new LOCAL_DOMAIN value + sudo sed -i "/${DEFAULT_IP}/d" /etc/hosts + sudo sed -i '/domain/d' /etc/resolv.conf + sudo sed -i '/search/d' /etc/resolv.conf + # Refresh the /etc/hosts file with the server name and new local domain value + echo ''${DEFAULT_IP}' '${SERVER_NAME}.${LOCAL_DOMAIN} ${SERVER_NAME}'' | sudo tee -a /etc/hosts &>>${INSTALL_LOG} + # Refresh /etc/resolv.conf with new domain and search suffix values + echo 'domain '${LOCAL_DOMAIN}'' | sudo tee -a /etc/resolv.conf &>>${INSTALL_LOG} + echo 'search '${LOCAL_DOMAIN}'' | sudo tee -a /etc/resolv.conf &>>${INSTALL_LOG} + sudo systemctl restart systemd-hostnamed &>>${INSTALL_LOG} +else + echo + # A LOCAL_DOMIN value was derived from a pre-set silent install option. + # Remove any old hosts & resolv file values and update these with the new LOCAL_DOMAIN value + sudo sed -i "/${DEFAULT_IP}/d" /etc/hosts + sudo sed -i '/domain/d' /etc/resolv.conf + sudo sed -i '/search/d' /etc/resolv.conf + # Refresh the /etc/hosts file with the server name and new local domain value + echo ''${DEFAULT_IP}' '${SERVER_NAME}.${LOCAL_DOMAIN} ${SERVER_NAME}'' | sudo tee -a /etc/hosts &>>${INSTALL_LOG} + # Refresh /etc/resolv.conf with new domain and search suffix values + echo 'domain '${LOCAL_DOMAIN}'' | sudo tee -a /etc/resolv.conf &>>${INSTALL_LOG} + echo 'search '${LOCAL_DOMAIN}'' | sudo tee -a /etc/resolv.conf &>>${INSTALL_LOG} + sudo systemctl restart systemd-hostnamed &>>${INSTALL_LOG} +fi + +# Now that $SERVER_NAME and $LOCAL_DOMAIN values are updated and refreshed: +# Values are merged to build a local FQDN value (used for the default reverse proxy site name.) +DEFAULT_FQDN=$SERVER_NAME.$LOCAL_DOMAIN + +# The RDP share label default can now assume the updated $SERVER_NAME value (if not manually specified in silent setup options). +if [[ -z ${RDP_SHARE_HOST} ]]; then + RDP_SHARE_HOST=$SERVER_NAME +fi + +# Prompt the user to install MySQL +echo -e "${LGREEN}MySQL setup options:${GREY}" +if [[ -z ${INSTALL_MYSQL} ]]; then + echo -e -n "SQL: Install MySQL locally? (For a REMOTE MySQL server select 'n') [Y/n] [default y]: ${GREY}" + read PROMPT + if [[ ${PROMPT} =~ ^[Nn]$ ]]; then + INSTALL_MYSQL=false + else + INSTALL_MYSQL=true + fi +fi + +# Prompt the user to apply the Mysql secure installation locally +if [[ -z ${SECURE_MYSQL} ]] && [[ "${INSTALL_MYSQL}" = true ]]; then + echo -e -n "${GREY}SQL: Apply MySQL secure installation settings to LOCAL db? [Y/n] [default y]: ${GREY}" + read PROMPT + if [[ ${PROMPT} =~ ^[Nn]$ ]]; then + SECURE_MYSQL=false + else + SECURE_MYSQL=true + fi +fi + +# Get additional MYSQL values +if [[ "${INSTALL_MYSQL}" = false ]]; then + [[ -z "${MYSQL_HOST}" ]] && + read -p "SQL: Enter remote MySQL server hostname or IP: " MYSQL_HOST + [[ -z "${MYSQL_PORT}" ]] && + read -p "SQL: Enter remote MySQL server port [3306]: " MYSQL_PORT + [[ -z "${GUAC_DB}" ]] && + read -p "SQL: Enter remote Guacamole database name [guacamole_db]: " GUAC_DB + [[-z "${GUAC_USER}" ]] && + read -p "SQL: Enter remote Guacamole user name [guacamole_user]: " GUAC_USER +fi +# Checking if a mysql host given, if not set a default +if [[ -z "${MYSQL_HOST}" ]]; then + MYSQL_HOST="localhost" +fi +# Checking if a mysql port given, if not set a default +if [[ -z "${MYSQL_PORT}" ]]; then + MYSQL_PORT="3306" +fi +# Checking if a database name given, if not set a default +if [[ -z "${GUAC_DB}" ]]; then + GUAC_DB="guacamole_db" +fi +# Checking if a mysql user given, if not set a default +if [[ -z "${GUAC_USER}" ]]; then + GUAC_USER="guacamole_user" +fi + +# Get MySQL root password, confirm correct password entry and prevent blank passwords. No root pw needed for remote instances. +if [[ -z "${MYSQL_ROOT_PWD}" ]] && [[ "${INSTALL_MYSQL}" = true ]]; then + while true; do + read -s -p "SQL: Enter ${MYSQL_HOST}'s MySQL ROOT password: " MYSQL_ROOT_PWD + echo + read -s -p "SQL: Confirm ${MYSQL_HOST}'s MySQL ROOT password: " PROMPT2 + echo + [[ "${MYSQL_ROOT_PWD}" = "${PROMPT2}" ]] && [[ "${MYSQL_ROOT_PWD}" != "" ]] && [[ "${PROMPT2}" != "" ]] && break + echo -e "${LRED}Passwords don't match or can't be null. Please try again.${GREY}" 1>&2 + done +fi + +# Get Guacamole User password, confirm correct password entry and prevent blank passwords +if [[ -z "${GUAC_PWD}" ]]; then + while true; do + read -s -p "SQL: Enter ${MYSQL_HOST}'s MySQL ${GUAC_USER} password: " GUAC_PWD + echo + read -s -p "SQL: Confirm ${MYSQL_HOST}'s MySQL ${GUAC_USER} password: " PROMPT2 + echo + [[ "${GUAC_PWD}" = "${PROMPT2}" ]] && [[ "${GUAC_PWD}" != "" ]] && [[ "${PROMPT2}" != "" ]] && break + echo -e "${LRED}Passwords don't match or can't be null. Please try again.${GREY}" 1>&2 + done +fi + +# Prompt for preferred backup notification email address +if [[ -z ${BACKUP_EMAIL} ]]; then + while true; do + read -p "SQL: Enter email address for SQL backup messages [Enter to skip]: " BACKUP_EMAIL + [[ "${BACKUP_EMAIL}" = "" ]] || [[ "${BACKUP_EMAIL}" != "" ]] && break + # Rather than allow a blank value, un-comment to alternately force user to enter an explicit value instead + # [[ "${BACKUP_EMAIL}" != "" ]] && break + # echo -e "${LRED}You must enter an email address. Please try again.${GREY}" 1>&2 + done +fi +# If no backup notification email address is given, provide a default value +if [[ -z ${BACKUP_EMAIL} ]]; then + BACKUP_EMAIL="backup-email@yourdomain.com" +fi + +echo +# Prompt the user to install TOTP MFA +echo -e "${LGREEN}Guacamole authentication extension options:${GREY}" +if [[ -z "${INSTALL_TOTP}" ]] && [[ "${INSTALL_DUO}" != true ]]; then + echo -e -n "AUTH: Install TOTP? (choose 'n' if you want Duo) [y/N]? [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + INSTALL_TOTP=true + INSTALL_DUO=false + else + INSTALL_TOTP=false + fi +fi + +# Prompt the user to install Duo MFA +if [[ -z "${INSTALL_DUO}" ]] && [[ "${INSTALL_TOTP}" != true ]]; then + echo -e -n "${GREY}AUTH: Install Duo? [y/N] [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + INSTALL_DUO=true + INSTALL_TOTP=false + else + INSTALL_DUO=false + fi +fi + +# We can't install TOTP and Duo at the same time (option not supported by Guacamole) +if [[ "${INSTALL_TOTP}" = true ]] && [[ "${INSTALL_DUO}" = true ]]; then + echo -e "${LRED}GUAC MFA: TOTP and Duo cannot be installed at the same time.${GREY}" 1>&2 + exit 1 +fi + +# Prompt the user to install Duo MFA +if [[ -z "${INSTALL_LDAP}" ]]; then + echo -e -n "${GREY}AUTH: Install LDAP? [y/N] [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + INSTALL_LDAP=true + else + INSTALL_LDAP=false + fi +fi + +echo +# Prompt the user to install the Quick Connect feature (some higher security use cases may not want this) +echo -e "${LGREEN}Guacamole console optional extras:${GREY}" +if [[ -z "${INSTALL_QCONNECT}" ]]; then + echo -e -n "${GREY}EXTRAS: Install Quick Connect feature? [y/N] [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + INSTALL_QCONNECT=true + else + INSTALL_QCONNECT=false + fi +fi + +# Prompt the user to install the History Recorded Storage feature +if [[ -z "${INSTALL_HISTREC}" ]]; then + echo -e -n "${GREY}EXTRAS: Install History Recorded Storage feature [y/N] [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + INSTALL_HISTREC=true + else + INSTALL_HISTREC=false + fi +fi + +HISTREC_PATH_DEFAULT=/var/lib/guacamole/recordings # Apache default +if [[ -z ${HISTREC_PATH} ]] && [[ "${INSTALL_HISTREC}" = true ]]; then + while true; do + read -p "EXTRAS: Enter recorded storage path [Enter for default ${HISTREC_PATH_DEFAULT}]: " HISTREC_PATH + [[ "${HISTREC_PATH}" = "" ]] || [[ "${HISTREC_PATH}" != "" ]] && break + done +fi + +# If no custom path is given, lets assume the default path on hitting enter +if [[ -z "${HISTREC_PATH}" ]]; then + HISTREC_PATH="${HISTREC_PATH_DEFAULT}" +fi + +echo +# Prompt for Guacamole front end reverse proxy option +echo -e "${LGREEN}Reverse Proxy & front end options:${GREY}" +if [[ -z ${INSTALL_NGINX} ]]; then + echo -e -n "FRONT END: Protect Guacamole behind Nginx reverse proxy [y/N]? [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + INSTALL_NGINX=true + GUAC_URL_REDIR=false + else + INSTALL_NGINX=false + fi +fi + +# Prompt to remove the trailing /guacamole dir from the default front end url. Don't redirect if using reverse proxy +if [[ -z ${GUAC_URL_REDIR} ]] && [[ "${INSTALL_NGINX}" = false ]]; then + echo -e -n "FRONT END: Redirect the Guacamole server's http root to /guacamole [y/N]? [default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + GUAC_URL_REDIR=true + else + GUAC_URL_REDIR=false + fi +fi + +# Checking the redirect logic with unattended installs, if not explicitly set correctly, set to false +if [[ -z ${GUAC_URL_REDIR} ]] && [[ "${INSTALL_NGINX}" = true ]]; then + GUAC_URL_REDIR=false + elif [[ -z ${GUAC_URL_REDIR} ]]; then + GUAC_URL_REDIR=false +fi + +# We must assign a DNS name for the new proxy site +if [[ -z ${PROXY_SITE} ]] && [[ "${INSTALL_NGINX}" = true ]]; then + while true; do + read -p "FRONT END: Enter proxy LOCAL DNS name? [Enter to use ${DEFAULT_FQDN}]: " PROXY_SITE + [[ "${PROXY_SITE}" = "" ]] || [[ "${PROXY_SITE}" != "" ]] && break + # Rather than allow the default value below, un-comment to alternately force user to enter an explicit name instead + # [[ "${PROXY_SITE}" != "" ]] && break + # echo -e "${LRED}You must enter a proxy site DNS name. Please try again.${GREY}" 1>&2 + done +fi + +# If no proxy site dns name is given, lets assume the default FQDN is the proxy site name +if [[ -z "${PROXY_SITE}" ]]; then + PROXY_SITE="${DEFAULT_FQDN}" +fi + +# Prompt for self signed TLS reverse proxy option +if [[ -z ${SELF_SIGN} ]] && [[ "${INSTALL_NGINX}" = true ]]; then + # Prompt the user to see if they would like to install self signed TLS support for Nginx, default of no + echo -e -n "FRONT END: Add self signed TLS support to Nginx? [y/N]? (choose 'n' for Let's Encrypt)[default n]: " + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + SELF_SIGN=true + LETS_ENCRYPT=false + else + SELF_SIGN=false + fi +fi + +# Optional prompt to manually enter a self sign TLS certificate expiry date, un-comment to force manual entry +#if [[ "${SELF_SIGN}" = true ]]; then +# read - p "PROXY: Enter number of days till TLS certificate expires [default 3650]: " CERT_DAYS +#fi + +# If no self sign TLS certificate expiry given, lets assume a generous 10 year default certificate expiry +if [[ -z "${CERT_DAYS}" ]]; then + CERT_DAYS="3650" +fi + +# Prompt for Let's Encrypt TLS reverse proxy configuration option +if [[ -z ${LETS_ENCRYPT} ]] && [[ "${INSTALL_NGINX}" = true ]] && [[ "${SELF_SIGN}" = false ]]; then + echo -e -n "FRONT END: Add Let's Encrypt TLS support to Nginx reverse proxy [y/N] [default n]: ${GREY}" + read PROMPT + if [[ ${PROMPT} =~ ^[Yy]$ ]]; then + LETS_ENCRYPT=true + SELF_SIGN=false + else + LETS_ENCRYPT=false + fi +fi + +# Prompt for Let's Encrypt public dns name +if [[ -z ${LE_DNS_NAME} ]] && [[ "${LETS_ENCRYPT}" = true ]] && [[ "${SELF_SIGN}" = false ]]; then + while true; do + read -p "FRONT END: Enter the PUBLIC FQDN for your proxy site : " LE_DNS_NAME + [[ "${LE_DNS_NAME}" != "" ]] && break + echo -e "${LRED}You must enter a public DNS name. Please try again.${GREY}" 1>&2 + done +fi + +# Prompt for Let's Encrypt admin email +if [[ -z ${LE_EMAIL} ]] && [[ "${LETS_ENCRYPT}" = true ]] && [[ "${SELF_SIGN}" = false ]]; then + while true; do + read -p "FRONT END: Enter the email address for Let's Encrypt notifications : " LE_EMAIL + [[ "${LE_EMAIL}" != "" ]] && break + echo -e "${LRED}You must enter an email address. Please try again.${GREY}" 1>&2 + done +fi + +####################################################################################################################### +# Start global setup actions ######################################################################################### +####################################################################################################################### + +clear +echo +echo -e "${GREYB}Guacamole ${GUAC_VERSION} Auto Installer." +echo -e " ${LGREEN}Powered by Itiligent" +echo +echo + +echo -e "${LGREEN}Beginning Guacamole setup...${GREY}" +echo + +echo -e "${GREY}Synchronising the install script suite with installation settings..." +# Sync the various manual config scripts with the relevant variables selected at install +# This way scripts can be run at a later time without modification to match the original install +sed -i "s|MYSQL_HOST=|MYSQL_HOST='${MYSQL_HOST}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|MYSQL_PORT=|MYSQL_PORT='${MYSQL_PORT}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|GUAC_USER=|GUAC_USER='${GUAC_USER}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|GUAC_PWD=|GUAC_PWD='${GUAC_PWD}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|GUAC_DB=|GUAC_DB='${GUAC_DB}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|DB_BACKUP_DIR=|DB_BACKUP_DIR='${DB_BACKUP_DIR}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|BACKUP_EMAIL=|BACKUP_EMAIL='${BACKUP_EMAIL}'|g" $DOWNLOAD_DIR/backup-guac.sh +sed -i "s|BACKUP_RETENTION=|BACKUP_RETENTION='${BACKUP_RETENTION}'|g" $DOWNLOAD_DIR/backup-guac.sh + +sed -i "s|CERT_COUNTRY=|CERT_COUNTRY='${CERT_COUNTRY}'|g" $DOWNLOAD_DIR/add-tls-guac-daemon.sh +sed -i "s|CERT_STATE=|CERT_STATE='${CERT_STATE}'|g" $DOWNLOAD_DIR/add-tls-guac-daemon.sh +sed -i "s|CERT_LOCATION=|CERT_LOCATION='${CERT_LOCATION=}'|g" $DOWNLOAD_DIR/add-tls-guac-daemon.sh +sed -i "s|CERT_ORG=|CERT_ORG='${CERT_ORG}'|g" $DOWNLOAD_DIR/add-tls-guac-daemon.sh +sed -i "s|CERT_OU=|CERT_OU='${CERT_OU}'|g" $DOWNLOAD_DIR/add-tls-guac-daemon.sh +sed -i "s|CERT_DAYS=|CERT_DAYS='${CERT_DAYS}'|g" $DOWNLOAD_DIR/add-tls-guac-daemon.sh + +sed -i "s|INSTALL_MYSQL=|INSTALL_MYSQL='${INSTALL_MYSQL}'|g" $DOWNLOAD_DIR/upgrade-guac.sh +sed -i "s|MYSQL_HOST=|MYSQL_HOST='${MYSQL_HOST}'|g" $DOWNLOAD_DIR/upgrade-guac.sh +sed -i "s|MYSQL_PORT=|MYSQL_PORT='${MYSQL_PORT}'|g" $DOWNLOAD_DIR/upgrade-guac.sh +sed -i "s|GUAC_DB=|GUAC_DB='${GUAC_DB}'|g" $DOWNLOAD_DIR/upgrade-guac.sh +sed -i "s|MYSQL_ROOT_PWD=|MYSQL_ROOT_PWD='${MYSQL_ROOT_PWD}'|g" $DOWNLOAD_DIR/upgrade-guac.sh +sed -i "s|GUAC_USER=|GUAC_USER='${GUAC_USER}'|g" $DOWNLOAD_DIR/upgrade-guac.sh +sed -i "s|GUAC_PWD=|GUAC_PWD='${GUAC_PWD}'|g" $DOWNLOAD_DIR/upgrade-guac.sh + +sed -i "s|PROXY_SITE=|PROXY_SITE='${PROXY_SITE}'|g" $DOWNLOAD_DIR/3-install-nginx.sh +sed -i "s|INSTALL_LOG=|INSTALL_LOG='${INSTALL_LOG}'|g" $DOWNLOAD_DIR/3-install-nginx.sh +sed -i "s|GUAC_URL=|GUAC_URL='${GUAC_URL}'|g" $DOWNLOAD_DIR/3-install-nginx.sh + +sed -i "s|DOWNLOAD_DIR=|DOWNLOAD_DIR='${DOWNLOAD_DIR}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|PROXY_SITE=|PROXY_SITE='${PROXY_SITE}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|CERT_COUNTRY=|CERT_COUNTRY='${CERT_COUNTRY}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|CERT_STATE=|CERT_STATE='${CERT_STATE}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|CERT_LOCATION=|CERT_LOCATION='${CERT_LOCATION=}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|CERT_ORG=|CERT_ORG='${CERT_ORG}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|CERT_OU=|CERT_OU='${CERT_OU}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|CERT_DAYS=|CERT_DAYS='${CERT_DAYS}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|GUAC_URL=|GUAC_URL='${GUAC_URL}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|INSTALL_LOG=|INSTALL_LOG='${INSTALL_LOG}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|DEFAULT_IP=|DEFAULT_IP='${DEFAULT_IP}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh +sed -i "s|RSA_KEYLENGTH=|RSA_KEYLENGTH='${RSA_KEYLENGTH}'|g" $DOWNLOAD_DIR/4a-install-tls-self-signed-nginx.sh + +# refresh-tls-self-signed.sh is now functionally duplicated by the 4a-install-tls-self-signed-nginx.sh. Keeping it here for later conversion into a script for HA Proxy TLS options +#sed -i "s|CERT_COUNTRY=|CERT_COUNTRY='${CERT_COUNTRY}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|CERT_STATE=|CERT_STATE='${CERT_STATE}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|CERT_LOCATION=|CERT_LOCATION='${CERT_LOCATION}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|CERT_ORG=|CERT_ORG='${CERT_ORG}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|CERT_OU=|CERT_OU='${CERT_OU}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|PROXY_SITE=|PROXY_SITE='${PROXY_SITE}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|DEFAULT_IP=|DEFAULT_IP='${DEFAULT_IP}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|CERT_DAYS=|CERT_DAYS='${CERT_DAYS}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh +#sed -i "s|RSA_KEYLENGTH=|RSA_KEYLENGTH='${RSA_KEYLENGTH}'|g" $DOWNLOAD_DIR/refresh-tls-self-signed.sh + +sed -i "s|DOWNLOAD_DIR=|DOWNLOAD_DIR='${DOWNLOAD_DIR}'|g" $DOWNLOAD_DIR/4b-install-tls-letsencrypt-nginx.sh +sed -i "s|PROXY_SITE=|PROXY_SITE='${PROXY_SITE}'|g" $DOWNLOAD_DIR/4b-install-tls-letsencrypt-nginx.sh +sed -i "s|GUAC_URL=|GUAC_URL='${GUAC_URL}'|g" $DOWNLOAD_DIR/4b-install-tls-letsencrypt-nginx.sh +sed -i "s|LE_DNS_NAME=|LE_DNS_NAME='${LE_DNS_NAME}'|g" $DOWNLOAD_DIR/4b-install-tls-letsencrypt-nginx.sh +sed -i "s|LE_EMAIL=|LE_EMAIL='${LE_EMAIL}'|g" $DOWNLOAD_DIR/4b-install-tls-letsencrypt-nginx.sh +sed -i "s|INSTALL_LOG=|INSTALL_LOG='${INSTALL_LOG}'|g" $DOWNLOAD_DIR/4b-install-tls-letsencrypt-nginx.sh + +sed -i "s|LOCAL_DOMAIN=|LOCAL_DOMAIN='${LOCAL_DOMAIN}'|g" $DOWNLOAD_DIR/add-smtp-relay-o365.sh +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# For flexibility, export the relevant variable selections to child install scripts +export DOWNLOAD_DIR="${DOWNLOAD_DIR}" +export GUAC_VERSION=$GUAC_VERSION +export GUAC_SOURCE_LINK=$GUAC_SOURCE_LINK +export MYSQLJCON=$MYSQLJCON +export MYSQL_VERSION=$MYSQL_VERSION +export MYSQLSRV=$MYSQLSRV +export MYSQLCLIENT=$MYSQLCLIENT +export DB_CMD=$DB_CMD +export TOMCAT_VERSION=$TOMCAT_VERSION +export GUAC_URL=$GUAC_URL +export INSTALL_LOG=$INSTALL_LOG +export JPEGTURBO=$JPEGTURBO +export LIBPNG=$LIBPNG +export INSTALL_MYSQL=$INSTALL_MYSQL +export SECURE_MYSQL=$SECURE_MYSQL +export MYSQL_HOST=$MYSQL_HOST +export MYSQL_PORT=$MYSQL_PORT +export GUAC_DB=$GUAC_DB +export GUAC_USER=$GUAC_USER +export MYSQL_ROOT_PWD="${MYSQL_ROOT_PWD}" +export GUAC_PWD="${GUAC_PWD}" +export DB_TZ="${DB_TZ}" +export INSTALL_TOTP=$INSTALL_TOTP +export INSTALL_DUO=$INSTALL_DUO +export INSTALL_LDAP=$INSTALL_LDAP +export INSTALL_QCONNECT=$INSTALL_QCONNECT +export INSTALL_HISTREC=$INSTALL_HISTREC +export HISTREC_PATH="${HISTREC_PATH}" +export GUAC_URL_REDIR=$GUAC_URL_REDIR +export INSTALL_NGINX=$INSTALL_NGINX +export PROXY_SITE=$PROXY_SITE +export RSA_KEYLENGTH=$RSA_KEYLENGTH +export DEFAULT_IP=$DEFAULT_IP +export CERT_COUNTRY=$CERT_COUNTRY +export CERT_STATE="${CERT_STATE}" +export CERT_LOCATION="${CERT_LOCATION}" +export CERT_ORG="${CERT_ORG}" +export CERT_OU="${CERT_OU}" +export CERT_DAYS=$CERT_DAYS +export LE_DNS_NAME=$LE_DNS_NAME +export LE_EMAIL=$LE_EMAIL +export BACKUP_EMAIL=$BACKUP_EMAIL +export RDP_SHARE_HOST="${RDP_SHARE_HOST}" +export RDP_SHARE_LABEL="${RDP_SHARE_LABEL}" +export RDP_PRINTER_LABEL="${RDP_PRINTER_LABEL}" +export LOCAL_DOMAIN=$LOCAL_DOMAIN +export DOMAIN_SUFFIX=$DOMAIN_SUFFIX + +# Run the Guacamole install script +sudo -E ./2-install-guacamole.sh # Using -E to keep all exported variables and outputs within the current shell +if [[ $? -ne 0 ]]; then + echo -e "${LRED}2-install-guacamole.sh FAILED. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +elif [[ "${GUAC_URL_REDIR}" = true ]]; then + echo -e "${LGREEN}Guacamole install complete\nhttp://${PROXY_SITE}:8080 - login user/pass: guacadmin/guacadmin\n${LYELLOW}***Be sure to change the password***${GREY}" +else + echo -e "${LGREEN}Guacamole install complete\nhttp://${PROXY_SITE}:8080/guacamole - login user/pass: guacadmin/guacadmin\n${LYELLOW}***Be sure to change the password***${GREY}" +fi + +# Add a Guacamole database backup (mon-fri 12:00am) into the current user's cron +mv $DOWNLOAD_DIR/backup-guac.sh $DB_BACKUP_DIR +crontab -l >cron_1 +# Remove any existing entry just in case +sed -i '/# backup guacamole/d' cron_1 +# Create the backup job +echo "0 0 * * 1-5 ${DB_BACKUP_DIR}/backup-guac.sh # backup guacamole" >>cron_1 +# Overwrite the old cron settings and cleanup +crontab cron_1 +rm cron_1 + +####################################################################################################################### +# Start optional setup actions ###################################################################################### +####################################################################################################################### + +# Install Nginx reverse proxy front end to Guacamole if option is selected +if [[ "${INSTALL_NGINX}" = true ]]; then + sudo -E ./3-install-nginx.sh # Using -E to keep all exported variables and outputs within the current shell + echo -e "${LGREEN}Nginx install complete\nhttp://${PROXY_SITE} - admin login: guacadmin pass: guacadmin\n${LYELLOW}***Be sure to change the password***${GREY}" +fi + +# Apply self signed TLS certificates to Nginx reverse proxy if option is selected +if [[ "${INSTALL_NGINX}" = true ]] && [[ "${SELF_SIGN}" = true ]] && [[ "${LETS_ENCRYPT}" != true ]]; then + # Using -E to keep all exported variables and outputs within the current shell + sudo -E ./4a-install-tls-self-signed-nginx.sh ${PROXY_SITE} ${CERT_DAYS} ${DEFAULT_IP} | tee -a ${INSTALL_LOG} # Logged to capture client cert import instructions + echo -e "${LGREEN}Self signed certificate configured for Nginx \n${LYELLOW}https:${LGREEN}//${PROXY_SITE} - login user/pass: guacadmin/guacadmin\n${LYELLOW}***Be sure to change the password***${GREY}" +fi + +# Apply Let's Encrypt TLS certificates to Nginx reverse proxy if option is selected +if [[ "${INSTALL_NGINX}" = true ]] && [[ "${LETS_ENCRYPT}" = true ]] && [[ "${SELF_SIGN}" != true ]]; then + sudo -E ./4b-install-tls-letsencrypt-nginx.sh # Using -E to keep all exported variables and outputs within the current shell + echo -e "${LGREEN}Let's Encrypt TLS configured for Nginx \n${LYELLOW}https:${LGREEN}//${LE_DNS_NAME} - login user/pass: guacadmin/guacadmin\n${LYELLOW}***Be sure to change the password***${GREY}" +fi + +# Duo Settings reminder - If Duo is selected you can't login to Guacamole until this extension is fully configured +if [[ $INSTALL_DUO == "true" ]]; then + echo + echo -e "${LYELLOW}Reminder: Duo requires extra account specific info configured in the\n/etc/guacamole/guacamole.properties file before you can log in to Guacamole." + echo -e "See https://guacamole.apache.org/doc/gug/duo-auth.html" +fi + +# LDAP Settings reminder, LDAP auth is not functional until the config is complete +if [[ $INSTALL_LDAP == "true" ]]; then + echo + echo -e "${LYELLOW}Reminder: LDAP requires that your LDAP directory configuration match the exact format\nadded to the /etc/guacamole/guacamole.properties file before LDAP auth will be active." + echo -e "See https://guacamole.apache.org/doc/gug/ldap-auth.html" +fi + +# Tidy up +mv $USER_HOME_DIR/1-setup.sh $DOWNLOAD_DIR +apt-get -y autoremove &>>${INSTALL_LOG} + +# Done +echo +printf "${LGREEN}Guacamole ${GUAC_VERSION} install complete! \n${NC}" +echo -e ${NC} diff --git a/2-install-guacamole.sh b/2-install-guacamole.sh new file mode 100644 index 0000000..ef52aba --- /dev/null +++ b/2-install-guacamole.sh @@ -0,0 +1,660 @@ +#!/bin/bash +####################################################################################################################### +# Guacamole main build script +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + + +# Update everything but don't do the annoying prompts during apt installs +echo -e "${GREY}Updating base Linux OS..." +export DEBIAN_FRONTEND=noninteractive +apt-get update -qq >/dev/null +apt-get upgrade -qq -y &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Pre-seed MySQL root password values for Linux Distro default packages only +if [[ "${INSTALL_MYSQL}" = true ]] && [[ -z "${MYSQL_VERSION}" ]]; then + debconf-set-selections <<<"mysql-server mysql-server/root_password password ${MYSQL_ROOT_PWD}" + debconf-set-selections <<<"mysql-server mysql-server/root_password_again password ${MYSQL_ROOT_PWD}" +fi + +# Install official MariaDB repo and MariaDB version if a specific version number was provided. +if [[ -n "${MYSQL_VERSION}" ]]; then + echo -e "${GREY}Adding the official MariaDB repository and installing version ${MYSQL_VERSION}..." + # Add the Official MariaDB repo. + apt-get -qq -y install curl gnupg2 &>>${INSTALL_LOG} + curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup &>>${INSTALL_LOG} + bash mariadb_repo_setup --mariadb-server-version=$MYSQL_VERSION &>>${INSTALL_LOG} + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Select the appropriate MySQL client or server packages, and don't clobber any pre-existing database installation accidentally +if [[ "${INSTALL_MYSQL}" = true ]]; then + MYSQLPKG="${MYSQLSRV}" +elif [ -x "$(command -v ${DB_CMD})" ]; then + MYSQLPKG="" +else + MYSQLPKG="${MYSQLCLIENT}" +fi + +# Install Guacamole build dependencies (pwgen needed for duo config only, expect is auto removed after install) +echo -e "${GREY}Installing dependencies required for building Guacamole, this might take a few minutes..." +apt-get update -qq >/dev/null +apt-get -qq -y install ${MYSQLPKG} ${TOMCAT_VERSION} ${JPEGTURBO} ${LIBPNG} ufw pwgen expect \ + build-essential libcairo2-dev libtool-bin uuid-dev libavcodec-dev libavformat-dev libavutil-dev \ + libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libwebsockets-dev \ + libpulse-dev libssl-dev libvorbis-dev libwebp-dev ghostscript &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Install Postfix with default settings for smtp email relay +echo -e "${GREY}Installing Postfix MTA for backup email notifications and alerts, see separate SMTP relay configuration script..." +DEBIAN_FRONTEND="noninteractive" apt-get install postfix mailutils -qq -y &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + systemctl restart postfix + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Download Guacamole Server +echo -e "${GREY}Downloading Guacamole source files..." +wget -q --show-progress -O guacamole-server-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/source/guacamole-server-${GUAC_VERSION}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-server-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/source/guacamole-server-${GUAC_VERSION}.tar.gz${GREY}" + exit 1 +else + tar -xzf guacamole-server-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-server-${GUAC_VERSION}.tar.gz${GREY}" +fi + +# Download Guacamole Client +wget -q --show-progress -O guacamole-${GUAC_VERSION}.war ${GUAC_SOURCE_LINK}/binary/guacamole-${GUAC_VERSION}.war +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-${GUAC_VERSION}.war" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-${GUAC_VERSION}.war${GREY}" + exit 1 +else + echo -e "${LGREEN}Downloaded guacamole-${GUAC_VERSION}.war${GREY}" +fi + +# Download MySQL connector/j +wget -q --show-progress -O mysql-connector-j-${MYSQLJCON}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-${MYSQLJCON}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download mysql-connector-j-${MYSQLJCON}.tar.gz" 1>&2 + echo -e "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-${MYSQLJCON}}.tar.gz${GREY}" + exit 1 +else + tar -xzf mysql-connector-j-${MYSQLJCON}.tar.gz + echo -e "${LGREEN}Downloaded mysql-connector-j-${MYSQLJCON}.tar.gz${GREY}" +fi + +# Download Guacamole database auth extension +wget -q --show-progress -O guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz" + exit 1 +else + tar -xzf guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz${GREY}" +fi + +# Download TOTP auth extension +if [[ "${INSTALL_TOTP}" = true ]]; then + wget -q --show-progress -O guacamole-auth-totp-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-totp-${GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-totp-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-totp-${GUAC_VERSION}.tar.gz" + exit 1 + else + tar -xzf guacamole-auth-totp-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-auth-totp-${GUAC_VERSION}.tar.gz${GREY}" + fi +fi + +# Download DUO auth extension +if [[ "${INSTALL_DUO}" = true ]]; then + wget -q --show-progress -O guacamole-auth-duo-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-duo-${GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-duo-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-duo-${GUAC_VERSION}.tar.gz" + exit 1 + else + tar -xzf guacamole-auth-duo-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-auth-duo-${GUAC_VERSION}.tar.gz${GREY}" + fi +fi + +# Download LDAP auth extension +if [[ "${INSTALL_LDAP}" = true ]]; then + wget -q --show-progress -O guacamole-auth-ldap-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-ldap-${GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-ldap-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-ldap-${GUAC_VERSION}.tar.gz" + exit 1 + else + tar -xzf guacamole-auth-ldap-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-auth-ldap-${GUAC_VERSION}.tar.gz${GREY}" + fi +fi + +# Download Guacamole quick-connect extension +if [[ "${INSTALL_QCONNECT}" = true ]]; then + wget -q --show-progress -O guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz" + exit 1 + else + tar -xzf guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz${GREY}" + fi +fi + +# Download Guacamole history recording storage extension +if [[ "${INSTALL_HISTREC}" = true ]]; then + wget -q --show-progress -O guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz + + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz" + exit 1 + else + tar -xzf guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz + echo -e "${LGREEN}Downloaded guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz${GREY}" + fi +fi +echo -e "Source download complete.${GREY}" + +# Place a pause in script here if you wish to make final tweaks to source code before compiling +#read -p $'Script paused for editing source before building. Enter to begin the build...\n' + +# Add customised RDP share names and printer labels, remove Guacamole default labelling +sed -i -e 's/IDX_CLIENT_NAME, "Guacamole RDP"/IDX_CLIENT_NAME, "'"${RDP_SHARE_HOST}"'"/' ${DOWNLOAD_DIR}/guacamole-server-${GUAC_VERSION}/src/protocols/rdp/settings.c +sed -i -e 's/IDX_DRIVE_NAME, "Guacamole Filesystem"/IDX_CLIENT_NAME, "'"${RDP_SHARE_LABEL}"'"/' ${DOWNLOAD_DIR}/guacamole-server-${GUAC_VERSION}/src/protocols/rdp/settings.c +sed -i -e 's/IDX_PRINTER_NAME, "Guacamole Printer"/IDX_PRINTER_NAME, "'"${RDP_PRINTER_LABEL}"'"/' ${DOWNLOAD_DIR}/guacamole-server-${GUAC_VERSION}/src/protocols/rdp/settings.c + +# Make Guacamole directories +rm -rf /etc/guacamole/lib/ +rm -rf /etc/guacamole/extensions/ +mkdir -p /etc/guacamole/lib/ +mkdir -p /etc/guacamole/extensions/ + +# Fix for #196 see https://github.com/MysticRyuujin/guac-install/issues/196 +mkdir -p /usr/sbin/.config/freerdp +chown daemon:daemon /usr/sbin/.config/freerdp + +# Fix for #197 see https://github.com/MysticRyuujin/guac-install/issues/197 +mkdir -p /var/guacamole +chown daemon:daemon /var/guacamole + +# Make and install guacd (Guacamole-Server) +cd guacamole-server-${GUAC_VERSION}/ +echo +echo -e "${GREY}Compiling Guacamole-Server from source with with GCC $(gcc --version | head -n1 | grep -oP '\)\K.*' | awk '{print $1}'), this might take a few minutes...${GREY}" + +# Fix for warnings see #222 https://github.com/MysticRyuujin/guac-install/issues/222 +export CFLAGS="-Wno-error" + +# Configure Guacamole Server source +./configure --with-systemd-dir=/etc/systemd/system &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo "Failed to configure guacamole-server" + echo "Trying again with --enable-allow-freerdp-snapshots" + ./configure --with-systemd-dir=/etc/systemd/system --enable-allow-freerdp-snapshots + if [[ $? -ne 0 ]]; then + echo "Failed to configure guacamole-server - again" + exit + fi +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +echo -e "${GREY}Running make and building the Guacamole-Server application..." +make &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +echo -e "${GREY}Installing Guacamole-Server..." +make install &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Update the shared library cache +ldconfig + +# Move Guacamole client and authentication extensions to their correct install locations +cd .. +echo -e "${GREY}Moving guacamole-${GUAC_VERSION}.war (/etc/guacamole/extensions/)..." +mv -f guacamole-${GUAC_VERSION}.war /etc/guacamole/guacamole.war +chmod 664 /etc/guacamole/guacamole.war +# Create a symbolic link for Tomcat +ln -sf /etc/guacamole/guacamole.war /var/lib/${TOMCAT_VERSION}/webapps/ &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +echo -e "${GREY}Moving guacamole-auth-jdbc-mysql-${GUAC_VERSION}.jar (/etc/guacamole/extensions/)..." +mv -f guacamole-auth-jdbc-${GUAC_VERSION}/mysql/guacamole-auth-jdbc-mysql-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +chmod 664 /etc/guacamole/extensions/guacamole-auth-jdbc-mysql-${GUAC_VERSION}.jar +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Move MySQL connector/j files +echo -e "${GREY}Moving mysql-connector-j-${MYSQLJCON}.jar (/etc/guacamole/lib/mysql-connector-java.jar)..." +mv -f mysql-connector-j-${MYSQLJCON}/mysql-connector-j-${MYSQLJCON}.jar /etc/guacamole/lib/mysql-connector-java.jar +chmod 664 /etc/guacamole/lib/mysql-connector-java.jar +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Configure guacamole.properties file +rm -f /etc/guacamole/guacamole.properties +touch /etc/guacamole/guacamole.properties +echo "mysql-hostname: ${MYSQL_HOST}" >>/etc/guacamole/guacamole.properties +echo "mysql-port: ${MYSQL_PORT}" >>/etc/guacamole/guacamole.properties +echo "mysql-database: ${GUAC_DB}" >>/etc/guacamole/guacamole.properties +echo "mysql-username: ${GUAC_USER}" >>/etc/guacamole/guacamole.properties +echo "mysql-password: ${GUAC_PWD}" >>/etc/guacamole/guacamole.properties + +# Move TOTP files +if [[ "${INSTALL_TOTP}" = true ]]; then + echo -e "${GREY}Moving guacamole-auth-totp-${GUAC_VERSION}.jar (/etc/guacamole/extensions/)..." + mv -f guacamole-auth-totp-${GUAC_VERSION}/guacamole-auth-totp-${GUAC_VERSION}.jar /etc/guacamole/extensions/ + chmod 664 /etc/guacamole/extensions/guacamole-auth-totp-${GUAC_VERSION}.jar + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Move Duo files +if [[ "${INSTALL_DUO}" = true ]]; then + echo -e "${GREY}Moving guacamole-auth-duo-${GUAC_VERSION}.jar (/etc/guacamole/extensions/)..." + mv -f guacamole-auth-duo-${GUAC_VERSION}/guacamole-auth-duo-${GUAC_VERSION}.jar /etc/guacamole/extensions/ + chmod 664 /etc/guacamole/extensions/guacamole-auth-duo-${GUAC_VERSION}.jar + echo "#duo-api-hostname: " >>/etc/guacamole/guacamole.properties + echo "#duo-integration-key: " >>/etc/guacamole/guacamole.properties + echo "#duo-secret-key: " >>/etc/guacamole/guacamole.properties + echo "#duo-application-key: " >>/etc/guacamole/guacamole.properties + echo -e "Duo auth is installed, it will need to be configured via guacamole.properties" + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Move LDAP files +if [[ "${INSTALL_LDAP}" = true ]]; then + echo -e "${GREY}Moving guacamole-auth-ldap-${GUAC_VERSION}.jar (/etc/guacamole/extensions/)..." + mv -f guacamole-auth-ldap-${GUAC_VERSION}/guacamole-auth-ldap-${GUAC_VERSION}.jar /etc/guacamole/extensions/ + chmod 664 /etc/guacamole/extensions/guacamole-auth-ldap-${GUAC_VERSION}.jar + echo "#If you have issues with LDAP, check the formatting is exactly as below or you will despair!" >>/etc/guacamole/guacamole.properties + echo "#Be extra careful with spaces at line ends or with windows line feeds." >>/etc/guacamole/guacamole.properties + echo "#ldap-hostname: dc1.yourdomain.com dc2.yourdomain.com" >>/etc/guacamole/guacamole.properties + echo "#ldap-port: 389" >>/etc/guacamole/guacamole.properties + echo "#ldap-username-attribute: sAMAccountName" >>/etc/guacamole/guacamole.properties + echo "#ldap-encryption-method: none" >>/etc/guacamole/guacamole.properties + echo "#ldap-search-bind-dn: ad-account@yourdomain.com" >>/etc/guacamole/guacamole.properties + echo "#ldap-search-bind-password: ad-account-password" >>/etc/guacamole/guacamole.properties + echo "#ldap-config-base-dn: dc=domain,dc=com" >>/etc/guacamole/guacamole.properties + echo "#ldap-user-base-dn: OU=SomeOU,DC=domain,DC=com" >>/etc/guacamole/guacamole.properties + echo "#ldap-user-search-filter:(objectClass=user)(!(objectCategory=computer))" >>/etc/guacamole/guacamole.properties + echo "#ldap-max-search-results:200" >>/etc/guacamole/guacamole.properties + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Move quick-connect extension files +if [[ "${INSTALL_QCONNECT}" = true ]]; then + echo -e "${GREY}Moving guacamole-auth-quickconnect-${GUAC_VERSION}.jar (/etc/guacamole/extensions/)..." + mv -f guacamole-auth-quickconnect-${GUAC_VERSION}/guacamole-auth-quickconnect-${GUAC_VERSION}.jar /etc/guacamole/extensions/ + chmod 664 /etc/guacamole/extensions/guacamole-auth-quickconnect-${GUAC_VERSION}.jar + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Move history recording storage extension files +if [[ "${INSTALL_HISTREC}" = true ]]; then + echo -e "${GREY}Moving guacamole-history-recording-storage-${GUAC_VERSION}.jar (/etc/guacamole/extensions/)..." + mv -f guacamole-history-recording-storage-${GUAC_VERSION}/guacamole-history-recording-storage-${GUAC_VERSION}.jar /etc/guacamole/extensions/ + chmod 664 /etc/guacamole/extensions/guacamole-history-recording-storage-${GUAC_VERSION}.jar + #Setup the default recording path + mkdir -p ${HISTREC_PATH} + chown daemon:tomcat ${HISTREC_PATH} + chmod 2750 ${HISTREC_PATH} + echo "recording-search-path: ${HISTREC_PATH}" >>/etc/guacamole/guacamole.properties + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Apply a branded interface and dark theme. You may delete this file and restart guacd & tomcat for the default console +echo -e "${GREY}Setting the Guacamole console to a (customisable) dark mode themed template..." +mv branding.jar /etc/guacamole/extensions +chmod 664 /etc/guacamole/extensions/branding.jar +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Restart Tomcat +echo -e "${GREY}Restarting Tomcat service & enable at boot..." +systemctl restart ${TOMCAT_VERSION} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Set Tomcat to start at boot +systemctl enable ${TOMCAT_VERSION} + +# Begin the MySQL database config if only if a local MYSQL install. +if [[ "${INSTALL_MYSQL}" = true ]]; then + # Set MySQL password + export MYSQL_PWD=${MYSQL_ROOT_PWD} + + # Set the root password without a reliance on debconf. + echo -e "${GREY}Setting MySQL root password..." + SQLCODE=" +FLUSH PRIVILEGES; +ALTER USER 'root'@'localhost' IDENTIFIED BY '$MYSQL_ROOT_PWD';" + echo ${SQLCODE} | $DB_CMD -u root + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi + + # Find the location of the MySQL or MariaDB config files. (Add to this list for more potential candidates.) + for x in /etc/mysql/mariadb.conf.d/50-server.cnf \ + /etc/mysql/mysql.conf.d/mysqld.cnf \ + /etc/mysql/my.cnf; do + # Check inside each candidate to see if a [mysqld] or [mariadbd] section exists, assign $x the correct filename. + if [[ -e "${x}" ]]; then + if grep -qE '^\[(mysqld|mariadbd)\]$' "${x}"; then + mysqlconfig="${x}" + # Reduce any duplicated section names, then sanitise the [ ] special characters for sed below) + config_section=$(grep -m 1 -E '^\[(mysqld|mariadbd)\]$' "${x}" | sed 's/\[\(.*\)\]/\1/') + break + fi + fi + done + + # Set the MySQL Timezone + if [[ -z "${mysqlconfig}" ]]; then + echo -e "${GREY}Couldn't detect MySQL config file - you will need to manually configure database timezone settings" + else + # Is there already a timzeone value configured? + if grep -q "^default_time_zone[[:space:]]=" "${mysqlconfig}"; then + echo -e "MySQL database timezone defined in ${mysqlconfig}" + else + timezone=${DB_TZ} + if [[ -z "${DB_TZ}" ]]; then + echo -e "Couldn't find system timezone, using UTC$" + timezone="UTC" + fi + echo -e "Setting MySQL database timezone as ${timezone}${GREY}" + mysql_tzinfo_to_sql /usr/share/zoneinfo 2>/dev/null | ${DB_CMD} -u root -D mysql -p${MYSQL_ROOT_PWD} + # Add the timzone value to the sanitsed server file section name. + sed -i -e "/^\[${config_section}\]/a default_time_zone = ${timezone}" "${mysqlconfig}" + fi + fi + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi + + # This should stay as localhost in most local MySQL install situations. This setting determines from WHERE the new ${GUAC_USER} + # will be able to login to the database (either from specific remote IPs or from localhost only.) + # However this setting can be a quick and hacky way to build a backend guacamole database server for use behind another guacamole + # application server, albeit with the full application suite installed). To do this, set GUAC_USERHost="%" for login access + # from all IPs, (or e.g. 192.168.1.% for an IP range.) You will also need to set the MySQL binding away from the default + # 127.0.0.1 to 0.0.0.0 or a specific external facing network interface to allow remote login. + if [[ "${MYSQL_HOST}" != "localhost" ]]; then + GUAC_USERHost="%" + echo -e "${LYELLOW}${GUAC_USER} is set to accept db logins from any host, you may wish to limit this to specific IPs.${GREY}" + else + GUAC_USERHost="localhost" + fi + + # Execute SQL code to create the Guacamole database + echo -e "${GREY}Creating the Guacamole database..." + SQLCODE=" +DROP DATABASE IF EXISTS ${GUAC_DB}; +CREATE DATABASE IF NOT EXISTS ${GUAC_DB}; +CREATE USER IF NOT EXISTS '${GUAC_USER}'@'${GUAC_USERHost}' IDENTIFIED BY \"${GUAC_PWD}\"; +GRANT SELECT,INSERT,UPDATE,DELETE ON ${GUAC_DB}.* TO '${GUAC_USER}'@'${GUAC_USERHost}'; +FLUSH PRIVILEGES;" + echo ${SQLCODE} | $DB_CMD -u root -D mysql -h ${MYSQL_HOST} -P ${MYSQL_PORT} + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi + + # Add Guacamole schema to newly created database + echo -e "${GREY}Adding database tables..." + cat guacamole-auth-jdbc-${GUAC_VERSION}/mysql/schema/*.sql | $DB_CMD -u root -D ${GUAC_DB} -p${MYSQL_ROOT_PWD} + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Apply Secure MySQL installation settings +if [[ "${SECURE_MYSQL}" = true ]] && [[ "${INSTALL_MYSQL}" = true ]]; then + echo -e "${GREY}Applying mysql_secure_installation settings...${DGREY}" + SECURE_MYSQL=$(expect -c " +set timeout 10 +spawn mysql_secure_installation +expect \"Enter current password for root (enter for none):\" +send \"$MYSQL_ROOT_PWD\r\" +expect \"Switch to unix_socket authentication\" +send \"n\r\" +expect \"Change the root password?\" +send \"n\r\" +expect \"Remove anonymous users?\" +send \"y\r\" +expect \"Disallow root login remotely?\" +send \"y\r\" +expect \"Remove test database and access to it?\" +send \"y\r\" +expect \"Reload privilege tables now?\" +send \"y\r\" +expect eof +") + echo "$SECURE_MYSQL" + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Restart MySQL service +if [[ "${INSTALL_MYSQL}" = true ]]; then + echo -e "${GREY}Restarting MySQL service & enable at boot..." + # Set MySQl to start at boot + systemctl enable mysql + systemctl restart mysql + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Create guacd.conf and localhost IP binding. +echo -e "${GREY}Binding guacd to 127.0.0.1 port 4822..." +cat >/etc/guacamole/guacd.conf <<-"EOF" +[server] +bind_host = 127.0.0.1 +bind_port = 4822 +EOF +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Ensure guacd is started +echo -e "${GREY}Starting guacd service & enable at boot..." +systemctl enable guacd +systemctl stop guacd 2>/dev/null +systemctl start guacd +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Redirect the Tomcat URL to its root to avoid typing the extra /guacamole path (if not using a reverse proxy) +if [[ "${GUAC_URL_REDIR}" = true ]] && [[ "${INSTALL_NGINX}" = false ]]; then + echo -e "${GREY}Redirecting the Tomcat http root url to /guacamole...${DGREY}" + systemctl stop ${TOMCAT_VERSION} + mv /var/lib/${TOMCAT_VERSION}/webapps/ROOT/index.html /var/lib/${TOMCAT_VERSION}/webapps/ROOT/index.html.old + touch /var/lib/${TOMCAT_VERSION}/webapps/ROOT/index.jsp + echo "<% response.sendRedirect(\"/guacamole\");%>" >>/var/lib/${TOMCAT_VERSION}/webapps/ROOT/index.jsp + systemctl start ${TOMCAT_VERSION} + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Update Linux firewall +echo -e "${GREY}Updating firewall rules to allow only SSH and tcp 8080..." +ufw default allow outgoing >/dev/null 2>&1 +ufw default deny incoming >/dev/null 2>&1 +ufw allow OpenSSH >/dev/null 2>&1 +ufw allow 8080/tcp >/dev/null 2>&1 +echo "y" | sudo ufw enable >/dev/null 2>&1 +ufw logging off >/dev/null 2>&1 # Reduce firewall logging noise +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Cleanup +echo -e "${GREY}Cleaning up Guacamole source files...${GREY}" +rm -rf guacamole-* +rm -rf mysql-connector-j-* +rm -rf mariadb_repo_setup +unset MYSQL_PWD +apt-get -y remove expect &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" +fi + +# Done +echo -e ${NC} diff --git a/3-install-nginx.sh b/3-install-nginx.sh new file mode 100644 index 0000000..8c599e5 --- /dev/null +++ b/3-install-nginx.sh @@ -0,0 +1,130 @@ +#!/bin/bash +####################################################################################################################### +# Add Nginx reverse proxy front end to default Guacamole install +# For Ubuntu / Debian / Raspbian +# 3 of 4 +# David Harrop +# August 2023 +####################################################################################################################### + +# If run as standalone and not from the main installer script, check the below variables are correct. +# To run standalone: sudo -E ./3-install-nginx.sh + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +echo +echo +echo -e "${LGREEN}Installing Nginx...${DGREY}" +echo + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +PROXY_SITE= +INSTALL_LOG= +GUAC_URL= + +# Install Nginx +apt-get update -qq >/dev/null +apt-get install nginx -qq -y &>>${INSTALL_LOG} + +echo -e "${GREY}Configuring Nginx as a reverse proxy for Guacamole's Apache Tomcat front end...${DGREY}" +# Configure /etc/nginx/sites-available/(local dns site name) +cat <&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Force nginx to require tls1.2 and above +sed -i -e '/ssl_protocols/s/^/#/' /etc/nginx/nginx.conf +sed -i "/SSL Settings/a \ ssl_protocols TLSv1.2 TLSv1.3;" /etc/nginx/nginx.conf + +# Symlink new reverse proxy site config from sites-available to sites-enabled +ln -s /etc/nginx/sites-available/$PROXY_SITE /etc/nginx/sites-enabled/ + +# Make sure the default Nginx site is unlinked +unlink /etc/nginx/sites-enabled/default + +# Do mandatory Nginx tweaks for logging actual client IPs through a proxy IP of 127.0.0.1 - DO NOT CHANGE COMMAND FORMATING! +echo -e "${GREY}Configuring Apache Tomcat valve for pass through of client IPs to Guacamole logs...${GREY}" +sed -i '/pattern="%h %l %u %t "%r" %s %b"/a \ \n ' /etc/$TOMCAT_VERSION/server.xml +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Allow large file transfers through Nginx +sed -i '/client_max_body_size/d' /etc/nginx/nginx.conf # remove this line if it already exists to prevent duplicates +sed -i "/Basic Settings/a \ client_max_body_size 1000000000M;" /etc/nginx/nginx.conf # Add larger file transfer size, should be enough! +echo -e "${GREY}Boosting Nginx's 'maximum body size' parameter to allow large file transfers...${GREY}" +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Update general ufw rules so force traffic via reverse proxy. Only Nginx and SSH will be available over the network. +echo -e "${GREY}Updating firewall rules to allow only SSH and tcp 80/443..." +ufw default allow outgoing >/dev/null 2>&1 +ufw default deny incoming >/dev/null 2>&1 +ufw allow OpenSSH >/dev/null 2>&1 +ufw allow 80/tcp >/dev/null 2>&1 +ufw delete allow 8080/tcp >/dev/null 2>&1 +echo "y" | sudo ufw enable >/dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Reload everything +echo -e "${GREY}Restaring Guacamole & Ngnix..." +systemctl restart $TOMCAT_VERSION +systemctl restart guacd +systemctl restart nginx +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" +fi + +# Done +echo -e ${NC} diff --git a/4a-install-tls-self-signed-nginx.sh b/4a-install-tls-self-signed-nginx.sh new file mode 100644 index 0000000..187af89 --- /dev/null +++ b/4a-install-tls-self-signed-nginx.sh @@ -0,0 +1,270 @@ +#!/bin/bash +####################################################################################################################### +# Add self-signed TLS certificates to Guacamole with Nginx reverse proxy +# For Ubuntu / Debian / Raspbian +# 4a of 4 +# David Harrop +# April 2023 +####################################################################################################################### + +# This script can be run multiple times to either install or update TLS settings and certificates. + +# Change the name of the site or add/renew TLS certs by specifying command line arguments [dns.name] [cert-lifetime] [IP] +# e.g. sudo -E ./4a-install-tls-self-signed-nginx.sh proxy.domain.local 365 192.168.1.50 + +# Alternatively, run the script without any command arguments and the default variables below will apply +# e.g. sudo -E ./4a-install-tls-self-signed-nginx.sh + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +# Set default certificate file destinations. +DIR_SSL_CERT="/etc/nginx/ssl/cert" +DIR_SSL_KEY="/etc/nginx/ssl/private" + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +DOWNLOAD_DIR= +CERT_COUNTRY= +CERT_STATE= +CERT_LOCATION= +CERT_ORG= +CERT_OU= +GUAC_URL= +INSTALL_LOG= +PROXY_SITE= +CERT_DAYS= +DEFAULT_IP= +RSA_KEYLENGTH= + +# Create a place to save the certs so we don't overwrite any earlier versions +CERT_DIR_NAME=tls-certs-$(date +%y.%m.%d) +CERT_DIR=$DOWNLOAD_DIR/$CERT_DIR_NAME +mkdir -p $CERT_DIR +cd $CERT_DIR + +# Setup script cmd line arguments for proxy site and certificate days +TLSNAME=$1 +TLSDAYS=$2 +TLSIP=$3 + +# Assume the values set by the main installer if the script is run without any command line options +if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then + TLSNAME=$PROXY_SITE + TLSDAYS=$CERT_DAYS + TLSIP=$DEFAULT_IP +fi + +echo +echo +echo -e "${LGREEN}Setting up self-signed TLS certificates for Nginx...${GREY}" +echo + +# Make directories to place TLS Certificate if they don't exist +if [[ ! -d $DIR_SSL_KEY ]]; then + mkdir -p $DIR_SSL_KEY +fi + +if [[ ! -d $DIR_SSL_CERT ]]; then + mkdir -p $DIR_SSL_CERT +fi + +echo -e "${GREY}New self-signed TLS certificate attributes are shown below...${DGREY}" +# Display the new TLS cert parameters. +cat <&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Place TLS Certificate into the defined application path +cp $TLSNAME.key $DIR_SSL_KEY/$TLSNAME.key +cp $TLSNAME.crt $DIR_SSL_CERT/$TLSNAME.crt + +# Create a PFX formatted key for easier import to Windows hosts +echo -e "${GREY}Converting client certificate to Windows pfx format...${GREY}" +openssl pkcs12 -export -out $TLSNAME.pfx -inkey $TLSNAME.key -in $TLSNAME.crt -password pass:1234 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Change of permissions so certs can be copied via WinSCP. +chown $SUDO_USER:root $TLSNAME.pfx +chown $SUDO_USER:root $TLSNAME.crt +chown $SUDO_USER:root $TLSNAME.key + +# Backup the previous configuration +if [ -f "/etc/nginx/sites-enabled/${TLSNAME}" ]; then + echo -e "${GREY}Backing up previous Nginx proxy config to $DOWNLOAD_DIR/${PROXY_SITE}-nginx.bak" + cp -f /etc/nginx/sites-enabled/${TLSNAME} $DOWNLOAD_DIR/${TLSNAME}-nginx.bak +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Warning: Failed to copy the Nginx site config.${GREY}" 1>&2 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi +fi + +# Update Nginx config to accept the new certificates +echo -e "${GREY}Configuring Nginx proxy to use the self-signed TLS certificate and setting up HTTP redirect...${DGREY}" +cat <&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Find all enabled sites containing the $GUAC_URL and remove them to avoid conflicts +for x in /etc/nginx/sites-enabled/*; do + # Check inside each enabled site to see if the $GUAC_URL exists. + if [[ -f "${x}" ]]; then + if grep -qE "${GUAC_URL}" "${x}"; then + found_sites+=("${x}") + fi + fi +done + +# Unlink all previous sites pointed to $GUAC_URL +if [ "${#found_sites[@]}" -gt 0 ]; then + for guacUrl in "${found_sites[@]}"; do + unlink "${guacUrl}" + done +fi + +# Link to enable the new site configuration +ln -s /etc/nginx/sites-available/$TLSNAME /etc/nginx/sites-enabled/ >/dev/null 2>&1 + +# Update general ufw rules so force traffic via reverse proxy. Only Nginx and SSH will be available over the network. +echo -e "${GREY}Updating firewall rules to allow only SSH and tcp 80/443..." +ufw default allow outgoing >/dev/null 2>&1 +ufw default deny incoming >/dev/null 2>&1 +ufw allow OpenSSH >/dev/null 2>&1 +ufw allow 80/tcp >/dev/null 2>&1 +ufw allow 443/tcp >/dev/null 2>&1 +echo "y" | sudo ufw enable >/dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Reload everything and tidy up +echo -e "${GREY}Restaring Guacamole & Ngnix..." +systemctl restart $TOMCAT_VERSION +systemctl restart guacd +systemctl restart nginx +rm -f cert_attributes.txt +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# A simple hack to display special characters in a cut & paste-able format directly to stdout. +SHOWASTEXT1='$mypwd' +SHOWASTEXT2='"Cert:\LocalMachine\Root"' + +printf "${GREY}+------------------------------------------------------------------------------------------------------------- +${LGREEN}+ WINDOWS CLIENT SELF SIGNED TLS BROWSER CONFIG - SAVE THIS BEFORE CONTINUING!${GREY} ++ ++ 1. In $CERT_DIR is a Windows version of the new certificate ${LYELLOW}$TLSNAME.pfx${GREY} ++ 2. Import this PFX file into your Windows client with the below PowerShell commands (as Administrator): +\n" +echo -e "${SHOWASTEXT1} = ConvertTo-SecureString -String "1234" -Force -AsPlainText" +echo -e "Import-pfxCertificate -FilePath $TLSNAME.pfx -Password "${SHOWASTEXT1}" -CertStoreLocation "${SHOWASTEXT2}"" +printf "${GREY}+------------------------------------------------------------------------------------------------------------- +${LGREEN}+ LINUX CLIENT SELF SIGNED TLS BROWSER CONFIG - SAVE THIS BEFORE CONTINUING!${GREY} ++ ++ 1. In $CERT_DIR is a new Linux native OpenSSL certificate ${LYELLOW}$TLSNAME.crt${GREY} ++ 2. Import the CRT file into your Linux client certificate store with the below command: +\n" +echo -e "(If certutil is not installed, run apt-get install libnss3-tools)" +echo -e "mkdir -p $HOME/.pki/nssdb && certutil -d $HOME/.pki/nssdb -N" +echo -e "certutil -d sql:$HOME/.pki/nssdb -A -t "CT,C,c" -n $TLSNAME -i $TLSNAME.crt" +printf "+-------------------------------------------------------------------------------------------------------------\n" +echo -e "${LYELLOW}The above TLS browser config instructions are saved in ${LGREEN}$INSTALL_LOG${GREY}" + +# Done +echo -e ${NC} diff --git a/4b-install-tls-letsencrypt-nginx.sh b/4b-install-tls-letsencrypt-nginx.sh new file mode 100644 index 0000000..ff7af50 --- /dev/null +++ b/4b-install-tls-letsencrypt-nginx.sh @@ -0,0 +1,146 @@ +#!/bin/bash +####################################################################################################################### +# Add Let's Encrypt TLS Certificates to Guacamole with Nginx reverse proxy +# For Ubuntu / Debian / Raspbian +# 4b of 4 +# David Harrop +# April 2023 +####################################################################################################################### + +# If run as standalone and not from the main installer script, check the below variables are correct. +# To run standalone: sudo -E ./4b-install-tls-letsencrypt-nginx.sh + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +DOWNLOAD_DIR= +PROXY_SITE= +GUAC_URL= +LE_DNS_NAME= +LE_EMAIL= +INSTALL_LOG= + +echo +echo +echo -e "${LGREEN}Installing Let's Encrypt TLS configuration for Nginx...${GREY}" +echo + +# Install nginx +apt-get update -qq >/dev/null +apt-get install nginx certbot python3-certbot-nginx -qq -y &>>${INSTALL_LOG} + +# Backup the current Nginx config +echo +echo -e "${GREY}Backing up previous Nginx proxy to $DOWNLOAD_DIR/$PROXY_SITE-nginx.bak" +cp /etc/nginx/sites-enabled/${PROXY_SITE} $DOWNLOAD_DIR/${PROXY_SITE}-nginx.bak +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Configure Nginx to accept the new certificates +echo -e "${GREY}Configuring Nginx proxy for Let's Encrypt TLS and setting up automatic HTTP redirect...${GREY}" +cat >/etc/nginx/sites-available/$PROXY_SITE <&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Update general ufw rules to force traffic via reverse proxy. Only Nginx and SSH will be available over the network. +echo -e "${GREY}Updating firewall rules to allow only SSH and tcp 80/443..." +ufw default allow outgoing >/dev/null 2>&1 +ufw default deny incoming >/dev/null 2>&1 +ufw allow OpenSSH >/dev/null 2>&1 +ufw allow 80/tcp >/dev/null 2>&1 +ufw allow 443/tcp >/dev/null 2>&1 +echo "y" | sudo ufw enable >/dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Reload the new Nginx config so as certbot can read the new config and update it +systemctl restart nginx + +# Run certbot to create and associate certificates with current public IP (must have tcp 80 and 443 open to work!) +certbot --nginx -n -d $LE_DNS_NAME --email $LE_EMAIL --agree-tos --redirect --hsts +echo -e +echo -e "${GREY}Let's Encrypt successfully installed, but check for any errors above (DNS & firewall are the usual culprits).${GREY}" +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Select a random daily time to schedule a daily check for a Let's Encrypt certificate due to expire in next 30 days. +# If due to expire within a 30 day window, certbot will attempt to renew automatically renew each day. +echo -e "${GREY}Scheduling automatic certificate renewals for certificates with < 30 days till expiry.)${GREY}" +#Dump out the current crontab +crontab -l >cron_1 +# Remove any previosly added certbot renewal entries +sed -i '/# certbot renew/d' cron_1 +# Randomly choose a daily update schedule and append this to the cron schedule +HOUR=$(shuf -i 0-23 -n 1) +MINUTE=$(shuf -i 0-59 -n 1) +echo "${MINUTE} ${HOUR} * * * /usr/bin/certbot renew --quiet --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx'" >>cron_1 +# Overwrite old cron settings and cleanup +crontab cron_1 +rm cron_1 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Reload everything once again +echo -e "${GREY}Restarting Guacamole & Ngnix..." +systemctl restart $TOMCAT_VERSION +systemctl restart guacd +systemctl restart nginx +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" +fi + +# Done +echo -e ${NC} diff --git a/ACTIVE-DIRECTORY-HOW-TO.md b/ACTIVE-DIRECTORY-HOW-TO.md new file mode 100644 index 0000000..a725635 --- /dev/null +++ b/ACTIVE-DIRECTORY-HOW-TO.md @@ -0,0 +1,101 @@ +# Integrating Guacamole With Active Directory + +## :arrows_clockwise: **Step 1: Ensure two-way LDAP traffic is available to the Guacamole application server** + +- If Guacamole is operating in a separate network from your Active Directory Servers, allow TCP 389 between all Guacamole application servers and all Active Directory Domain Controllers nominated in the config script settings below. + +## :key: **Step 2: Establish the required accounts to bind with Active Directory** + +- An account with only **Domain Users** rights is sufficient for Guacamole to read and bind with Active Directory. + + - a. In the Guacamole application, create a new Guacamole account with full admin rights to the Guacamole application, e.g., `guacbind-ad`, and assign it an appropriately strong password. (Then log in with this new account and disable the default guacadmin account) + - b. Create a new Active Directory domain account with EXACTLY THE SAME NAME as the new full admin account named above, only this time assign a DIFFERENT strong password than what was used above. + +## :pencil: **Step 3: Edit the provided configuration script to reflect your specific Active Directory environment** + +Below is the EXACT format to follow in editing the `$USER_HOME_DIR/guac-setup/add-ldap-auth-guacamole.sh` script. Be careful not to introduce new lines, spaces at the ends of lines, or carriage returns, as anything outside of this format will cause the LDAP auth extension to fail. You have been warned! + +``` +ldap-hostname: dc1.yourdomain.com dc2.yourdomain.com dc3.yourdomain.com +ldap-port: 389 +ldap-username-attribute: sAMAccountName +ldap-encryption-method: none +ldap-search-bind-dn: guacbind-ad@yourdomain.com +ldap-search-bind-password: guacbind-ad-password +ldap-config-base-dn: dc=yourdomain,dc=com +ldap-user-base-dn: OU=SomeOU,DC=yourdomain,DC=com +ldap-user-search-filter:(objectClass=user)(!(objectCategory=computer)) +ldap-max-search-results:200 +mysql-auto-create-accounts: true +``` + +**Edit only the following values from the above example to suit your environment, then save the script:** + +``` +ldap-hostname: +ldap-search-bind-dn: +ldap-search-bind-password: +ldap-config-base-dn: +ldap-user-base-dn: +mysql-auto-create-accounts: true +ldap-max-search-results:200 +``` + +- **_Important note on `ldap-user-base-dn:`_** This value sets a position in the directory as a relative root to search within. All Guacamole users to be authenticated by Active Directory must be placed in a lower position within the directory tree than this value. This line can be added multiple times to more efficiently search across multiple branches of a directory tree. + +- **_Important note on `ldap-max-search-results:`_** Yes, there is no space before the `:200` value. In larger environments managing the directory efficiently requires that we don't query every object in the tree for every user lookup. You may need to adjust this number depending on the number of objects in your tree. + +- **_Important note on `mysql-auto-create-accounts:`_** This line is optional and can be deleted. This line ensures that all Active Directory user accounts will have a matching user account created in the Guacamole db at first logon. Local Guacamole accounts are NOT necessarily needed for access to Guacamole connections - these are only necessary when deploying MFA or you want to assign other settings specific to individual users. Domain users can be provisioned access to Guacamole sessions connections without creating local users in the Guacamole db. For many use cases, manually creating a small number of Guacamole user accounts to match their domain accounts may be more preferable than all users inheriting access to establish a local account in the Guacamole db. See below for manual account setup. + +## :computer: **Step 4: Run the (now customised) LDAP configuration script** + +```shell +sudo $USER_HOME_DIR/guac-setup/add-ldap-auth-guacamole.sh +``` + + - There is an extra step if you are using TLS with your AD: + +``` +# First, import your AD TLS cert. +openssl s_client -connect X.X.X.X:389 \ + -starttls ldap \ + -showcerts < /dev/null | \ + openssl x509 -text | \ + sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' ` + +# Next, copy the certificate contents shown on screen from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE----- and place this in a file +sudo nano /etc/ssl/certs/adcert.pem + +# Now to import the AD cert into the Java keystore +sudo keytool -importcert -alias adcert \ + -file /etc/ssl/certs/adcert.pem \ + -keystore /usr/lib/jvm/java-11-openjdk-amd64/lib/security/cacerts \ + -storepass changeit \ + -noprompt ` + +# Restart Apache Tomcat +systemctl restart tomcat9 +``` + +## :door: **Step 5: Logging on to Guacamole with the new guacbind-ad account** + +- When logging in to Guacamole as the new Active Directory account and password created above, that domain user now passed through to Guacamole as both a Guacamole admin and a Domain User. If all is working correctly, all the users located below the directory tree position set in **ldap-user-base-dn** will be listed under **Settings | Users** of the Guacamole management console. + +## :busts_in_silhouette: **Step 6: Manually creating and configuring new Guacamole users for Active Directory authentication** + +- If not using the **mysql-auto-create-accounts** directive, manually re-create the exact user account names in Guacamole as those in the directory you wish to give Guacamole access. **DO NOT configure a Guacamole password for any users that will be exclusively authenticating via Active directory**. Guacamole local user accounts without a password are first given an MFA challenge by the local Guacamole application (only if MFA is configured for that user) and then will be brokered to Active Directory for their authentication challenge. Guacamole local user accounts that are given passwords in Guacamole will always refer to the local db for authentication, never Active Directory. This design allows for a matrix of local, domain, MFA & non-MFA access use cases to be deployed. + +## :key: **Step 7: Logging on using either the local vs. the domain guacbind-ad account** + +- As described above, logging on with the Guacamole admin user password will authenticate with the local Guacamole admin account, conversely if the Guacamole admin domain account password is given, the domain account is authenticated via Active Directory and then passed through as authorized to administer Guacamole. It may sometimes be necessary to log on with the local Guacamole admin account to manage some application functions, but be aware that when doing so you will not be able to view and search the user list from Active Directory. Only when logged on with the domain version of the Guacamole admin account can domain user permissions to various Guacamole sessions and objects be delegated and managed. + +## :gear: **Step 8: Creating a quasi Single Sign-On user experience for Windows RDP access** + +- Create a Global Security domain group (e.g., Guac_Users) and populate it with selected domain users as required. +- Now add this new security group to the built-in “Remote Desktop Users” domain group. +- Next, for each connection profile you wish to create the SSO experience and behavior, _parameter_ _tokens_ must be used in place of hard-coded usernames and password values as follows... + - Add the parameter token `${GUAC_USERNAME}` to the Username field for each connection profile + - Add the parameter token `${GUAC_PASSWORD}` to the Password field for each connection profile +- If the user has been given directory rights to the Guacamole session object, Guacamole will first authenticate the user to the Guacamole application (via a brokered Active Directory challenge) and then seamlessly pass the user's same domain credentials through to the Guacamole remote desktop session, thus avoiding any further remote desktop authentication prompts. +- For more info on other dynamic connection settings see [Guacamole Documentation](https://guacamole.apache.org/doc/gug/configuring-guacamole.html#parameter-tokens) +- For full SSO, the SAML authentication extension must be used. As the Guacamole SAML extension requires a very bespoke approach to configuring login providers and login behaviors, the SAML authentication feature is beyond the scope of this project. If your organization already uses SAML within your infrastructure then you likely already know what to do to implement. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fe6b903 --- /dev/null +++ b/LICENSE @@ -0,0 +1,662 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e469f5 --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +# +

:avocado: Guacamole 1.5.3 Appliance Auto Installer Script

+

+ License +

+ +This suite of build and management scripts makes setting and operating Guacamole a breeze. Its got installer support for TLS reverse proxy (self sign or LetsEncrypt), Active Directory integration, multi-factor authentication, Quick Connect & History Recording Storage UI enhancements, a custom UI theme creation template with dark mode as default, auto database backup, O365 email alerts, internal daemon security hardening options and even a fail2ban policy for defence against brute force attacks. There's also code in here to get you up and running with an enterprise deployment approach very similar to [Amazon's Guacmole Bastion Cluster](http://netcubed-ami.s3-website-us-east-1.amazonaws.com/guaws/v2.3.1/cluster/), if that's your thing! + +## Automatic Installation + + To start building your Guacamole appliance, paste the below link into a terminal and just follow the option prompts **(no need for sudo, but you must be a member of the sudo group)**: + +```shell +wget https://raw.githubusercontent.com/itiligent/Guacamole-Install/main/1-setup.sh && chmod +x 1-setup.sh && ./1-setup.sh +``` +## Docker Image Creation +For customised & branded Docker builds, unattended installation options are available. Read on... + +## Prerequisites (Yes! Debian 12 is now supported!) + + **Before diving in, make sure you have:** + +- **A compatible OS:** + - **Debian 12, 11 or 10** + - **Ubuntu 23.04, 22.04, 20.04 & 18.04** + - **Raspbian Buster & Bullseye** + - **Official vendor cloud images equivalent to the above.** +- **1 CPU core + 2GB RAM for every 25 users (plus minimum RAM & disk space for your selected OS).** +- **Open TCP ports: 22, 80, and 443** +- **If selecting the reverse proxy with TLS option, internal DNS entries for the internal proxy site (and an additional public DNS entry with the LetsEncypt option).** + +## Installation Menu + + **The main script guides you through the installation process in the following steps:** + +1. Confirm your system hostname and local DNS domain suffix. (Must be consistent for TLS proxy) +2. Choose a locally installed or remote MySQL instance, set database security preferences. +3. Pick an authentication extension: DUO, TOTP, LDAP, or none. +4. Select optional console features: Quick Connect & History Recorded Storage UI integrations. +5. Decide on the Guacamole front end: Nginx reverse proxy (http or https) or keep the native Guacamole interface + - If you opt to install Nginx with self signed TLS: + - New server and client browser certificates are backed up to `$HOME/guac-setup/tls-certs/[date-time]` + - Pay attention to on-screen instructions for client certificate import (no more pesky browser warnings). + +## Managing self signed TLS certs with Nginx (the easy way!) + + - **To renew certificates, or to change the reverse proxy local dns name and/or IP address:** + - Just re-run `4a-install-tls-self-signed-nginx.sh` as many times as you like (accompanying server and browser client certs will also be updated). Look this script's comments for further command line argument options. + - Remember to clear your browser cache after changing certificates. + +## Active Directory Integration + + **Need help with Active Directory authentication?** Check [here](https://github.com/itiligent/Guacamole-Install/blob/main/ACTIVE-DIRECTORY-HOW-TO.md). + +## Customise & Brand Your Guacamole Theme + + **Want to give Guacamole your personal touch? Follow the theme and branding instructions** [here](https://github.com/itiligent/Guacamole-Install/tree/main/custom-theme-builder). + - To revert to the Guacamole default theme, simply delete the branding.jar file from /etc/guacamole/extensions + +## Installation Instructions + + + +### **Paste and run the wget autorun link, thats it! *But if* you want to make Guacamole your own and customise...** +**Exit `1-setup.sh` at the first prompt**. All the configurable options are clearly noted at the start of `1-setup.sh`. Certain combinations of setup script edits will even produce an unattended install! + +**Other useful install notes:** +- **Caution: Be aware that running the auto-run link again re-downloads the suite of scripts and will overwrite your changes. You must run setup locally after editing the setup script.** (Also be sure to comment out the download links in the setup script for any other scripts you edit, but there's really no need to touch these - see the next point... + - Many of the scripts in the suite are **automatically adjusted with your chosen installation settings** to form a matched & transportable set. This allows you to add or update features after installation whilst avoiding mismatches with the original install. Editing any scripts other than the main setup may break this function. +- Nginx is automatically configured to use TLS 1.2 or above (so really old browser versions may not work.) +- A daily MySQL backup job will be automatically configured under the script owner's crontab. +- **Security info:** The Quick Connect option brings a few extra security implications; so be aware of potential risks in your particular environment. + +**For the more security minded, there's several post-install hardening script options available:** + +- `add-fail2ban.sh`: Adds a lockdown policy for Guacamole to guard against brute force attacks. +- `add-tls-guac-daemon.sh`: Wraps internal server daemon <--> guac application traffic in TLS. +- `add-auth-ldap.sh`: A template script for Active Directory integration. +- `add-smtp-relay-o365.sh`: A template script for email alerts integrated with MSO65 (BYO app password). + +## Upgrading Guacamole + + To upgrade Guacamole, edit `upgrade-guac.sh` to relfect the latest versions of Guacamole and MySQL connector/J before running it. This script will also automatically update the installed extensions too. + +## High Availability (Or Docker Multi-Container) Deployments + + For Enterprise (or custom Docker) deployments, did you know that Guacamole can be run in a load balanced farm with physical/logical separation between TLS, application and database layers? To achieve this, the MySQL, Guacamole and Nginx front end components are typically split into 3 systems or containers. (VLANs & firewalls between these layers helps greatly with security too.) + + A simple benefit of using a separate MySQL backend server or container means you can upgrade and test whilst keeping all your data and connection profiles intact. Just point this installer (or point a fresh Docker application container) to your MySQL instance and immediately all your connection profiles and settings are right there! + +- **For the DATABASE layer:** Find the included `install-mysql-backend-only.sh` [here](https://github.com/itiligent/Guacamole-Install/tree/main/guac-enterprise-build) to install a standalone instance of the Guacamole MySQL database for your backend. +- **For the APPLICATION layer:** Simply use the main setup script to build as many application servers as you like, just use the main installer to point new installations to the remote backend database, making sure to **say no to both the "Install MySQL locally" option and any proxy install options**. +- **For the Front end**: There are so many choices available that are already very well documented. You could even use the Nginx scripts to build a separate TLS front end layer. Be aware that [HA Proxy](https://www.haproxy.org/) generally provides far superior session persistence/affinity under load balanced conditions [when compared to Open Source Nginx](https://www.nginx.com/products/nginx/compare-models/) as only Nginx Plus subscribers get all the proper load balancing stuff! + +### Installer script download manifest + + The autorun link downloads these repo files into `$HOME/guac-setup`: + +Where noted, below scripts can be run to add extra features that were selected during the initial install. + +- `1-setup.sh`: The installation script. +- `2-install-guacamole.sh`: Guacamole main source build installation script. +- `3-install-nginx.sh`: Installs Nginx for reverse proxy if not added at install. +- `4a-install-tls-self-signed-nginx.sh`: Configures or updates self-signed TLS for Nginx if not added at install. +- `4b-install-tls-letsencrypt-nginx.sh`: Installs Let's Encrypt for Nginx if not added at install +- `add-auth-duo.sh`: Installs Duo MFA extension if not added at install. +- `add-auth-ldap.sh`: Installs Active Directory extension if not added at install. +- `add-auth-totp.sh`: Adds TOTP MFA extension if not added at install. +- `add-xtra-quickconnect.sh`: Adds Quick Connect console extension if not added at install. +- `add-xtra-histrecstore.sh`: Adds History Recorded Storage extension if not added at install. +- `add-smtp-relay-o365.sh`: Sets up SMTP auth relay with O365 for backup messages, monitoring & alerts (BYO app password). +- `add-tls-guac-daemon.sh`: Adds TLS wrapper for guacd server daemon to Guacamole client app internal traffic. +- `add-fail2ban.sh`: Adds a fail2ban policy for brute force attack protection. +- `backup-guacamole.sh`: A MySQL Guacamole backup script. +- `upgrade-guac.sh`: Upgrades Guacamole, all installed extensions and the MySQL connector. +- `branding.jar`: An example template for customising Guacamole's UI theme. Delete to from /etc/guacamole/extensions to keep the default UI. + +Happy Guacamole-ing! 😄🥑 diff --git a/branding.jar b/branding.jar new file mode 100644 index 0000000000000000000000000000000000000000..1e4f1a64979e0c2a09396d9e7c169e1b0783551b GIT binary patch literal 19175 zcmagF1CS;`w=Md8ZBN^_J#9_fwr$(p)3z~f_q1)>wr$&Z^PhX;o%3$I7q2R^GAeWJ zipsq+_o}K`B`*aEh6;d!f&!!>QK$j_#|8}m1IUOd|DuzS6=nDu0{}n)@=}mc|3QHK zZW*nc{S3p+S?ENfEL?fVr-t(UHX?d&Q`fVBQJZrOAq( zs?SCwmI*xIODMjFs~Mx|)+Qe=>w9r)AONkN=DT zHM*8P;NKnY|11AJhFswP(*el;dd*x6jOc6(Y%NSpoSf+`o$PFrBppYCUy6CjGJ3}2Y%3FDDXiZ%)6IoKTy zRCh>i(|?>cx7+KB|C)WsLwBzsFbp8~RZ8SKnKs7`g*{uv$|A<5!fHdi1amll^!AMs zsw+ZS30A=|&`qlvQD)RwTq7Q;{0bbJOi6-VG>~sb%Tz!j0|AiJn`!A&b@dOM2 z@Grvl|Ho7S`-d=ca$@*zUs?Yji2uanPB5#g-4rkpKWJa zGKu#p1+8L1@*<3Ol#VTEWkV&#koh|4>x-D`A+GB^GMmvMAteI zCiC52r3!Zcr&1Rd@sJsbgD*Cw|)Px7gSUPML(8IPI3__;!|C3U9K1VRe(6qCl`q?aFKmB!R!77O=_-uzlc9;;D%UwApWI8 zk82fWFh{o?xP75KceKGBbSyV6l4n5Q?pDjG#s%E?EO?QKLgum1zS~QMee(HB^oexU zx{FTYmp@@Pin3gIES?e>bPbwkXxf@^ei+cM?cF>K!q-yriD~<5s)b`U(FFfD-zqI4 z7o_u`4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sEbtGq3 zQ}%MmdJHUdS+8bsFz9z9x9$NdFos2D!%N53Z=FvA{)dJnu!nZp+*|Q%nb}@6j|7eH&4lnCekJG1FNX)>M#mn`YTKc+?+^E5 zgQ6)D2Yn7KKXyzdHor*qX*{h?xo^iQB&+mhF$@AT&d663diRi?w^|t!I(m!1P%eunM)T3zPK1 z-q!0eOZ+s>co~6?MNnqV5AtS`j@GdSZvtBR$QytK`yxx7g27&BtEUA%fpr}DWj6DU zW&xv?;2iIx__bX^%}!HQs$=xl@8hJD@pLk46`}B)K5+G_L6@zsrv>rI8i4&r4VdD! z<;Q(XKHn)S_eGDOF$sKbafvQd8o(c8`$u*GnL0p1zZ`H^=cDAuG5fER zN+H8?gGbt#sG&UyQBww?eI2~AnNc7Eslr1&gTn$n!~H{o|Bh53B(Q9_)hGBbUd_+r zWA*@ClW67cpee2+uG!Z-oBMP`T63%0&clcA6rKR7=}^TRpkcHLB%?4R_K_LeOaU585mhrSJ$xza9kW z^ovx49wgd=&`uVm*T}8Qp)(llf3bUndP(5_Gj7(Kkb>s)AL7mWbcM_tQMAOyG3$L+ zY$o7{_PP1-LjJf&3_+FZFF=a*ZiN#St&R(k6zd@lwISl73(Mh~S4q^4-?&Pd+8e~5 z%jui-qNyr0?bpM@XrunKh5vU`7H0H%BwB4s+Rc57rryT&uGlR7obMEpxUk|6NI_dZ L^h^w_g;#$9cgOc? literal 0 HcmV?d00001 diff --git a/guac-custom-theme-builder/META-INF/MANIFEST.MF b/guac-custom-theme-builder/META-INF/MANIFEST.MF new file mode 100644 index 0000000..84bd8bc --- /dev/null +++ b/guac-custom-theme-builder/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Name: branding +Specification-Title: Custom Guacamole Theme CSS +Specification-Version: 1.0 +Implementation-Title: Custom Guacamole Theme CSS +Implementation-Version: 1.0 + + diff --git a/guac-custom-theme-builder/README.MD b/guac-custom-theme-builder/README.MD new file mode 100644 index 0000000..081ad80 --- /dev/null +++ b/guac-custom-theme-builder/README.MD @@ -0,0 +1,23 @@ + +## Custom branding & theme instructions ## + +1. Install the Java JDK: `sudo apt update && sudo apt -y install default-jdk` +3. Modify `custom-theme.css` ,`guac-manifest.json`, `en.json` & `META-INF` as desired & add your logos to the images directory. (Logos must be .png files.) +4. To commit your changes, run the below commands from within the custom-theme-builder directory, then refresh your browser to re-login to Guacamole: +``` +# Run within the custom-theme-builder directory +jar cfmv branding.jar META-INF/MANIFEST.MF guac-manifest.json css images translations META-INF +sudo mv branding.jar /etc/guacamole/extensions +sudo chmod 664 /etc/guacamole/extensions/branding.jar +TOMCAT=$(ls /etc/ | grep tomcat) +sudo systemctl restart guacd && sudo systemctl restart ${TOMCAT} +``` + +## Theme customisation hints: ## + - Do not change any of the theme's directory structure or file names. File contents can be carefully edited according to the following constraints: + - `MANIFEST.MF`: All values in here can be updated. Be aware that the "Name:" value MUST use same value in front of the the .jar creation command shown above in the 1st line e.g. `Name: branding` expects branding.jar + - `guac-manifest.json`: The "name:" value in here can be changed to anything. The "namespace:" value MUST match the namespace image path line found in `custom-theme.css`, eg.`background-image: url('app/ext/custom-namespace/images/logo.png');` + - It is preferable to give css a range of logo sizes as shown in the template. The "smallIcon" value in `guac-manifest.json` is used for browser tab favicons. As such this file can be kept to < 80x80 pixels. The example used is 64x64 pixels. + - Within `custom-theme.css`, you may need to experiment with the the height and width values under `.login-ui .login-dialog .logo` to scale your particular logo neatly within the dialog box. Another option is to make the login dialog box larger. Under `.login-ui .login-dialog`, experiment with adding a `max-width: 4in;` or similar. There's a ton of css options available and this template is just starting point, Google is your friend! + - An easy way to debug and preview potential style changes is to tweak various values by setting your browser to developer mode. + - Your changes may occasionally appear not to update, if so clear your browser cache before doing any further debugging. diff --git a/guac-custom-theme-builder/css/custom-theme.css b/guac-custom-theme-builder/css/custom-theme.css new file mode 100644 index 0000000..2e5f12e --- /dev/null +++ b/guac-custom-theme-builder/css/custom-theme.css @@ -0,0 +1,245 @@ +/* Colour codes used */ +/* Guacamole grassy green: #88bf5b */ +/* Warning red #ff2233 */ +/* Main background charcoal #3f3f3f */ +/* Input fields dark charcoal #2b2b2b */ +/* Login dialog background black #000000 */ +/* All text: #ececec */ + + +/* General Style */ +body { + color: #ececec; + background-color: #3f3f3f; +} +pre { + color: #ececec; + background-color: #2b2b2b; + border: 1px solid #000000; +} + +a[href]:visited { + color: #88bf5b; +} +a[href] { + color: #88bf5b; +} + +div.location, +input[type=text], +input[type=email], +input[type=number], +input[type=password], +textarea { + background-color: #2b2b2b; + color: #ececec; +} + + +/* Login */ +div.login-ui { + color: #ececec; + background-color: #3f3f3f; +} +.login-ui .login-fields .labeled-field input:focus { + background-color: #3f3f3f; + color: #ececec; +} + +.login-ui .login-fields .labeled-field { + background-color: #3f3f3f; + color: #ececec; +} + +.login-ui .login-dialog .logo { + background-image: url('app/ext/custom-namespace/images/logo.png'); + width: 7em; + height: 7em; + -webkit-background-size: 7em auto; + +} + +.login-ui .login-dialog { + background-color: #000000; + color: #ececec; +} + +.login-ui .login-dialog .version .app-name { + font-weight: 300; + text-transform: none; + text-align: center; + font-size: 2.25em; + color: #ececec; + font-family: arial black, sans-serif; +} + +div.logged-out-modal .ng-scope { + color: #ececec; + background-color: #000000; +} + +div.logged-out-modal .ng-scope button { + color: #ececec; + background-color: #3f3f3f; + border: 1px solid #ececec; +} + +div.modal-contents { + color: #ececec; + background-color: #3f3f3f; +} + +.logged-out-modal guac-modal { + color: #ececec; + background-color: #3f3f3f; +} + +div.notification.ng.scope { + border: 1px solid #ececec; +} + +.notification.error { + background-color: #ff2233; +} + +.client-status-modal .notification.error { + background-color: #ff2233; +} + +button.danger { + background: #ff2233; + } + +.login-ui.error p.login-error { + color: #ececec; + background-color: #ff2233; +} + + +/* Home */ +.recent-connections .connection:hover { + background-color: #88bf5b; +} + +.menu-dropdown .menu-contents { + background-color: #2b2b2b; +} +.menu-dropdown .menu-contents li a { + color: #ececec; +} +.menu-dropdown .menu-contents li a:hover { + background-color: #88bf5b; +} + +.list-item.selected { + background: #88bf5b +} +.list-item:not(.selected) .caption:hover { + background-color: #88bf5b; +} +.list-item .name { + color: #ececec; +} + +.settings.connections .connection-list .new-sharing-profile { + opacity: .6; +} + +.notification { + color: #ececec; + background-color: #2b2b2b; +} + + +/* Menus */ +.menu { + color: #ececec; + background-color: #3f3f3f; +} + +.clipboard, +.clipboard-service-target { + background-color: #2b2b2b; + color: #88bf5b; +} + +.menu-dropdown .menu-contents li a.danger { + color: #ececec; + font-weight: 700; + background-color: #ff2233; +} + +/* Connections */ +#connection-warning { + background-color: #3f3f3f; +} + +.transfer-manager { + background-color: #2b2b2b; +} +.transfer.error { + background-color: #ff2233; +} + + +/* Settings */ +.page-tabs .page-list li a[href], +.section-tabs li a { + color: #ececec; +} +.page-tabs .page-list li a[href]:hover, +.section-tabs li a:hover { + background-color: #88bf5b; +} +.page-tabs .page-list li a[href]:visited { + color: #ececec; +} + +.settings table.session-list tr.session:hover { + background-color: #88bf5b; +} + +.location-chooser .dropdown { + background-color: #2b2b2b; +} + +.settings.connectionHistory a.history-session-recording { + color: #88bf5b; +} + +.settings.connectionHistory a.history-session-recording:after { + opacity: .0; +} + +.user a, +.user-group a, +.connection a, +.connection-group a { + color: #ececec; +} +.user a:hover, +.user-group a:hover, +.connection a:hover, +.connection-group a:hover { + color: #ececec; +} +.user a:visited, +.user-group a:visited, +.connection a:visited, +.connection-group a:visited { + color: #ececec; +} + +.manage-user .notice.read-only { + color: #ececec; + background-color: #2b2b2b; +} + +#filesystem-menu .header.breadcrumbs .breadcrumb:hover { + background-color: #88bf5b; +} + +#guac-menu #zoom-out:hover, +#guac-menu #zoom-in:hover { + background-color: #88bf5b; +} diff --git a/guac-custom-theme-builder/guac-manifest.json b/guac-custom-theme-builder/guac-manifest.json new file mode 100644 index 0000000..29bbd48 --- /dev/null +++ b/guac-custom-theme-builder/guac-manifest.json @@ -0,0 +1,22 @@ +{ + + "guacamoleVersion" : "*", + "name" : "Custom Guacamole Theme", + "namespace" : "custom-namespace", + "smallIcon" : "images/logo-64.png", + "largeIcon" : "images/logo-144.png", + "translations" : [ + "translations/en.json" + ], + + "css" : [ + "css/custom-theme.css" + ], + + "resources" : { + "images/logo.png" : "image/png", + "images/logo-64.png" : "image/png", + "images/logo-144.png" : "image/png" + } +} + diff --git a/guac-custom-theme-builder/images/logo-144.png b/guac-custom-theme-builder/images/logo-144.png new file mode 100644 index 0000000000000000000000000000000000000000..8ed87ca29b56b299ad8042502fa061ce85d13508 GIT binary patch literal 5342 zcmV<46d~)0P)Px}m`OxIRCr$PoqLcR#eK(rJ-hdi4k;jzF(e{(K#+uBD27)?9OXUw`|vzwVyt2a*&4L!=+AcodxnjEmQ5 z60x9^TKW?Jg#wU2A1MV{pyn~v&;(Ghzn+*Xut0eWt6C<2RKT}FI`xCF3Qx-ELj}$@ z)}#>nW4)U;1C-{j8(TN|Y#&xDaXBOf#;c=iIHW$K7ncA;Abcp}L;^peHW7Il5d#zl z(SjY5^=J+Rs+f^exz^MSOF`ilN~%aNHX} zkxrZ2bOID zPy&!IxI6$P)kbdwtbPsvF6&YD<03C__T^j1i5Kb1RG%tS03<2GzXHJ3v?Zzlo5y(h zaoTiY+a~~dQJesviR$Rx2sI;)>7zE(wZlv2zIWoiSI(4BN!`15bLxe221f>m@I4%d zc3SQ0@ajN`ug!UJGmJC|KweaK0Z3AWGXOBGXFWHkest%i>Axl|N>cJK0N`Kh*yDRd zzVcbp^kLdX0#Ia6kXb3)1E6wEQ1xOEz*7ZY-srVhNy*g#(2$lM1AMK>%Qt$>E2wml z02EYZLd%z6Q9Z`^nqs!{U8_%}y_*LIR}S9H0c->emtcUG0ijBfpZZ59|D~GnEMT}+ z`wk)avqDDxz0m4OP*4JplSpolm|OtDX?$sMUFAh%)@3Ds7Y6)=UTuN^u$so_7uQve z8SNxRI0OLKH6h}-UoNbl{11Y*4aFn@$cxN908+WehsW0MdBOxhRcHVLu6t2tVllv> zA}_BsLzGjSF{rhD#*5oQq;Uc$h16$Uccw1ty-*f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wYybcN literal 0 HcmV?d00001 diff --git a/guac-custom-theme-builder/images/logo-64.png b/guac-custom-theme-builder/images/logo-64.png new file mode 100644 index 0000000000000000000000000000000000000000..2583ec045f709eef3e5896e2f4a27384d0da7b62 GIT binary patch literal 1927 zcmV;22YC32P)Px+K}keGRCr$9TTP4Gii}Bbhebf4m`3wCmi z!Z>zapbLP>9R>xA?*WZ-#s@osCiVrp`H=|bq?T=0no>U^rbPyk#z!qg#}Pe zFrv#QzV`sgZKHZH?g0RFf^z_l-TYYa=>kv>9E9P-09Xrxl{3COGsGZxXJLHzxnTvt zj2MvZ$_YEr1-$=H5G-i&>Top%G%tF4k->s)nvk}v>6J8Skp;?kMa9SjAbE{7 zG#G7+?AYdV7m}y+6A8eIT0s{8cG^K_xSJt5)Zw~>dqjN2ciV531Az5zQ1neKO@yQ+ z$t1$+^MGFsJ}(&nyWOBhpDPUDK?mS5lCF7(VtmSV0c#8BNzOPPoUFA!)#;KI$mB73 zf?&j-^XL59oVH-1;9DpQs6sb8^_Ov^@|(YFc1@s@o%+5C;ul%M$aR3cy6Y?r_WbiE z{IOxmUAm(dE4o$HTSC&;djRly=->i`sgDkgZhU0)dj{~;q#GO){EPa&%!kwxQ&U{l zDv1dwbRq8vsU^mka|(cO;ebyx-1aYtyuIYD0tcsP0b~t;ECg=AZ4*1&*P5NNvxxk7 znt4+I5Ou%W6VzD_=P=o*1nVMfrWIjT~z5byeKaIDqw&H=*Vq+mTa z7AW%E(@{PmBrRXRv2f)6)lqgmD_E|BgAt+y#G1&d zNR8NO-%MbwdjNFXT~j=;i4(F5AizJ2!!p&ZN09w~qB{SLpl>dE&r`>SbO`Vva5xQW z7O-KWiv@WKmDZx?1L9NUxjBCnfc@;d^M~ZZ1`t0>@<>0#W59oOxNeWf7)>AS)4@&R~Z+M+F9u2l%rr1&f%%uZB;7t04=fN4ugY0O>;}Vk zUDxY9x=xf00MnhZtsMDP>llzL2pWvT6s*o(I<#r!*658;IFbd#t+TL#Z7q7t#JAP) zZXv?02{(8kOAq@PU=jKq&Z^_J`L#=z&87P5z;WLXf34KcA3nb#SfvIm1yo@z%_VOJ zIUG?z5DJIyMM_K)xd%XBOH6-l)Hs`ht+Reo737H5+uC*0uMC}^tJdmVh*-`&2X z{T5Hwb1U0Q&_a8?Nt+KjWos}`BaP<(eocQ#09O&= zZ{R@RNyZb|#{g0mLWu6MrmDW>=J&$SAm3C}T03cms1M@4s8*Gn` z$`Ic#s-QeR{pvnxbrRxO1VIXOO=V~J4MLfq#srnxHKwLb+ZE2Drvs41$?#o1M%R(Zm0Oy%0_>h<-iZyBe3%mMQwu&Pphp5_MUY|7T^E{{TcgZ`kj66;c2I N002ovPDHLkV1m+!b{YTx literal 0 HcmV?d00001 diff --git a/guac-custom-theme-builder/images/logo.png b/guac-custom-theme-builder/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1854ba1e7ddd245ac4674a01d2a59053fcb0802a GIT binary patch literal 10191 zcmeHtc|4Tg`!`aE2oVaEtYhp;WM9iV$lxAB6f#Q4PND3gMfU95Fout~EhD31RF;I9 z389dXrAS$den;Qud0yY&@A>0-J+J5W{P(+F$2j+OuIqg*=iD>*x$cvMvNAn%Q0O27 z1H+;7=ZtI_7?_~FKh}MK^DItq1pH&XVQXr@Q2XZi0=QuI(zn!SV5q;x{@ZOo7`ubA zxL^$Ud-R9l&tCfz4G4U6Tnuf5LOY>^z2+U=aw)p|QbLF0omTrh&+Sw88aCnS-e@A( zIj#e`-R5}vxnsg!bBSwrj(g!8PsS#{z$SD!$32DOoa31nyBRpK+Cf&oJSEfL6&F^SJGd)CR$Nud2}lniX`@xdo> zb3;EyG0SG|&pThqM zmLD}j22&6nXlrH1zzB$m=`c4S9-b2?0i8M}ub>D>Nl8~%PalwhwKd8Hkgc7otLsHK zKES&o>;D)!}>=)hkC)z)8<%3_8 z8tBli!omPq41MFKb+DJ0SBU9ZhNld0v}6(gH)bkRK{WJ?7sVdRgk!YULw;n#@7H4d z-v&#H=#fl%rY@UEr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f?bqzSK}e&v{-2mnX=c$ouB)%TLu*J_A=;v2Eb9$F&y3#ZfEj#O{xbZ>m(YRSrTE+04x?aRCR*%SQc!5xDz7&A7?x7teMS}?N z{LLqMxSK5sBr-D5j38oLWYeRZE5m-Rxiwo#m%t&0-n~575x@8$QaQX)o=;yMJ+9+t$7!^RgKrWjB!xG@5!L(p8YrF+5&RAfMh&_4LLf`T zs*L)+9VyOJA$Nip0IWWM4OAttwRL|lqZ2p)m;`OC0sCf?4&I<-SvnvLfL{c9%yKxK zZ7G=^s+A@=JQ_*9N_ET!Vf$i`(*Ly<@NZ>-|L*>)Jo5iB4}ms5BnH#Z>&IRzy51JE zzIp$aIFia#B>aCmee{C(_w>=qZoI6fEsC81`G0Y82^?#ZUkd)iCHl}TpjYYY#@@-h N^Tt+2wFVb&{|Ce|TW0_O literal 0 HcmV?d00001 diff --git a/guac-custom-theme-builder/translations/en.json b/guac-custom-theme-builder/translations/en.json new file mode 100644 index 0000000..6161910 --- /dev/null +++ b/guac-custom-theme-builder/translations/en.json @@ -0,0 +1,8 @@ +{ + "NAME" : "English", + + "APP":{ + + "NAME" : "Itiligent" + } +} diff --git a/guac-enterprise-build/install-mysql-backend-only.sh b/guac-enterprise-build/install-mysql-backend-only.sh new file mode 100644 index 0000000..2c9ef6f --- /dev/null +++ b/guac-enterprise-build/install-mysql-backend-only.sh @@ -0,0 +1,366 @@ +#!/bin/bash +####################################################################################################################### +# Guacamole MySQL backend install script. (For split DB and guacamole application layers. +# For Ubuntu / Debian / Raspbian +# David Harrop +# September 2023 +####################################################################################################################### + +# This script is for separating the Guacamole architecture into a scaled out three tiered system. +# Layer 1 = DATABASE - This script +# Layer 2 = GUAC SERVER & APPLICATION - use the main setup script, and select remote MYSQL DB option. +# Layer 3 = FRONT END REV PROXY (Potentially load balanced & HA) - Up to you! + +####################################################################################################################### +# Script pre-flight checks and settings ############################################################################### +####################################################################################################################### + +clear + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +# Check to see if any previous version of build/install files exist, if so stop and check to be safe. +if [[ "$(find . -maxdepth 1 \( -name 'guacamole-*' -o -name 'mysql-connector-j-*' \))" != "" ]]; then + echo + echo -e "${LRED}Possible previous install files detected. Please review and remove old guacamole install files before proceeding.${GREY}" 1>&2 + echo + exit 1 +fi + +####################################################################################################################### +# Initial environment setup ########################################################################################### +####################################################################################################################### + +#Setup download and temp directory paths +USER_HOME_DIR=$(eval echo ~${SUDO_USER}) +DOWNLOAD_DIR=$USER_HOME_DIR/guac-setup + +# Setup directory locations +mkdir -p $DOWNLOAD_DIR +chown -R $SUDO_USER:root $DOWNLOAD_DIR + +# Version of Guacamole auth jdbc database schema to use +GUAC_VERSION="1.5.3" + +# Set preferred Apache CDN download link) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" + +# Install log Location +INSTALL_LOG="${DOWNLOAD_DIR}/guacamole_${GUAC_VERSION}_mysql_install.log" + +clear + +# Script branding header +echo +echo -e "${GREYB}Guacamole Backend MySQL Setup." +echo -e " ${LGREEN}Powered by Itiligent" +echo +echo + +####################################################################################################################### +# Setup options. ###################################################################################################### +####################################################################################################################### + +BACKEND_MYSQL="true" # True: For separated MySQL layer. False/blank: Add MySQL to existing guac server (replace XML user map) +FRONTEND_NET="" # IPs guac server can login from. Blank = any IP or wildcard 192.168.1.% (ignored if BACKEND_SQL="false") +MYSQL_BIND_ADDR="0.0.0.0" # Binds MySQL instance to this IP. (127.0.0.1, a specific IP or 0.0.0.0) (ignored if BACKEND_SQL="false") +SECURE_MYSQL="true" # Apply the mysql secure configuration tool (true/false) +MYSQL_PORT="3306" # Default is 3306 +GUAC_DB="guacamole_db" # Default is guacamole_db +GUAC_USER="guacamole_user" # Default is guacamole_user +GUAC_PWD="test" # Requires an entry +MYSQL_ROOT_PWD="test" # Requires an entry. +DB_TZ=$(cat /etc/timezone) # Typically system default (cat /etc/timezone) or change to "UTC" if required. + +# For a remotely accessed back end DB instance, keep this script set to BACKEND_MYSQL="true". +# Other options are fairly straight forward. For a typical back end server only the $FRONTEND_NET and $MYSQL_BIND_ADDR +# values may need closer attention. + +# This script can also accommodate DR or migration scenarios: E.g Migration away from XML user mappings, PostGres to MySQL etc). +# To install a new MySQL database on the same server as the Guacamole application, set BACKEND_MYSQL="false" & +# MYSQL_BIND_ADDR="127.0.0.1". See bottom of this script for some remaining DB migration actions. + +####################################################################################################################### +# Start install actions ############################################################################################## +####################################################################################################################### + +# Choose a specific MySQL version e.g. 11.1.2 See https://mariadb.org/mariadb/all-releases/ for available versions. +MYSQL_VERSION="" # Blank "" forces distro default MySQL packages. +if [[ -z "${MYSQL_VERSION}" ]]; then + # Use Linux distro default version. + MYSQLPKG="default-mysql-server default-mysql-client mysql-common" + DB_CMD="mysql" # mysql command is depricated +else + # Use official mariadb.org repo + MYSQLPKG="mariadb-server mariadb-client mariadb-common" + DB_CMD="mariadb" # mysql command is depricated on newer versions +fi + +# Update everything but don't do the annoying prompts during apt installs +echo -e "${GREY}Updating base Linux OS..." +export DEBIAN_FRONTEND=noninteractive +apt-get update -qq &>>${INSTALL_LOG} +apt-get upgrade -qq -y &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +cd $DOWNLOAD_DIR + +# Add the official MariaDB repo +if [[ -n "${MYSQL_VERSION}" ]]; then + apt-get -qq -y install curl gnupg2 &>>${INSTALL_LOG} + curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup &>>${INSTALL_LOG} + bash mariadb_repo_setup --mariadb-server-version=$MYSQL_VERSION &>>${INSTALL_LOG} +fi + +# Download and extract the Guacamole SQL authentication extension containing the database schema +echo -e "${GREY}Downloading Guacamole database source files..." +wget -q --show-progress -O guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz" + exit 1 +else + tar -xzf guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz +fi +echo -e "${LGREEN}Downloaded guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz${GREY}" + +echo +echo -e "${GREY}Installing MySQL packages..." +apt-get -qq -y install ${MYSQLPKG} &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Set the root password without a reliance on debconf. +echo -e "${GREY}Setting MySQL root password..." +SQLCODE=" +FLUSH PRIVILEGES; +ALTER USER 'root'@'localhost' IDENTIFIED BY '$MYSQL_ROOT_PWD';" +echo ${SQLCODE} | $DB_CMD -u root +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Find the location of the MySQL or MariaDB config files. (Add to this list for more potential candidates.) +for x in /etc/mysql/mariadb.conf.d/50-server.cnf \ + /etc/mysql/mysql.conf.d/mysqld.cnf \ + /etc/mysql/my.cnf; do + # Check inside each candidate to see if a [mysqld] or [mariadbd] section exists, assign $x the correct filename. + if [[ -e "${x}" ]]; then + if grep -qE '^\[(mysqld|mariadbd)\]$' "${x}"; then + mysqlconfig="${x}" + # Reduce any duplicated section names, then sanitise the [ ] special characters for sed below) + config_section=$(grep -m 1 -E '^\[(mysqld|mariadbd)\]$' "${x}" | sed 's/\[\(.*\)\]/\1/') + break + fi + fi +done + +# Set the MySQL Timezone +if [[ -z "${mysqlconfig}" ]]; then + echo -e "${GREY}Couldn't detect MySQL config file - you will need to manually configure database timezone settings" +else + # Is there already a timzeone value configured? + if grep -q "^default_time_zone[[:space:]]=" "${mysqlconfig}"; then + echo -e "MySQL database timezone defined in ${mysqlconfig}" + else + timezone=${DB_TZ} + if [[ -z "${DB_TZ}" ]]; then + echo -e "Couldn't find system timezone, using UTC$" + timezone="UTC" + fi + echo -e "Setting MySQL database timezone as ${timezone}${GREY}" + mysql_tzinfo_to_sql /usr/share/zoneinfo 2>/dev/null | ${DB_CMD} -u root -D mysql -p${MYSQL_ROOT_PWD} + # Add the timzone value to the sanitsed server file section name. + sed -i -e "/^\[${config_section}\]/a default_time_zone = ${timezone}" "${mysqlconfig}" + fi +fi +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Establish the appropriate form of Guacamole user account access (remote or localhost login permissions) +echo -e "${GREY}Setting up database access parameters for the Guacamole user ..." +if [[ "${BACKEND_MYSQL}" = true ]] && [[ -z "${FRONTEND_NET}" ]]; then + echo -e "${LYELLOW}${GUAC_USER} is set to accept db logins from any host, you may wish to limit this to specific IPs.${GREY}" + GUAC_USERHost="%" # Allow guacamole access from all IPs where $FRONTEND_NET is left blank +elif [[ "${BACKEND_MYSQL}" = true ]] && [[ -n "${FRONTEND_NET}" ]]; then + echo -e "${LYELLOW}${GUAC_USER} is set to accept db logins from ${FRONTEND_NET}.${GREY}" + GUAC_USERHost="${FRONTEND_NET}" # Allow guacamole access from the given value in $FRONTEND_NET +elif [[ "${BACKEND_MYSQL}" = false ]] || [[ -z "${BACKEND_MYSQL}" ]]; then + echo -e "${LYELLOW}${GUAC_USER} is set to accept db logins from localhost only.${GREY}" + GUAC_USERHost=localhost # Assume a localhost only install + MYSQL_BIND_ADDR="127.0.0.1" +else + echo -e "${LYELLOW}${GUAC_USER} is set to accept db logins from localhost only.${GREY}" + GUAC_USERHost=localhost # Assume a localhost only install +fi +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Set the MySQL binding IP address according to setup variables given. +echo -e "${GREY}Setting MySQL IP address binding to ${MYSQL_BIND_ADDR}..." +sed -i "s/^bind-address[[:space:]]*=[[:space:]]*.*/bind-address = ${MYSQL_BIND_ADDR}/g" ${mysqlconfig} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Create the new Guacamole database +echo -e "${GREY}Creating the Guacamole database..." +SQLCODE=" +DROP DATABASE IF EXISTS ${GUAC_DB}; +CREATE DATABASE IF NOT EXISTS ${GUAC_DB}; +CREATE USER IF NOT EXISTS '${GUAC_USER}'@'${GUAC_USERHost}' IDENTIFIED BY \"${GUAC_PWD}\"; +GRANT SELECT,INSERT,UPDATE,DELETE ON ${GUAC_DB}.* TO '${GUAC_USER}'@'${GUAC_USERHost}'; +FLUSH PRIVILEGES;" +# Execute SQL code +echo ${SQLCODE} | $DB_CMD -u root -D mysql -p${MYSQL_ROOT_PWD} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Add Guacamole's schema code to newly created database +echo -e "${GREY}Adding the Guacamole database schema..." +cat guacamole-auth-jdbc-${GUAC_VERSION}/mysql/schema/*.sql | $DB_CMD -u root -D ${GUAC_DB} -p${MYSQL_ROOT_PWD} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Apply Secure MySQL installation settings +if [[ "${SECURE_MYSQL}" = true ]]; then + apt-get -qq -y install expect &>>${INSTALL_LOG} + echo -e "${GREY}Applying mysql_secure_installation settings...${DGREY}" + SECURE_MYSQL=$(expect -c " +set timeout 10 +spawn mysql_secure_installation +expect \"Enter current password for root (enter for none):\" +send \"$MYSQL_ROOT_PWD\r\" +expect \"Switch to unix_socket authentication\" +send \"n\r\" +expect \"Change the root password?\" +send \"n\r\" +expect \"Remove anonymous users?\" +send \"y\r\" +expect \"Disallow root login remotely?\" +send \"y\r\" +expect \"Remove test database and access to it?\" +send \"y\r\" +expect \"Reload privilege tables now?\" +send \"y\r\" +expect eof +") + echo "$SECURE_MYSQL" + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Restart & enable MySQL service at boot +echo -e "${GREY}Restarting MySQL service & enable at boot..." +systemctl enable mysql +systemctl restart mysql +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Cleanup +echo -e "${GREY}Cleaning up install files...${GREY}" +apt-get -y remove expect &>>${INSTALL_LOG} +apt-get -y autoremove &>>${INSTALL_LOG} +rm -rf guacamole-* +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${LOG_LOCATION}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Done +echo +printf "${LGREEN}Guacamole ${GUAC_VERSION} MySQL backend install complete! \n${NC}" +echo -e ${NC} + +####################################################################################################################### +# Additional migration steps for adding MySQL to an existing Guacamole application server +####################################################################################################################### + +# Download and upgrade Guacamole SQL authentication extension +#wget -q --show-progress -O guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz +#tar -xzf guacamole-auth-jdbc-${GUAC_VERSION}.tar.gz +#rm /etc/guacamole/extensions/guacamole-auth-jdbc-*.jar +#mv -f guacamole-auth-jdbc-${GUAC_VERSION}/mysql/guacamole-auth-jdbc-mysql-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +#chmod 664 /etc/guacamole/extensions/guacamole-auth-jdbc-mysql-${GUAC_VERSION}.jar + +# Download MySQL connector/j +# MYSQLJCON="8.1.0" +#wget -q --show-progress -O mysql-connector-j-${MYSQLJCON}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-${MYSQLJCON}.tar.gz +#tar -xzf mysql-connector-j-${MYSQLJCON}.tar.gz +#rm /etc/guacamole/lib/mysql-connector-java.jar +#mv -f mysql-connector-j-${MYSQLJCON}/mysql-connector-j-${MYSQLJCON}.jar /etc/guacamole/lib/mysql-connector-java.jar + +# Configure guacamole.properties file +#rm -f /etc/guacamole/guacamole.properties +#touch /etc/guacamole/guacamole.properties +#echo "mysql-hostname: ${MYSQL_HOST}" >>/etc/guacamole/guacamole.properties +#echo "mysql-port: ${MYSQL_PORT}" >>/etc/guacamole/guacamole.properties +#echo "mysql-database: ${GUAC_DB}" >>/etc/guacamole/guacamole.properties +#echo "mysql-username: ${GUAC_USER}" >>/etc/guacamole/guacamole.properties +#echo "mysql-password: ${GUAC_PWD}" >>/etc/guacamole/guacamole.properties diff --git a/guac-enterprise-build/upgrade-mysql-backend-only.sh b/guac-enterprise-build/upgrade-mysql-backend-only.sh new file mode 100644 index 0000000..dbd6bac --- /dev/null +++ b/guac-enterprise-build/upgrade-mysql-backend-only.sh @@ -0,0 +1,138 @@ +#!/bin/bash +###################################################################################################################### +# Guacamole appliance upgrade script +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# The Guacamole schema have not been updated since late 2021, suggesting that its now quite mature and there will be +# little need to use this, but just in case. Update the database packages separately via apt. + +####################################################################################################################### +# Script pre-flight checks and settings ############################################################################### +####################################################################################################################### + +clear + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +# Check to see if any previous version of build/install files exist, if so stop and check to be safe. +if [[ "$(find . -maxdepth 1 \( -name 'guacamole-*' -o -name 'mysql-connector-j-*' \))" != "" ]]; then + echo + echo -e "${LRED}Possible previous install files detected. Please review and remove old guacamole install files before proceeding.${GREY}" 1>&2 + echo + exit 1 +fi + +####################################################################################################################### +# Initial environment setup ########################################################################################### +####################################################################################################################### + +#Setup download and temp directory paths +USER_HOME_DIR=$(eval echo ~${SUDO_USER}) +DOWNLOAD_DIR=$USER_HOME_DIR/guac-setup + +# Setup directory locations +mkdir -p $DOWNLOAD_DIR +chown -R $SUDO_USER:root $DOWNLOAD_DIR + +# Version of Guacamole to upgrade to. See https://guacamole.apache.org/releases/ for latest version info. +NEW_GUAC_VERSION="1.5.3" + +# The currently installed Guacamole schema version is needed to evaluate the required schema upgrades. +OLD_GUAC_VERSION="1.5.0" + +# Set preferred Apache CDN download link) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${NEW_GUAC_VERSION}" + +# Install log Location +INSTALL_LOG="${DOWNLOAD_DIR}/guacamole_${NEW_GUAC_VERSION}_mysql_install.log" + +# Database details +GUAC_DB="guacamole_db" +MYSQL_ROOT_PWD="test" + +clear + +# Script branding header +echo +echo -e "${GREYB}Guacamole Backend MySQL Schema UPGRADE." +echo -e " ${LGREEN}Powered by Itiligent${GREY}" +echo +echo + +####################################################################################################################### +# Start install actions ############################################################################################## +####################################################################################################################### + +# Download and extract the Guacamole SQL authentication extension containing the database schema +wget -q --show-progress -O guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz" + exit 1 +else + tar -xzf guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz +fi + +echo +# Get list of SQL Upgrade Files +echo -e "${GREY}Upgrading MySQL Schema..." +UPGRADEFILES=($(ls -1 guacamole-auth-jdbc-${NEW_GUAC_VERSION}/mysql/schema/upgrade/ | sort -V)) + +# Compare SQL Upgrage Files against old version, apply upgrades as needed +for FILE in ${UPGRADEFILES[@]}; do + FILEVERSION=$(echo ${FILE} | grep -oP 'upgrade-pre-\K[0-9\.]+(?=\.)') + if [[ $(echo -e "${FILEVERSION}\n${OLD_GUAC_VERSION}" | sort -V | head -n1) == ${OLD_GUAC_VERSION} && ${FILEVERSION} != ${OLD_GUAC_VERSION} ]]; then + echo "Patching ${GUAC_DB} with ${FILE}" + mariadb -u root -D ${GUAC_DB} -p${MYSQL_ROOT_PWD} >${INSTALL_LOG} + fi +done +if [[ $? -ne 0 ]]; then + echo -e "${LRED}SQL upgrade failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Restart MySQL service +echo -e "${GREY}Restarting MySQL service..." +systemctl restart mysql +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Cleanup +echo -e "${GREY}Clean up install files...${GREY}" +rm -rf guacamole-* +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Done +printf "${LGREEN}Guacamole ${NEW_GUAC_VERSION} schema upgrade complete - check log for details! \n${NC}" +echo -e ${NC} diff --git a/guac-management/backup-guac.sh b/guac-management/backup-guac.sh new file mode 100644 index 0000000..90b9d54 --- /dev/null +++ b/guac-management/backup-guac.sh @@ -0,0 +1,66 @@ +#!/bin/bash +####################################################################################################################### +# Guacamole MySQL Database Backup +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +clear + +export PATH=/bin:/usr/bin:/usr/local/bin +TODAY=$(date +%Y-%m-%d) +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +MYSQL_HOST= +MYSQL_PORT= +GUAC_USER= +GUAC_PWD= +GUAC_DB= +DB_BACKUP_DIR= +BACKUP_EMAIL= +BACKUP_RETENTION= + +# Protect disk space and remove backups older than {BACKUP_RETENTION} days +find ${DB_BACKUP_DIR} -mtime +${BACKUP_RETENTION} -delete + +# Backup code +mkdir -p ${DB_BACKUP_DIR} +echo +echo -e "${LGREEN}Backup started for database - ${GUAC_DB}" +echo + +mysqldump -h ${MYSQL_HOST} \ + -P ${MYSQL_PORT} \ + -u ${GUAC_USER} \ + -p"${GUAC_PWD}" \ + ${GUAC_DB} \ + --single-transaction --quick --lock-tables=false >${DB_BACKUP_DIR}${GUAC_DB}-${TODAY}.sql +SQLFILE=${DB_BACKUP_DIR}${GUAC_DB}-${TODAY}.sql +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Backup failed.${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}Backup completed ok.${GREY}" + echo +fi +gzip -f ${SQLFILE} +# Error check and email alerts +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Backup failed.${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}${GUAC_DB} backup was successfully copied to ${DB_BACKUP_DIR}" + #mailx -s "Guacamomle Database Backup Success" ${BACKUP_EMAIL} + echo "${GUAC_DB} backup was successfully copied to $DB_BACKUP_DIR" | mailx -s "Guacamole backup " ${BACKUP_EMAIL} +fi + +echo -e ${NC} diff --git a/guac-management/refresh-tls-self-signed.sh b/guac-management/refresh-tls-self-signed.sh new file mode 100644 index 0000000..22cd4dc --- /dev/null +++ b/guac-management/refresh-tls-self-signed.sh @@ -0,0 +1,179 @@ +#!/bin/bash +####################################################################################################################### +# Create or refresh self signed TLS certificates for Nginx (or others) +# For Ubuntu / Debian / Rasbpian +# David Harrop +# September 2023 +####################################################################################################################### + +# If run with with no command arguments, the ${PROXY_SITE}, ${CERT_DAYS} & ${Default_IP) values used during the +# the original install are applied. To keep these run: sudo ./refresh-tls-self-signed-nginx.sh +# +# This script can also be run with custom command line arguments for use with any TLS application: +# Command arguments are formatted as: [command] [FQDN] [cert-lifetime] [IP] +# e.g. sudo ./refresh-tls-self-signed-nginx.sh webserver.domain.local 365 192.168.1.1 + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + echo + exit 1 +fi + +echo +echo +echo -e "${LGREEN}Cresting self signed TLS certificates for Nginx...${GREY}" +echo + +# Create a place to save the certs so we don't overwrite any earlier versions +USER_HOME_DIR=$(eval echo ~${SUDO_USER}) +CERT_DIR_NAME=tls-certs-$(date +%y.%m.%d) +CERT_DIR=$USER_HOME_DIR/guac-setup/$CERT_DIR_NAME +mkdir -p $CERT_DIR +cd $CERT_DIR + +# Set default certificate file destinations. Change these for other TLS applications. +DIR_SSL_KEY="/etc/nginx/ssl/private" +DIR_SSL_CERT="/etc/nginx/ssl/cert" + +# Cmd line arguments for dns name, certificate days and IP address +TLSNAME=$1 +TLSDAYS=$2 +TLSIP=$3 + +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +CERT_COUNTRY= +CERT_STATE= +CERT_LOCATION= +CERT_ORG= +CERT_OU= +PROXY_SITE= +CERT_DAYS= +DEFAULT_IP= +RSA_KEYLENGTH= + +# Assume the values set by the main installer if the script is run without any command line options +if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then + TLSNAME=$PROXY_SITE + TLSDAYS=$CERT_DAYS + TLSIP=$DEFAULT_IP +fi + +# Make directories to place TLS Certificate if they don't exist +if [[ ! -d $DIR_SSL_KEY ]]; then + mkdir -p $DIR_SSL_KEY +fi + +if [[ ! -d $DIR_SSL_CERT ]]; then + mkdir -p $DIR_SSL_CERT +fi + +echo -e "${GREY}New self signed TLS certificate attributes are shown below...${DGREY}" +# Display the new TLS cert parameters. +cat <&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Place TLS Certificate into the defined application path +cp $TLSNAME.key $DIR_SSL_KEY/$TLSNAME.key +cp $TLSNAME.crt $DIR_SSL_CERT/$TLSNAME.crt + +# Create a PFX formatted key for easier import to Windows hosts and change permissions to enable copying elsewhere +echo -e "${GREY}Converting client certificates for Windows & Linux...${GREY}" +openssl pkcs12 -export -out $TLSNAME.pfx -inkey $TLSNAME.key -in $TLSNAME.crt -password pass:1234 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed.${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Change of permissions so certs can be copied via WinSCP. +chown -R $SUDO_USER:root $CERT_DIR + +# Reload everything +echo -e "${GREY}New certificate created, restating Guacamole & Ngnix..." +TOMCAT=$(ls /etc/ | grep tomcat) +systemctl restart $TOMCAT +systemctl restart guacd +systemctl restart nginx +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed.${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Hack to assist with displaying "$" symbols and " ' quotes in a (cut/paste-able) bash screen output format +SHOWASTEXT1='$mypwd' +SHOWASTEXT2='"Cert:\LocalMachine\Root"' + +printf "${GREY}+------------------------------------------------------------------------------------------------------------- +${LGREEN}+ WINDOWS CLIENT SELF SIGNED TLS BROWSER CONFIG - SAVE THIS BEFORE CONTINUING!${GREY} ++ ++ 1. In ${CERT_DIR} is a Windows version of the new certificate ${LYELLOW}$TLSNAME.pfx${GREY} ++ 2. Import this PFX file into your Windows client with the below Powershell commands (as Administrator): +\n" +echo -e "${SHOWASTEXT1} = ConvertTo-SecureString -String "1234" -Force -AsPlainText" +echo -e "Import-pfxCertificate -FilePath $TLSNAME.pfx -Password "${SHOWASTEXT1}" -CertStoreLocation "${SHOWASTEXT2}"" +printf "${GREY}+------------------------------------------------------------------------------------------------------------- +${LGREEN}+ LINUX CLIENT SELF SIGNED TLS BROWSER CONFIG - SAVE THIS BEFORE CONTINUING!${GREY} ++ ++ 1. In ${CERT_DIR} is a new Linux native OpenSSL certificate ${LYELLOW}$TLSNAME.crt${GREY} ++ 2. Import the CRT file into your Linux client certificate store with the below command: +\n" +echo -e "(If certutil is not installed, run apt-get install libnss3-tools)" +echo -e "mkdir -p $HOME/.pki/nssdb && certutil -d $HOME/.pki/nssdb -N" +echo -e "certutil -d sql:$HOME/.pki/nssdb -A -t "CT,C,c" -n $TLSNAME -i $TLSNAME.crt" +printf "+-------------------------------------------------------------------------------------------------------------\n" + +rm -f cert_attributes.txt + +# Done +echo -e ${NC} diff --git a/guac-management/upgrade-guac.sh b/guac-management/upgrade-guac.sh new file mode 100644 index 0000000..a38a62d --- /dev/null +++ b/guac-management/upgrade-guac.sh @@ -0,0 +1,350 @@ +#!/bin/bash +###################################################################################################################### +# Guacamole appliance upgrade script +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +####################################################################################################################### +# Script pre-flight checks and settings ############################################################################### +####################################################################################################################### + +clear + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +# Check to see if any previous version of build/install files exist, if so stop and check to be safe. +if [[ "$(find . -maxdepth 1 \( -name 'guacamole-*' -o -name 'mysql-connector-j-*' \))" != "" ]]; then + echo + echo -e "${LRED}Possible previous install files detected. Please review and remove old guacamole install files before proceeding.${GREY}" 1>&2 + echo + exit 1 +fi + +####################################################################################################################### +# Initial environment setup ########################################################################################### +####################################################################################################################### + +#Setup download and temp directory paths +USER_HOME_DIR=$(eval echo ~${SUDO_USER}) +DOWNLOAD_DIR=$USER_HOME_DIR/guac-setup + +# Setup directory locations +mkdir -p $DOWNLOAD_DIR +chown -R $SUDO_USER:root $DOWNLOAD_DIR + +# Version of Guacamole to upgrade to. See https://guacamole.apache.org/releases/ for latest version info. +NEW_GUAC_VERSION="1.5.3" + +# MySQL Connector/J version. See https://dev.mysql.com/downloads/connector/j/ for latest version number. +NEW_MYSQLJCON="8.1.0" + +# Get the currently installed Tomcat version. +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) + +# Get the currently installed Guacamole version +OLD_GUAC_VERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT_VERSION}/webapps/guacamole/guacamole-common-js/modules/Version.js) + +# Set preferred Apache CDN download link +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${NEW_GUAC_VERSION}" + +# Install log Location +INSTALL_LOG="${DOWNLOAD_DIR}/guacamole_${NEW_GUAC_VERSION}_upgrade.log" + +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +INSTALL_MYSQL= +MYSQL_HOST= +MYSQL_PORT= +GUAC_USER= +GUAC_PWD= +GUAC_DB= +MYSQL_ROOT_PWD= + +# Script branding header +echo +echo -e "${GREYB}Guacamole VDI & Jump Server Appliance UPGRADE." +echo -e " ${LGREEN}Powered by Itiligent" +echo + +####################################################################################################################### +# Start upgrade actions ############################################################################################## +####################################################################################################################### + +apt-get upgrade -qq -y + +# Stop tomcat and guacd +systemctl stop ${TOMCAT_VERSION} +systemctl stop guacd + +cd $DOWNLOAD_DIR + +echo +echo -e "${GREY}Downloading updated Guacamole source files and beginning Guacamole ${OLD_GUAC_VERSION} to ${NEW_GUAC_VERSION} upgrade..." +wget -q --show-progress -O guacamole-${NEW_GUAC_VERSION}.war ${GUAC_SOURCE_LINK}/binary/guacamole-${NEW_GUAC_VERSION}.war +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-${NEW_GUAC_VERSION}.war" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-${NEW_GUAC_VERSION}.war${GREY}" + exit 1 +else + rm /etc/guacamole/guacamole.war + mv -f guacamole-${NEW_GUAC_VERSION}.war /etc/guacamole/guacamole.war + chmod 664 /etc/guacamole/guacamole.war +fi +echo -e "${LGREEN}Upgraded Guacamole client to version ${NEW_GUAC_VERSION}${GREY}" + +# Download and upgrade Guacamole SQL authentication extension +wget -q --show-progress -O guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz" + exit 1 +else + tar -xzf guacamole-auth-jdbc-${NEW_GUAC_VERSION}.tar.gz + rm /etc/guacamole/extensions/guacamole-auth-jdbc-*.jar + mv -f guacamole-auth-jdbc-${NEW_GUAC_VERSION}/mysql/guacamole-auth-jdbc-mysql-${NEW_GUAC_VERSION}.jar /etc/guacamole/extensions/ + chmod 664 /etc/guacamole/extensions/guacamole-auth-jdbc-mysql-${NEW_GUAC_VERSION}.jar +fi +echo -e "${LGREEN}Upgraded Guacamole SQL jdbc to version ${NEW_GUAC_VERSION}${GREY}" + +# Download MySQL connector/j +wget -q --show-progress -O mysql-connector-j-${NEW_MYSQLJCON}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-${NEW_MYSQLJCON}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download mysql-connector-j-${NEW_MYSQLJCON}.tar.gz" 1>&2 + echo -e "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-${NEW_MYSQLJCON}}.tar.gz${GREY}" + exit 1 +else + tar -xzf mysql-connector-j-${NEW_MYSQLJCON}.tar.gz + rm /etc/guacamole/lib/mysql-connector-java.jar + mv -f mysql-connector-j-${NEW_MYSQLJCON}/mysql-connector-j-${NEW_MYSQLJCON}.jar /etc/guacamole/lib/mysql-connector-java.jar +fi +echo -e "${LGREEN}Upgraded MySQL connector/j to ${NEW_MYSQLJCON}${GREY}" + +# Download Guacamole Server +wget -q --show-progress -O guacamole-server-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/source/guacamole-server-${NEW_GUAC_VERSION}.tar.gz +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-server-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/source/guacamole-server-${NEW_GUAC_VERSION}.tar.gz${GREY}" + exit 1 +else + tar -xzf guacamole-server-${NEW_GUAC_VERSION}.tar.gz +fi +echo -e "${LGREEN}Downloaded guacamole-server-${NEW_GUAC_VERSION}.tar.gz${GREY}" + +# Make and install guacd (Guacamole-Server) +cd guacamole-server-${NEW_GUAC_VERSION}/ +echo +echo -e "${GREY}Compiling Guacamole-Server ${NEW_GUAC_VERSION} from source with with GCC $(gcc --version | head -n1 | grep -oP '\)\K.*' | awk '{print $1}'), this might take a few minutes...${GREY}" +# Fix for warnings see #222 https://github.com/MysticRyuujin/guac-install/issues/222 +export CFLAGS="-Wno-error" +# Configure Guacamole Server source +./configure --with-systemd-dir=/etc/systemd/system &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo "Failed to configure guacamole-server" + echo "Trying again with --enable-allow-freerdp-snapshots" + ./configure --with-systemd-dir=/etc/systemd/system --enable-allow-freerdp-snapshots + if [[ $? -ne 0 ]]; then + echo "Failed to configure guacamole-server - again" + exit + fi +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +echo -e "${GREY}Running make and building the upgraded Guacamole-Server application..." +make &>>${INSTALL_LOG} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +echo -e "${GREY}Installing the upgraded Guacamole-Server..." +make install &>>${INSTALL_LOG} +ldconfig +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +cd .. + +# Don't run the SQL upgrade commands if original setup option was set to remote MySQL instance. - Use separate DB update script. +if [[ "${INSTALL_MYSQL}" = true ]]; then + # Get list of SQL Upgrade Files + echo -e "${GREY}Upgrading MySQL Schema..." + UPGRADEFILES=($(ls -1 guacamole-auth-jdbc-${NEW_GUAC_VERSION}/mysql/schema/upgrade/ | sort -V)) + + # Compare SQL Upgrage Files against old version, apply upgrades as needed + for FILE in ${UPGRADEFILES[@]}; do + FILEVERSION=$(echo ${FILE} | grep -oP 'upgrade-pre-\K[0-9\.]+(?=\.)') + if [[ $(echo -e "${FILEVERSION}\n${OLD_GUAC_VERSION}" | sort -V | head -n1) == ${OLD_GUAC_VERSION} && ${FILEVERSION} != ${OLD_GUAC_VERSION} ]]; then + echo "Patching ${GUAC_DB} with ${FILE}" + mysql -u root -D ${GUAC_DB} -h ${MYSQL_HOST} -P ${MYSQL_PORT} >${INSTALL_LOG} + fi + done + if [[ $? -ne 0 ]]; then + echo -e "${LRED}SQL upgrade failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 + else + echo -e "${LGREEN}OK${GREY}" + echo + fi +fi + +# Check for TOTP extension and upgrade if found +for file in /etc/guacamole/extensions/guacamole-auth-totp*.jar; do + if [[ -f $file ]]; then + echo -e "${LGREEN}TOTP authentication extension was found, upgrading...${GREY}" + rm /etc/guacamole/extensions/guacamole-auth-totp*.jar &>>${INSTALL_LOG} + wget -q --show-progress -O guacamole-auth-totp-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-totp-${NEW_GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-totp-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-totp-${NEW_GUAC_VERSION}.tar.gz" + exit 1 + fi + tar -xzf guacamole-auth-totp-${NEW_GUAC_VERSION}.tar.gz &>>${INSTALL_LOG} + mv -f guacamole-auth-totp-${NEW_GUAC_VERSION}/guacamole-auth-totp-${NEW_GUAC_VERSION}.jar /etc/guacamole/extensions/ &>>${INSTALL_LOG} + chmod 664 /etc/guacamole/extensions/guacamole-auth-totp-${NEW_GUAC_VERSION}.jar + echo -e "${LGREEN}Upgraded TOTP extension to version ${NEW_GUAC_VERSION}${GREY}" + echo + break + fi +done + +# Check for DUO extension and upgrade if found +for file in /etc/guacamole/extensions/guacamole-auth-duo*.jar; do + if [[ -f $file ]]; then + echo -e "${LGREEN}DUO authentication extension was found, upgrading...${GREY}" + rm /etc/guacamole/extensions/guacamole-auth-duo*.jar &>>${INSTALL_LOG} + wget -q --show-progress -O guacamole-auth-duo-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-duo-${NEW_GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-duo-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-duo-${NEW_GUAC_VERSION}.tar.gz" + exit 1 + fi + tar -xzf guacamole-auth-duo-${NEW_GUAC_VERSION}.tar.gz &>>${INSTALL_LOG} + mv -f guacamole-auth-duo-${NEW_GUAC_VERSION}/guacamole-auth-duo-${NEW_GUAC_VERSION}.jar /etc/guacamole/extensions/ &>>${INSTALL_LOG} + chmod 664 /etc/guacamole/extensions/guacamole-auth-duo-${NEW_GUAC_VERSION}.jar + echo -e "${LGREEN}Upgraded DUO extension to version ${NEW_GUAC_VERSION}${GREY}" + echo + break + fi +done + +# Check for LDAP extension and upgrade if found +for file in /etc/guacamole/extensions/guacamole-auth-ldap*.jar; do + if [[ -f $file ]]; then + echo -e "${LGREEN}LDAP authentication extension was found, upgrading...${GREY}" + rm /etc/guacamole/extensions/guacamole-auth-ldap*.jar &>>${INSTALL_LOG} + wget -q --show-progress -O guacamole-auth-ldap-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-ldap-${NEW_GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-ldap-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-ldap-${NEW_GUAC_VERSION}.tar.gz" + exit 1 + fi + tar -xzf guacamole-auth-ldap-${NEW_GUAC_VERSION}.tar.gz &>>${INSTALL_LOG} + mv -f guacamole-auth-ldap-${NEW_GUAC_VERSION}/guacamole-auth-ldap-${NEW_GUAC_VERSION}.jar /etc/guacamole/extensions/ &>>${INSTALL_LOG} + chmod 664 /etc/guacamole/extensions/guacamole-auth-ldap-${NEW_GUAC_VERSION}.jar + echo -e "${LGREEN}Upgraded LDAP extension to version ${NEW_GUAC_VERSION}${GREY}" + echo + break + fi +done + +# Check for Quick Connection extension and upgrade if found +for file in /etc/guacamole/extensions/guacamole-auth-quickconnect*.jar; do + if [[ -f $file ]]; then + echo -e "${LGREEN}Quick Connect extension was found, upgrading...${GREY}" + rm /etc/guacamole/extensions/guacamole-auth-quickconnect*.jar &>>${INSTALL_LOG} + wget -q --show-progress -O guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.tar.gz" + exit 1 + fi + tar -xzf guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.tar.gz &>>${INSTALL_LOG} + mv -f guacamole-auth-quickconnect-${NEW_GUAC_VERSION}/guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.jar /etc/guacamole/extensions/ &>>${INSTALL_LOG} + chmod 664 /etc/guacamole/extensions/guacamole-auth-quickconnect-${NEW_GUAC_VERSION}.jar + echo -e "${LGREEN}Upgraded Quick Connect extension to version ${NEW_GUAC_VERSION}${GREY}" + echo + break + fi +done + +# Check for History Recording Storage extension and upgrade if found +for file in /etc/guacamole/extensions/guacamole-history-recording-storage*.jar; do + if [[ -f $file ]]; then + echo -e "${LGREEN}History Recording Storage extension was found, upgrading...${GREY}" + rm /etc/guacamole/extensions/guacamole-history-recording-storage*.jar &>>${INSTALL_LOG} + wget -q --show-progress -O guacamole-history-recording-storage-${NEW_GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-history-recording-storage-${NEW_GUAC_VERSION}.tar.gz + if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed to download guacamole-history-recording-storage-${NEW_GUAC_VERSION}.tar.gz" 1>&2 + echo -e "${GUAC_SOURCE_LINK}/binary/guacamole-history-recording-storage-${NEW_GUAC_VERSION}.tar.gz" + exit 1 + fi + tar -xzf guacamole-history-recording-storage-${NEW_GUAC_VERSION}.tar.gz &>>${INSTALL_LOG} + mv -f guacamole-history-recording-storage-${NEW_GUAC_VERSION}/guacamole-history-recording-storage-${NEW_GUAC_VERSION}.jar /etc/guacamole/extensions/ &>>${INSTALL_LOG} + chmod 664 /etc/guacamole/extensions/guacamole-history-recording-storage-${NEW_GUAC_VERSION}.jar + echo -e "${LGREEN}Upgraded History Recording Storage extension to version ${NEW_GUAC_VERSION}${GREY}" + echo + break + fi +done + +# Fix for #196 see https://github.com/MysticRyuujin/guac-install/issues/196 +mkdir -p /usr/sbin/.config/freerdp +chown daemon:daemon /usr/sbin/.config/freerdp + +# Fix for #197 see https://github.com/MysticRyuujin/guac-install/issues/197 +mkdir -p /var/guacamole +chown daemon:daemon /var/guacamole + +# Bring guacd and Tomcat back up +echo -e "${GREY}Starting guacd and Tomcat services..." +systemctl enable guacd +systemctl start guacd +systemctl start ${TOMCAT_VERSION} +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Cleanup +echo -e "${GREY}Clean up install files...${GREY}" +rm -rf guacamole-* +rm -rf mysql-connector-j-* +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Failed. See ${INSTALL_LOG}${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Done +printf "${LGREEN}Guacamole ${NEW_GUAC_VERSION} upgrade complete! \n${NC}" +echo -e ${NC} diff --git a/guac-management/useful-config-info.txt b/guac-management/useful-config-info.txt new file mode 100644 index 0000000..0fcd285 --- /dev/null +++ b/guac-management/useful-config-info.txt @@ -0,0 +1,92 @@ +######################### +Connection setup tips: +######################### +# Quick connection syntax (Windows 10 RDP) + rdp://user@xxx.xxx.xxx.xxx/?security=nla&ignore-cert=true + +# To view links to recorded sessions from within the connection history page: + 1. Install the history-recording-storage option + 2. For each connection configuration profile, in the Screen Recording section set: + Recording Path = ${HISTORY_PATH}/${HISTORY_UUID} + Automatically create recording path = tick + +# To create a quasi SSO pass through for LDAP and others, for each connection configuration profile: + Add ${GUAC_USERNAME} to the Username field for each connection profile + Add ${GUAC_PASSWORD} to the Password field for each connection profile + + +#################### +Guacamole Debug mode +#################### +sudo systemctl stop guacd && sudo /usr/local/sbin/guacd -L debug -f #Verbose logs will start in the console. + + +################################################ +Switch to Debian Testing repo +(upgrade/bugfix beyond a current stable package) +################################################ +sudo apt update && sudo apt upgrade -y # Update first +sudo cp /etc/apt/sources.list sources.list.backup # Backup sources list +sudo sed -i 's/bullseye/testing/g' /etc/apt/sources.list # Switch to testing + +sudo nano /etc/apt/sources.list # Now manually edit + comment out all lines having "security.debian.org" + comment out all lines that end with "updates" + add this line: deb http://security.debian.org testing-security main + +sudo apt update && sudo apt-get install --only-upgrade libssh2-1-dev # update an individual package + + + +############################################### +Audit Guacamole Connections and User access. +############################################### +mysql -u root -p guacamole_db +select + guacamole_entity.name, + guacamole_connection.connection_name, + guacamole_connection_permission.permission +from + guacamole_connection + left join guacamole_connection_permission on guacamole_connection_permission.connection_id = guacamole_connection.connection_id + left join guacamole_entity on guacamole_entity.entity_id = guacamole_connection_permission.entity_id +where + guacamole_connection_permission.permission = 'READ' + and guacamole_entity.name != 'guacadmin'; +Quit to exit + + +############################################### +# Manually reset TOTP configuration for a user +############################################### +# This is likely not needed beyond in Gucamole 1.40 as the gui provides an option to reset. Kept for reference. +mysql -u root -p +use guacamole_db; +SELECT user_id FROM guacamole_user INNER JOIN guacamole_entity ON guacamole_entity.entity_id = guacamole_user.entity_id WHERE guacamole_entity.name = 'guacadmin'; +UPDATE guacamole_user_attribute SET attribute_value='false' WHERE attribute_name = 'guac-totp-key-confirmed' and user_id = '1'; +quit; + + +############################################### +# Quick troubleshoot SQL commands +############################################### +# Login +sudo mysql -u root -p + +# Check time zone +SELECT @@time_zone; + +# Rename user from local to remove access +use guacamole_db; +RENAME USER '${GUAC_USER}'@'%' TO '${GUAC_USER}'@'xx.xx.xx.%'; + +# Check user access +SELECT user,host FROM mysql.user; +SHOW GRANTS FOR guacamole_user; + +######################### +Nginx load / DoS testing +######################### +https://ourcodeworld.com/articles/read/949/how-to-perform-a-dos-attack-slow-http-with-slowhttptest-test-your-server-slowloris-protection-in-kali-linux +slowhttptest -c 10000 -H -g -o ./output_file -i 3 -r 500 -t GET -u http://jumpbox.domain.com -x 24 -p 2 + diff --git a/guac-optional-features/add-auth-duo.sh b/guac-optional-features/add-auth-duo.sh new file mode 100644 index 0000000..217b905 --- /dev/null +++ b/guac-optional-features/add-auth-duo.sh @@ -0,0 +1,60 @@ +#!/bin/bash +####################################################################################################################### +# Add Duo (MFA) support to Guacamole +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# If run as standalone and not from the main installer script, check the below variables are correct. + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +clear + +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LGREEN}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +GUAC_VERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT_VERSION}/webapps/guacamole/guacamole-common-js/modules/Version.js) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" + +echo +wget -q --show-progress -O guacamole-auth-duo-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-duo-${GUAC_VERSION}.tar.gz +tar -xzf guacamole-auth-duo-${GUAC_VERSION}.tar.gz +mv -f guacamole-auth-duo-${GUAC_VERSION}/guacamole-auth-duo-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +chmod 664 /etc/guacamole/extensions/guacamole-auth-duo-${GUAC_VERSION}.jar +echo -e "${LGREEN}Installed guacamole-auth-duo-${GUAC_VERSION}${GREY}" +echo "duo-integration-key: " >>/etc/guacamole/guacamole.properties +echo "duo-secret-key: " >>/etc/guacamole/guacamole.properties +echo "duo-api-hostname: " >>/etc/guacamole/guacamole.properties +echo "duo-application-key: " >>/etc/guacamole/guacamole.properties +echo +systemctl restart ${TOMCAT_VERSION} +systemctl restart guacd + +echo -e "${LYELLOW}You must now set up your online Duo account with a new 'Web SDK' application." +echo +echo "Next you must copy the API settings from your Duo account into /etc/guacamole/guacamole.properties in the EXACT below format." +echo -e "Be VERY careful to avoid extra trailing spaces or other line feed characters when pasting!${GREY}" +echo +echo "duo-integration-key: ??????????" +echo "duo-api-hostname: ??????????" +echo "duo-secret-key: ??????????" +echo "duo-application-key: (this is locally created - run 'pwgen 40 1' to manually generate this 40 char random value)" +echo +echo "Once this change is complete, restart Guacamole with sudo systemctl restart ${TOMCAT_VERSION}" + +rm -rf guacamole-* + +echo +echo -e ${NC} diff --git a/guac-optional-features/add-auth-ldap.sh b/guac-optional-features/add-auth-ldap.sh new file mode 100644 index 0000000..e8a9a80 --- /dev/null +++ b/guac-optional-features/add-auth-ldap.sh @@ -0,0 +1,77 @@ +#!/bin/bash +####################################################################################################################### +# Add Active Directory integration with Guacamole +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# If run as standalone and not from the main installer script, check the below variables are correct. + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +clear + +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +GUAC_VERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT_VERSION}/webapps/guacamole/guacamole-common-js/modules/Version.js) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" + +echo +echo -e "${LYELLOW}Have you updated this script to reflect your Active Directory settings?${NC}" + +read -p "Do you want to proceed? (yes/no) " yn +echo +case $yn in +y) echo Beginning LDAP auth config... ;; +n) + echo exiting... + exit + ;; +*) + echo invalid response + exit 1 + ;; +esac + +echo +wget -q --show-progress -O guacamole-auth-ldap-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-ldap-${GUAC_VERSION}.tar.gz +tar -xzf guacamole-auth-ldap-${GUAC_VERSION}.tar.gz +mv -f guacamole-auth-ldap-${GUAC_VERSION}/guacamole-auth-ldap-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +chmod 664 /etc/guacamole/extensions/guacamole-auth-ldap-${GUAC_VERSION}.jar +echo -e "${LGREEN}Installed guacamole-auth-ldap-${GUAC_VERSION}${GREY}" +echo +echo Adding the below config to /etc/guacamole/guacamole.properties +cat <&2 + exit 1 +fi + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +GUAC_VERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT_VERSION}/webapps/guacamole/guacamole-common-js/modules/Version.js) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" + +echo +wget -q --show-progress -O guacamole-auth-totp-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-totp-${GUAC_VERSION}.tar.gz +tar -xzf guacamole-auth-totp-${GUAC_VERSION}.tar.gz +mv -f guacamole-auth-totp-${GUAC_VERSION}/guacamole-auth-totp-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +chmod 664 /etc/guacamole/extensions/guacamole-auth-totp-${GUAC_VERSION}.jar +echo -e "${LGREEN}Installed guacamole-auth-totp-${GUAC_VERSION}${GREY}" + +systemctl restart ${TOMCAT_VERSION} +systemctl restart guacd + +rm -rf guacamole-* + +echo +echo "Done!" +echo -e ${NC} diff --git a/guac-optional-features/add-fail2ban.sh b/guac-optional-features/add-fail2ban.sh new file mode 100644 index 0000000..3c7e69f --- /dev/null +++ b/guac-optional-features/add-fail2ban.sh @@ -0,0 +1,265 @@ +#!/bin/bash +####################################################################################################################### +# Add fail2ban restrictions to Guacamole +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +clear + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LGREEN}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +# Initialise variables +FAIL2BAN_BASE="" +FAIL2BAN_GUAC="" +FAIL2BAN_NGINX="" +FAIL2BAN_SSH="" +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) + +#Clean up from any previous runs +rm -f /tmp/fail2ban.conf +rm -f /tmp/ip_list.txt +rm -f /tmp/netaddr.txt +rm -f /tmp/fail2ban.update + +####################################################################################################################### +# Start setup prompts ################################################################################################# +####################################################################################################################### + +# Prompt to install fail2ban base package with no policy as yet, default of yes +if [[ -z ${FAIL2BAN_BASE} ]]; then + echo + echo -e -n "${LGREEN}Install Fail2ban base package? [default y]: ${GREY}" + read PROMPT + if [[ ${PROMPT} =~ ^[Nn]$ ]]; then + FAIL2BAN_BASE=false + else + FAIL2BAN_BASE=true + fi +fi + +# Prompt to install Guacamole fail2ban config defaults, default of no +if [[ -z ${FAIL2BAN_GUAC} ]] && [[ "${FAIL2BAN_BASE}" = true ]]; then + echo -e -n "${GREY}POLICY: Apply Guacamole fail2ban security policy? (Y/n) [default y]:${GREY}" + read PROMPT + if [[ ${PROMPT} =~ ^[Nn]$ ]]; then + FAIL2BAN_GUAC=false + else + FAIL2BAN_GUAC=true + fi +fi + +# Prompt to install Nginx fail2ban config defaults , default of no - NOT IMPLEMENTED YET +#if [[ -z ${FAIL2BAN_NGINX} ]] && [[ "${FAIL2BAN_BASE}" = true ]]; then +# echo -e -n "${GREY}POLICY: Apply Nginx fail2ban security policy? (y/n) [default n]:${GREY}" +# read PROMPT +# if [[ ${PROMPT} =~ ^[Yy]$ ]]; then +# FAIL2BAN_NGINX=true +# else +# FAIL2BAN_NGINX=false +# fi +#fi + +# Prompt to install SSH fail2ban config defaults , default of no - NOT IMPLEMENTED YET +#if [[ -z ${FAIL2BAN_SSH} ]] && [[ "${FAIL2BAN_BASE}" = true ]]; then +# echo -e -n "${GREY}POLICY: Apply SSH fail2ban security policy? (y/n) [default n]:${GREY}" +# read PROMPT +# if [[ ${PROMPT} =~ ^[Yy]$ ]]; then +# FAIL2BAN_SSH=true +# else +# FAIL2BAN_SSH=false +# fi +#fi + +####################################################################################################################### +# Fail2ban base setup ################################################################################################# +####################################################################################################################### + +# Install base fail2ban base application, and whitelist the local subnet as the starting baseline (no policy defined yet) +if [[ "${FAIL2BAN_BASE}" = true ]]; then + + #Update and install fail2ban (and john for management of config file updates, and not overwrite any existing settings) + apt-get update -qq >/dev/null 2>&1 + apt-get install fail2ban john -qq -y >/dev/null 2>&1 + + # Create the basic jail.local template and local subnet whitelist + cat >/tmp/fail2ban.conf </tmp/ip_list.txt + + # Loop the list of discovered ips and extract the subnet ID addresses for each interface + FILE=/tmp/ip_list.txt + LINES=$(cat $FILE) + for LINE in $LINES; do + + tonum() { + if [[ $LINE =~ ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+) ]]; then + addr=$(((${BASH_REMATCH[1]} << 24) + (${BASH_REMATCH[2]} << 16) + (${BASH_REMATCH[3]} << 8) + ${BASH_REMATCH[4]})) + eval "$2=\$addr" + fi + } + toaddr() { + b1=$((($1 & 0xFF000000) >> 24)) + b2=$((($1 & 0xFF0000) >> 16)) + b3=$((($1 & 0xFF00) >> 8)) + b4=$(($1 & 0xFF)) + eval "$2=\$b1.\$b2.\$b3.\$b4" + } + + if [[ $LINE =~ ^([0-9\.]+)/([0-9]+)$ ]]; then + # CIDR notation + IPADDR=${BASH_REMATCH[1]} + NETMASKLEN=${BASH_REMATCH[2]} + PREFIX=$NETMASKLEN + zeros=$((32 - NETMASKLEN)) + NETMASKNUM=0 + for ((i = 0; i < $zeros; i++)); do + NETMASKNUM=$(((NETMASKNUM << 1) ^ 1)) + done + NETMASKNUM=$((NETMASKNUM ^ 0xFFFFFFFF)) + toaddr $NETMASKNUM NETMASK + else + IPADDR=${1:-192.168.1.1} + NETMASK=${2:-255.255.255.0} + fi + + tonum $IPADDR IPADDRNUM + tonum $NETMASK NETMASKNUM + + # The logic to calculate network and broadcast + INVNETMASKNUM=$((0xFFFFFFFF ^ NETMASKNUM)) + NETWORKNUM=$((IPADDRNUM & NETMASKNUM)) + BROADCASTNUM=$((INVNETMASKNUM | NETWORKNUM)) + + toaddr $NETWORKNUM NETWORK + toaddr $BROADCASTNUM BROADCAST + + # Reverse engineer the subnet ID from the calcualted IP address and subnet prefix + IFS=. read -r i1 i2 i3 i4 <<<"$IPADDR" + IFS=. read -r m1 m2 m3 m4 <<<"$NETMASK" + + # Lay out the subnet ID address as a variable + printf -v NETADDR "%d.%d.%d.%d" "$((i1 & m1))" "$((i2 & m2))" "$((i3 & m3))" "$((i4 & m4))" + + #Dump out the calcualted subnet IDs to a file + echo $NETADDR"/"$NETMASKLEN | tr '\n' ' ' | cat >>/tmp/netaddr.txt + + done + +fi + +if [[ "${FAIL2BAN_BASE}" = true ]]; then + # Now the above loop is done, append the single loopback address to all the discovered the subnet IDs in a single line + sed -i 's/^/127.0.0.1\/24 /' /tmp/netaddr.txt + + # Finally assemble the entire syntax of the ignoreip whitelist for insertion into the base fail2ban config + SED_IGNORE=$(echo "ignoreip = ") + SED_NETADDR=$(cat /tmp/netaddr.txt) + sed -i "s|ignoreip \=|${SED_IGNORE}${SED_NETADDR}|g" /tmp/fail2ban.conf + + # Move the new base fail2ban config to the jail.local file + touch /etc/fail2ban/jail.local + + # Apply the base config, keeping any pre-existing settings + sudo bash -c 'cat /tmp/fail2ban.conf /etc/fail2ban/jail.local | unique /tmp/fail2ban.update ; cat /tmp/fail2ban.update > /etc/fail2ban/jail.local' + + # Clean up + rm -f /tmp/fail2ban.conf + rm -f /tmp/ip_list.txt + rm -f /tmp/netaddr.txt + rm -f /tmp/fail2ban.update + + # bounce the service to reload the new config + systemctl restart fail2ban + + # Done + echo + echo -e "${LGREEN}Fail2ban installed...${GREY}" + echo + +else + echo -e "${LGREEN}Fail2ban setup cancelled.${GREY}" + +fi + +####################################################################################################################### +# Fail2ban optional policy setup items ################################################################################ +####################################################################################################################### + +if [[ "${FAIL2BAN_GUAC}" = true ]]; then + + # Create the Guacamole jail.local policy template + cat >/tmp/fail2ban.conf < /etc/fail2ban/jail.local' + + # Backup the default Fail2ban Guacamole filter + cp /etc/fail2ban/filter.d/guacamole.conf /etc/fail2ban/filter.d/guacamole.conf.bak + + # Remove the default log search regex + sudo bash -c 'sed -e "/Authentication attempt from/ s/^#*/#/" -i /etc/fail2ban/filter.d/guacamole.conf' + + # Create a new log search regex specific for tomcat logs (as a variable due to complexity of characters for sed syntax) + REGEX='failregex = ^.*WARN o\.a\.g\.r\.auth\.AuthenticationService - Authentication attempt from for user "[^"]*" failed\.$' + #Insert the new regex + sed -i -e "/Authentication attempt from/a ${REGEX}" /etc/fail2ban/filter.d/guacamole.conf + + # Done + echo -e "${LGREEN}Guacamole security policy applied${GREY}\n- ${SED_NETADDR}are whitelisted from all IP bans.\n- To alter this whitelist, edit /etc/fail2ban/jail.local & sudo systemctl restart fail2ban \n \n This script may take a while to complete on first run..." + + # Bounce the service to reload the new config + systemctl restart fail2ban + echo +fi + +# Clean up +rm -f /tmp/fail2ban.conf +rm -f /tmp/ip_list.txt +rm -f /tmp/netaddr.txt +rm -f /tmp/fail2ban.update + +############## Start Fail2ban NGINX security policy option ############### +#if [[ "${FAIL2BAN_NGINX}" = true ]]; then +# echo -e "${LGREEN}Nginx Fail2ban policy not implemented yet.${GREY}" +# echo +#fi + +############### Start Fail2ban SSH security policy option ################ +#if [[ "${FAIL2BAN_SSH}" = true ]]; then +# echo -e "${LGREEN}SSH Fail2ban policy not implemented yet..${GREY}" +# echo +#fi + +#Done +echo -e ${NC} diff --git a/guac-optional-features/add-smtp-relay-o365.sh b/guac-optional-features/add-smtp-relay-o365.sh new file mode 100644 index 0000000..d078888 --- /dev/null +++ b/guac-optional-features/add-smtp-relay-o365.sh @@ -0,0 +1,127 @@ +#!/bin/bash +####################################################################################################################### +# SMTP relay with Office 365 Setup +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# If run as standalone and not from the main installer script, check the below variables are correct. + +# Prerequisites: +# An office 365 account with a mailbox (NON ADMIN!!) +# An app password created for the above office 365 user at https://mysignins.microsoft.com/security-info +# SMTP Auth enabled for that user under "manage mail apps in the Office365 admin centre + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +clear + +SENDER=$SUDO_USER +SERVER=$(uname -n) +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +LOCAL_DOMAIN= + +echo +echo -e "${LYELLOW}SMTP relay for Office365 setup...${LGREEN}" + +# Install Posfix +echo +echo -e "${GREY}Installing Postfix with non-interactive defaults..." +apt-get update -qq >/dev/null 2>&1 +DEBIAN_FRONTEND="noninteractive" apt-get install postfix mailutils -qq -y >/dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Postfix install failed. ${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" +fi + +# Get the Office365 smtp authentication credentials +echo +echo -e "${LYELLOW}An Office365 account email account is needed for SMTP relay authentication...${LGREEN}" +echo +read -p "Enter O365 SMTP auth enabled email : " SMTP_EMAIL +read -s -p "Enter the SMTP auth account 'app password': " APP_PWD +echo +echo + +# Remove some default Postifx config items that conflict with new entries +sed -i '/relayhost/d' /etc/postfix/main.cf +sed -i '/smtp_tls_security_level=may/d' /etc/postfix/main.cf + +# For simple relay outbound only, limit Postfix to just loopback and IPv4 +sed -i 's/inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf +sed -i "s/inet_protocols = all/inet_protocols = ipv4/g" /etc/postfix/main.cf + +echo -e "${GREY}Configuring Postfix for O365 SMTP relay and TLS auth..." +# Add the new Office365 SMTP auth with TLS settings +cat </dev/null 2>&1 +relayhost = [smtp.office365.com]:587 +smtp_use_tls = yes +smtp_always_send_ehlo = yes +smtp_sasl_auth_enable = yes +smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd +smtp_sasl_security_options = noanonymous +smtp_sasl_tls_security_options = noanonymous +smtp_tls_security_level = encrypt +smtp_generic_maps = hash:/etc/postfix/generic +smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt +EOF +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Postfix restart failed. ${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" + echo +fi + +# Setup the password file and postmap +touch /etc/postfix/sasl_passwd +cat </dev/null 2>&1 +[smtp.office365.com]:587 ${SMTP_EMAIL}:${APP_PWD} +EOF +chown root:root /etc/postfix/sasl_passwd +chmod 0600 /etc/postfix/sasl_passwd +postmap /etc/postfix/sasl_passwd + +# Setup the generic map file +touch /etc/postfix/generic +cat </dev/null 2>&1 +root@${SERVER} ${SMTP_EMAIL} +${SENDER}@${SERVER} ${SMTP_EMAIL} +@${LOCAL_DOMAIN} ${SMTP_EMAIL} +EOF +chown root:root /etc/postfix/generic +chmod 0600 /etc/postfix/generic +postmap /etc/postfix/generic + +# Restart and test +echo -e "${GREY}Restarting Postfix..." +systemctl restart postfix +if [[ $? -ne 0 ]]; then + echo -e "${LRED}Postfix restart failed. ${GREY}" 1>&2 + exit 1 +else + echo -e "${LGREEN}OK${GREY}" +fi + +echo +read -p "Enter an email address to test that email relay is working : " TEST_EMAIL +echo "This is a test email" | mail -s "SMTP Auth Relay Is Working is working" ${TEST_EMAIL} -a "FROM:${SMTP_EMAIL}" +echo -e "${LGREEN}Test message sent.." +echo -e ${NC} diff --git a/guac-optional-features/add-tls-guac-daemon.sh b/guac-optional-features/add-tls-guac-daemon.sh new file mode 100644 index 0000000..ec250b7 --- /dev/null +++ b/guac-optional-features/add-tls-guac-daemon.sh @@ -0,0 +1,104 @@ +#!/bin/bash +####################################################################################################################### +# Harden Guacd <-> Guac client traffic in TLS wrapper +# For Ubuntu / Debian / Raspbian +# David Harrop +# April 2023 +####################################################################################################################### + +# To delete and reissue a new cert +# sudo keytool -delete -alias guacd -noprompt -cacerts -storepass changeit -file guacd.crt + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +RSA_KEY_LENGTH=2048 +# Below variables are automatically updated by the 1-setup.sh script with the respective values given at install (manually update if blank) +CERT_COUNTRY= +CERT_STATE= +CERT_LOCATION= +CERT_ORG= +CERT_OU= +CERT_DAYS= + +clear + +# Create the special directory for guacd tls certificate and key. +mkdir -p /etc/guacamole/ssl +echo +cat <&2 + exit 1 +fi + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +GUAC_VERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT_VERSION}/webapps/guacamole/guacamole-common-js/modules/Version.js) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" +HISTREC_PATH_DEFAULT=/var/lib/guacamole/recordings # Apache default + +while true; do + echo + read -p "Enter recorded storage path [Enter for default ${HISTREC_PATH_DEFAULT}]: " HISTREC_PATH + [[ "${HISTREC_PATH}" = "" ]] || [[ "${HISTREC_PATH}" != "" ]] && break +done +# If no custom path is given, lets assume the default path on hitting enter +if [[ -z "${HISTREC_PATH}" ]]; then + HISTREC_PATH="${HISTREC_PATH_DEFAULT}" +fi +echo + +# Download Guacamole history recording storage extension +wget -q --show-progress -O guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz +tar -xzf guacamole-history-recording-storage-${GUAC_VERSION}.tar.gz + +# Move history recording storage extension files +mv -f guacamole-history-recording-storage-${GUAC_VERSION}/guacamole-history-recording-storage-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +chmod 664 /etc/guacamole/extensions/guacamole-history-recording-storage-${GUAC_VERSION}.jar +#Setup the default recording path +mkdir -p ${HISTREC_PATH} +chown daemon:tomcat ${HISTREC_PATH} +chmod 2750 ${HISTREC_PATH} +echo "recording-search-path: ${HISTREC_PATH}" >>/etc/guacamole/guacamole.properties +echo -e "${LGREEN}Installed guacamole-history-recording-storage-${GUAC_VERSION}${GREY}" + +systemctl restart ${TOMCAT_VERSION} +systemctl restart guacd + +rm -rf guacamole-* + +echo +echo "Done!" +echo -e ${NC} diff --git a/guac-optional-features/add-xtra-quickconnect.sh b/guac-optional-features/add-xtra-quickconnect.sh new file mode 100644 index 0000000..cc4a148 --- /dev/null +++ b/guac-optional-features/add-xtra-quickconnect.sh @@ -0,0 +1,47 @@ +#!/bin/bash +####################################################################################################################### +# Add Quick Connect extension to Guacamole +# For Ubuntu / Debian / Raspbian +# David Harrop +# September 2023 +####################################################################################################################### + +# If run as standalone and not from the main installer script, check the below variables are correct. + +# Prepare text output colours +GREY='\033[0;37m' +DGREY='\033[0;90m' +GREYB='\033[1;37m' +LRED='\033[0;91m' +LGREEN='\033[0;92m' +LYELLOW='\033[0;93m' +NC='\033[0m' #No Colour + +clear + +# Check if user is root or sudo +if ! [[ $(id -u) = 0 ]]; then + echo + echo -e "${LRED}Please run this script as sudo or root${NC}" 1>&2 + exit 1 +fi + +TOMCAT_VERSION=$(ls /etc/ | grep tomcat) +GUAC_VERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT_VERSION}/webapps/guacamole/guacamole-common-js/modules/Version.js) +GUAC_SOURCE_LINK="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VERSION}" + +echo +wget -q --show-progress -O guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz ${GUAC_SOURCE_LINK}/binary/guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz +tar -xzf guacamole-auth-quickconnect-${GUAC_VERSION}.tar.gz +mv -f guacamole-auth-quickconnect-${GUAC_VERSION}/guacamole-auth-quickconnect-${GUAC_VERSION}.jar /etc/guacamole/extensions/ +chmod 664 /etc/guacamole/extensions/guacamole-auth-quickconnect-${GUAC_VERSION}.jar +echo -e "${LGREEN}Installed guacamole-auth-quickconnect-${GUAC_VERSION}${GREY}" + +systemctl restart ${TOMCAT_VERSION} +systemctl restart guacd + +rm -rf guacamole-* + +echo +echo "Done!" +echo -e ${NC}