SHARE
TWEET

guacamole

AlexaMP Feb 14th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/env bash
  2. ##############################################################
  3. # This script was created by Hernan Dario Nacimiento based on:
  4. #  http://guacamole.incubator.apache.org/releases/0.9.13-incubating/
  5. #  http://guacamole.incubator.apache.org/doc/0.9.13-incubating/gug/
  6. #  http://guacamole.incubator.apache.org/doc/0.9.13-incubating/gug/administration.html
  7. #  http://nginx.org/en/docs/http/configuring_https_servers.html
  8. #  http://nginx.org/en/docs/http/ngx_http_spdy_module.html
  9. #  https://wiki.centos.org/AdditionalResources/Repositories
  10. # Task of this script:
  11. #  Install Packages Dependencies
  12. #  Download Guacamole and MySQL Connector packages
  13. #  Install Guacamole Server
  14. #  Install Guacamole Client
  15. #  Install MySQL Connector
  16. #  Configure MariaDB or MySQL
  17. #  Setting Tomcat Server
  18. #  Generates a Java KeyStore for SSL Support
  19. #  Install and Setting Nginx Proxy (SPDY enabled)
  20. #  Generates a Self-Signed Certificate for SSL Support
  21. #  Cofigure SELinux for Nginx Proxy
  22. #  Configure FirewallD or iptables
  23. ##############################################################
  24. #####    VARIABLES    ####
  25. ##########################
  26. SCRIPT=`basename ${BASH_SOURCE[0]}` #Script File Name
  27. GUACA_VER="0.9.13-incubating"
  28. MYSQL_CONNECTOR_VER="5.1.44"
  29. LIBJPEG_VER="1.5.2"
  30. SCRIPT_BUILD="2"
  31. SCRIPT_VERSION="${GUACA_VER} Build ${SCRIPT_BUILD}"
  32. SERVER_HOSTNAME="localhost"
  33. INSTALL_DIR="/usr/local/src/guacamole/${GUACA_VER}/"
  34. LIB_DIR="/var/lib/guacamole/"
  35. PWD=`pwd`
  36. filename="${PWD}/guacamole-${GUACA_VER}."$(date +"%d-%y-%b")""
  37. logfile="${filename}.log"
  38. fwbkpfile="${filename}.firewall.bkp"
  39. MYSQ_CONNECTOR_URL="http://dev.mysql.com/get/Downloads/Connector-J/"
  40. MYSQL_CONNECTOR="mysql-connector-java-${MYSQL_CONNECTOR_VER}"
  41. MYSQL_PORT="3306"
  42. GUACA_PORT="4822"
  43. GUACA_CONF="guacamole.properties"
  44. GUACA_URL="http://sourceforge.net/projects/guacamole/files/current/"
  45. GUACA_SERVER="guacamole-server-${GUACA_VER}" #Source
  46. #GUACA_CLIENT="guacamole-client-${GUACA_VER}" #Source
  47. GUACA_CLIENT="guacamole-${GUACA_VER}" #Binary
  48. GUACA_JDBC="guacamole-auth-jdbc-${GUACA_VER}" #Extension
  49. LIBJPEG_URL="http://sourceforge.net/projects/libjpeg-turbo/files/${LIBJPEG_VER}/"
  50. #LIBJPEG_TURBO="libjpeg-turbo-${LIBJPEG_VER}" #Dependency source
  51. LIBJPEG_TURBO="libjpeg-turbo-official-${LIBJPEG_VER}" #Dependency rpm
  52. CENTOS_VER=`rpm -qi --whatprovides /etc/redhat-release | awk '/Version/ {print $3}'`
  53. if [ $CENTOS_VER -ge 7 ]; then MySQL_Packages="mariadb mariadb-server"; Menu_SQL="MariaDB"; else MySQL_Packages="mysql mysql-server"; Menu_SQL="MySQL"; fi #set rpm packages name
  54. MACHINE_ARCH=`uname -m`
  55. if [ $MACHINE_ARCH = "x86_64" ]; then ARCH="64"; elif [ $MACHINE_ARCH = "i686" ]; then MACHINE_ARCH="i386"; else ARCH=""; fi #set arch
  56. regex_mail="^[a-z0-9!#\$%&'*+/=?^_\`{|}~-]+(\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\$"
  57. regex_idn="(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)"
  58. Black=`tput setaf 0`   #${Black}
  59. Red=`tput setaf 1`     #${Red}
  60. Green=`tput setaf 2`   #${Green}
  61. Yellow=`tput setaf 3`  #${Yellow}
  62. Blue=`tput setaf 4`    #${Blue}
  63. Magenta=`tput setaf 5` #${Magenta}
  64. Cyan=`tput setaf 6`    #${Cyan}
  65. White=`tput setaf 7`   #${White}
  66. Bold=`tput bold`       #${Bold}
  67. Rev=`tput smso`        #${Rev}
  68. Reset=`tput sgr0`      #${Reset}
  69.  
  70. #Initialize variables to default values.
  71. MYSQL_PASSWD="guacamole"
  72. DB_NAME="guacamole"
  73. DB_USER="guacamole"
  74. DB_PASSWD="guacamole"
  75. JKSTORE_PASSWD="guacamole"
  76. INSTALL_MODE="interactive"
  77. INSTALL_NGINX="no"
  78. LETSENCRYPT_CERT="no"
  79. GUACASERVER_HOSTNAME="localhost"
  80. GUACAMOLE_URIPATH="guacamole"
  81.  
  82. HELP () { #Help function
  83.   echo -e \\n"${Bold}Guacamole Install Script Help.${Reset}"\\n
  84.   echo "${Bold}Usage:${Reset}"
  85.   echo "  $SCRIPT [options] -s      install Guacamole Silently"
  86.   echo -e "  $SCRIPT [options] -p [yes|no]  install Proxy feature"\\n
  87.   echo "${Bold}Options:${Reset}"
  88.   echo " -${Rev}a${Reset}, <string> --Sets the root password for ${Menu_SQL}. Default is ${Bold}guacamole${Reset}."
  89.   echo " -${Rev}b${Reset}, <string> --Sets the Guacamole DB name. Default is ${Bold}guacamole${Reset}."
  90.   echo " -${Rev}c${Reset}, <string> --Sets the Guacamole DB username. Default is ${Bold}guacamole${Reset}."
  91.   echo " -${Rev}d${Reset}, <string> --Sets the Guacamole DB password. Default is ${Bold}guacamole${Reset}."
  92.   echo " -${Rev}e${Reset}, <string> --Sets the Java KeyStore password (least 6 characters). Default is ${Bold}guacamole${Reset}."
  93.   echo " -${Rev}l${Reset}, <string:string>  --Sets a domain name and e-mail for the Let's Encrypt Certificate. Example ${Bold}your@email.com:guacamole.yourdomain.com${Reset}."
  94.   echo " -${Rev}s${Reset},      --Install Guacamole Silently. Default names and password are: ${Bold}guacamole${Reset}."
  95.   echo " -${Rev}p${Reset}, [yes|no] --Install the Proxy feature (Nginx)?."
  96.   echo " -${Rev}i${Reset},      --This option launch the interactive menu. Default is ${Bold}yes${Reset}."
  97.   echo " -${Rev}h${Reset},      --Displays this help message and exit."
  98.   echo -e " -${Rev}v${Reset},       --Displays the script version information and exit."\\n
  99.   echo "${Bold}Examples:${Reset}"
  100.   echo "  * Full and no interactive install: ${Bold}$SCRIPT -a sqlpasswd -b guacadb -c guacadbuser -d guacadbpasswd -e guacakey -s -p yes -l your@email.com:guacamole.yourdomain.com${Reset}"
  101.   echo "  * Same as above but with defult names and passwords: ${Bold}$SCRIPT -s -p yes -l your@email.com:guacamole.yourdomain.com${Reset}"
  102.   echo "  * Same as above but not install Nginx and not create Let's Encrypt Certificate : ${Bold}$SCRIPT -s -p no${Reset}"
  103.   echo -e "  * Only install Nginx: ${Bold}$SCRIPT -p yes${Reset}"\\n
  104.   exit 1
  105. }
  106.  
  107. showscriptversion () {
  108. echo -e " Guacamole Install Script Version ${SCRIPT_VERSION}"\\n
  109. exit 2
  110. }
  111.  
  112. while getopts a:b:c:d:e:p:l:sihv FLAG; do
  113.   case $FLAG in
  114.     a)  #set option "a"
  115.       MYSQL_PASSWD=$OPTARG
  116.       ;;
  117.     b)  #set option "b"
  118.       DB_NAME=$OPTARG
  119.       ;;
  120.     c)  #set option "c"
  121.       DB_USER=$OPTARG
  122.       ;;
  123.     d)  #set option "d"
  124.       DB_PASSWD=$OPTARG
  125.       ;;
  126.     e)  #set option "e"
  127.       JKSTORE_PASSWD=$OPTARG
  128.       ;;
  129.     p)  #set option "p"
  130.       INSTALL_NGINX=$OPTARG
  131.       if [ $INSTALL_MODE != "silent" ]; then INSTALL_MODE="proxy"; fi
  132.       ;;
  133.     l)  #set option "l"      
  134.       while IFS=":" read -r str1 str2; do LETSENCRYPT_CERT="yes"; if [[ $str1 = *"@"* ]]; then EMAIL_NAME=$str1; DOMAIN_NAME=$str2; else EMAIL_NAME=$str2; DOMAIN_NAME=$str1; fi; done < <(echo $OPTARG)
  135.       ;;
  136.     s)  #set option "s"
  137.       INSTALL_MODE="silent"
  138.       ;;
  139.     i)  #set option "i"
  140.       if [ $INSTALL_MODE != "silent" ]; then INSTALL_MODE="interactive"; fi
  141.       ;;
  142.     h)  #show help
  143.       HELP
  144.       ;;
  145.     v)  #set option "v"
  146.       showscriptversion
  147.       ;;
  148.     \?) #unrecognized option - show help
  149.       echo -e \\n"Option -${BOLD}$OPTARG${NORM} not allowed."
  150.       HELP
  151.       ;;
  152.   esac
  153. done
  154.  
  155. ##########################
  156. #####      MENU      #####
  157. ##########################
  158.  
  159. clear
  160. echo -e "
  161.                                                                  
  162.                                                                  
  163.                                                 ${Yellow}'.'              
  164.                             ${Green}'.:///:-.....'     ${Yellow}-yyys/-          
  165.                      ${Green}.://///++++++++++++++/-  ${Yellow}.yhhhhhys/'        
  166.                   ${Green}'.:++++++++++++++++++++++: ${Yellow}'yhhhhhhhhy-        
  167.           ${White}.+y' ${Green}'://++++++++++++++++++++++++' ${Yellow}':yhhhhyo:'        
  168.         ${White}-yNd. ${Green}'/+++++++++++++++++++++++++++//' ${Yellow}.+yo:' ${White}'::        
  169.        ${White}oNMh' ${Green}./++++++++++++++++++++++++++++++/:' '''' ${White}'mMh.      
  170.       ${White}-MMM:  ${Green}/+++++++++++++++++++++++++++++++++-.:/+:  ${White}yMMs      
  171.       ${White}-MMMs  ${Green}./++++++++++++++++++++++++++++++++++++/' ${White}.mMMy      
  172.       ${White}'NMMMy. ${Green}'-/+++++++++++++++++++++++++++++++/:.  ${White}:dMMMo      
  173.        ${White}+MMMMNy:' ${Green}'.:///++++++++++++++++++++//:-.' ${White}./hMMMMN'      
  174.        ${White}-MMMMMMMmy+-.${Green}''''.---::::::::::--..''''${White}.:ohNMMMMMMy      
  175.         ${White}sNMMMMMMMMMmdhs+/:${Green}--..........--${White}:/oyhmNMMMMMMMMMd-      
  176.          ${White}.+dNMMMMMMMMMMMMMMNNmmmmmmmNNNMMMMMMMMMMMMMMmy:'        
  177.             ${White}./sdNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNmho:'          
  178.           ${White}'     .:+shmmNNMMMMMMMMMMMMMMMMNNmdyo/-'              
  179.           ${White}.o:.       '.-::/+ossssssso++/:-.'       '-/'          
  180.            ${White}.ymh+-.'                           ''./ydy.          
  181.              ${White}/dMMNdyo/-.''''         ''''.-:+shmMNh:            
  182.                ${White}:yNMMMMMMNmdhhyyyyyyyhhdmNNMMMMMNy:              
  183.                  ${White}':sdNNMMMMMMMMMMMMMMMMMMMNNds:'                
  184.                      ${White}'-/+syhdmNNNNNNmdhyo/-'                    
  185. "
  186. menu () {                                                                      
  187. echo -e "                         Installation Menu\n         ${Bold}Guacamole Remote Desktop Gateway ${GUACA_VER}\n" && tput sgr0
  188. echo -n "${Blue} Enter the root password for ${Menu_SQL}: ${Yellow}"
  189.   read MYSQL_PASSWD
  190.   MYSQL_PASSWD=${MYSQL_PASSWD:-guacamole}
  191. echo -n "${Blue} Enter the Guacamole DB name: ${Yellow}"
  192.   read DB_NAME
  193.   DB_NAME=${DB_NAME:-guacamole}
  194. echo -n "${Blue} Enter the Guacamole DB username: ${Yellow}"
  195.   read DB_USER
  196.   DB_USER=${DB_USER:-guacamole}
  197. echo -n "${Blue} Enter the Guacamole DB password: ${Yellow}"
  198.   read DB_PASSWD
  199.   DB_PASSWD=${DB_PASSWD:-guacamole}
  200. echo -n "${Blue} Enter the Java KeyStore password (least 6 characters): ${Yellow}"
  201.   read JKSTORE_PASSWD
  202.   JKSTORE_PASSWD=${JKSTORE_PASSWD:-guacamole}
  203. while true; do
  204.     read -p "${Blue} Do you wish to Install the Proxy feature (Nginx)?: ${Yellow}" yn
  205.     case $yn in
  206.         [Yy]* ) INSTALL_NGINX="yes"; nginxmenu; break;;
  207.         [Nn]* ) INSTALL_NGINX="no"; break;;
  208.         * ) echo "${Blue} Please enter yes or no. ${Yellow}";;
  209.     esac
  210. done
  211. if [ $INSTALL_NGINX == "yes" ]; then
  212.  while true; do
  213.     read -p "${Blue} Do you use Let's Encrypt to create a Valid SSL Certificate?: ${Yellow}" yn
  214.     case $yn in
  215.         [Yy]* ) LETSENCRYPT_CERT="yes"; letsencrypt; break;;
  216.         [Nn]* ) LETSENCRYPT_CERT="no"; break;;
  217.         * ) echo "${Blue} Please enter yes or no. ${Yellow}";;
  218.     esac
  219.  done
  220. fi
  221. tput sgr0
  222. }
  223.  
  224. letsencrypt ()
  225. {
  226. certype="Let's Encrypt"
  227. while true; do
  228.   echo -n "${Blue} Enter a valid e-mail for let's encrypt certificate: ${Yellow}"
  229.     read EMAIL_NAME
  230.   if [[ $EMAIL_NAME =~ $regex_mail ]] ; then
  231.     break
  232.   else
  233.     echo "${Blue} Please enter a correct e-mail address. ${Yellow}"
  234.   fi
  235. done
  236.  
  237. while true; do
  238.   echo -n "${Blue} Enter a valid domain for let's encrypt certificate (ex. gucamole.company.com): ${Yellow}"
  239.     read DOMAIN_NAME
  240.   if echo $DOMAIN_NAME | grep -P $regex_idn > /dev/null; then
  241.     echo "${Green}   Remember that Let's Encrypt only support DNS-based validation."
  242.     break
  243.   else
  244.     echo "${Blue} Please enter a correct domain name. ${Yellow}"
  245. fi
  246. done
  247. }
  248.  
  249. nginxmenu ()
  250. {
  251. certype="Self-Signed"
  252. echo -n "${Blue} Enter the Guacamole Server IP addres or hostame (default localhost): ${Yellow}"
  253.   read GUACASERVER_HOSTNAME
  254.   GUACASERVER_HOSTNAME=${GUACASERVER_HOSTNAME:-localhost}
  255. echo -n "${Blue} Enter the URI path (default guacamole): ${Yellow}"
  256.   read GUACAMOLE_URIPATH
  257.   GUACAMOLE_URIPATH=${GUACAMOLE_URIPATH:-guacamole}
  258. }
  259.  
  260.  
  261. progressfilt () {
  262.     local flag=false c count cr=$'\r' nl=$'\n'
  263.     while IFS='' read -d '' -rn 1 c
  264.     do
  265.         if $flag
  266.         then
  267.             printf '%c' "$c"
  268.         else
  269.             if [[ $c != $cr && $c != $nl ]]
  270.             then
  271.                 count=0
  272.             else
  273.                 ((count++))
  274.                 if ((count > 1))
  275.                 then
  276.                     flag=true
  277.                 fi
  278.             fi
  279.         fi
  280.     done
  281. }
  282.  
  283.  
  284.  
  285.  
  286. reposinstall () {
  287. echo -e "\nChecking CentOS version...\n...CentOS $CENTOS_VER found\n"; echo -e "\nChecking CentOS version...\n...CentOS $CENTOS_VER found\n" >> $logfile  2>&1
  288. echo -e "\nStarting...\n...Preparing ingredients\n"; echo -e "\nStarting...\n...Preparing ingredients\n" >> $logfile  2>&1
  289. sleep 1 | echo -e "\nSearching for EPEL Repository...";echo -e "\nSearching for EPEL Repository..." >> $logfile  2>&1
  290. rpm -qa | grep epel-release | tee -a $logfile
  291. RETVAL=${PIPESTATUS[1]}
  292. if [ $RETVAL -eq 0 ]; then
  293.     sleep 1 | echo -e "No need to install EPEL repository!"; echo -e "No need to install EPEL repository!" >> $logfile  2>&1
  294. else
  295.     sleep 1 | echo -e "\nIs necessary to install the EPEL repositories\nInstalling..."; echo -e "\nIs necessary to install the EPEL repositories\nInstalling..." >> $logfile  2>&1
  296.     rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-${CENTOS_VER}.noarch.rpm | tee -a $logfile || exit 1
  297. fi
  298.  
  299. sleep 1 | echo -e "\nSearching for RPMFusion Repository...";echo -e "\nSearching for RPMFusion Repository..." >> $logfile  2>&1
  300. rpm -qa | grep rpmfusion | tee -a $logfile
  301. RETVAL=${PIPESTATUS[1]}
  302. if [ $RETVAL -eq 0 ]; then
  303.     sleep 1 | echo -e "No need to install RPMFusion repository!"; echo -e "No need to install RPMFusion repository!" >> $logfile  2>&1
  304. else
  305.     sleep 1 | echo -e "\nIs necessary to install the RPMFusion repositories\nInstalling..."; echo -e "\nIs necessary to install the RPMFusion repositories\nInstalling..." >> $logfile  2>&1
  306.     rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-${CENTOS_VER}.noarch.rpm | tee -a $logfile || exit 1
  307. fi
  308. }
  309.  
  310.  
  311. yumupdate () {
  312. sleep 1 | echo -e "\nUpdating CentOS...\n"; echo -e "\nUpdating CentOS...\n" >> $logfile  2>&1
  313. yum update -y | tee -a $logfile
  314. }
  315.  
  316. guacamoleinstall () {
  317. sleep 1 | echo -e "\nInstalling Dependencies..."; echo -e "\nInstalling Dependencies..." >> $logfile  2>&1
  318.  
  319. rpm -qa | grep libjpeg-turbo-official-${LIBJPEG_VER} | tee -a $logfile
  320. RETVAL=${PIPESTATUS[1]} ; echo -e "rpm -qa | grep libjpeg-turbo-official-${LIBJPEG_VER} RC is: $RETVAL" >> $logfile  2>&1
  321.  
  322. if [ $RETVAL -eq 0 ]; then
  323.     sleep 1 | echo -e "...libjpeg-turbo-official-${LIBJPEG_VER} is installed on the system\n"; echo -e "...libjpeg-turbo-official-${LIBJPEG_VER} is installed on the system\n" >> $logfile  2>&1
  324. else
  325.     sleep 1 | echo -e "...libjpeg-turbo-official-${LIBJPEG_VER} is not installed on the system\n"; echo -e "...libjpeg-turbo-official-${LIBJPEG_VER} is not installed on the system\n" >> $logfile  2>&1
  326.     yum localinstall -y ${LIBJPEG_URL}${LIBJPEG_TURBO}.${MACHINE_ARCH}.rpm | tee -a $logfile
  327.     RETVAL=${PIPESTATUS[0]} ; echo -e "yum localinstall -y ${LIBJPEG_URL}${LIBJPEG_TURBO}.${MACHINE_ARCH}.rpm RC is: $RETVAL" >> $logfile  2>&1
  328.     ln -vfs /opt/libjpeg-turbo/include/* /usr/include/ | tee -a $logfile || exit 1
  329.     ln -vfs /opt/libjpeg-turbo/lib??/* /usr/lib${ARCH}/ | tee -a $logfile
  330. fi
  331.  
  332. rpm -qa | grep ffmpeg-devel | tee -a $logfile
  333. RETVAL=${PIPESTATUS[1]} ; echo -e "rpm -qa | grep ffmpeg-devel RC is: $RETVAL" >> $logfile  2>&1
  334. if [ $RETVAL -eq 0 ]; then
  335.     sleep 1 | echo -e "...ffmpeg-devel is installed on the system\n"; echo -e "...ffmpeg-devel is installed on the system\n" >> $logfile  2>&1
  336. else
  337.     sleep 1 | echo -e "...ffmpeg-devel is not installed on the system\n"; echo -e "...ffmpeg-devel is not installed on the system\n" >> $logfile  2>&1
  338.     yum install -y ffmpeg-devel | tee -a $logfile
  339.     RETVAL=${PIPESTATUS[0]} ; echo -e "yum install -y ffmpeg-devel RC is: $RETVAL" >> $logfile  2>&1
  340. fi
  341.  
  342. yum install -y wget pv dialog gcc cairo-devel libpng-devel uuid-devel ffmpeg-devel freerdp-devel freerdp-plugins pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel tomcat gnu-free-mono-fonts ${MySQL_Packages} | tee -a $logfile
  343. RETVAL=${PIPESTATUS[0]} ; echo -e "yum install RC is: $RETVAL" >> $logfile  2>&1
  344.  
  345. sleep 1 | echo -e "\nCreating Directories...\n" | pv -qL 25; echo -e "\nCreating Directories...\n" >> $logfile  2>&1
  346. rm -fr ${INSTALL_DIR} | tee -a $logfile
  347. mkdir -v /etc/guacamole >> $logfile  2>&1
  348. mkdir -vp ${INSTALL_DIR}{client,selinux} >> $logfile 2>&1 && cd ${INSTALL_DIR}
  349. mkdir -vp ${LIB_DIR}{extensions,lib} >> $logfile  2>&1
  350. mkdir -v /usr/share/tomcat/.guacamole/ >> $logfile  2>&1
  351.  
  352. sleep 1 | echo -e "\nDownloading Guacamole packages for installation...\n" | pv -qL 25; echo -e "\nDownloading Guacamole packages for installation...\n" >> $logfile  2>&1
  353. wget --progress=bar:force ${GUACA_URL}source/${GUACA_SERVER}.tar.gz 2>&1 | progressfilt
  354. #wget --progress=bar:force ${GUACA_URL}source/${GUACA_CLIENT}.tar.gz 2>&1 | progressfilt
  355. wget --progress=bar:force ${GUACA_URL}binary/${GUACA_CLIENT}.war -O ${INSTALL_DIR}client/guacamole.war 2>&1 | progressfilt
  356. wget --progress=bar:force ${GUACA_URL}extensions/${GUACA_JDBC}.tar.gz 2>&1 | progressfilt
  357. wget --progress=bar:force ${MYSQ_CONNECTOR_URL}${MYSQL_CONNECTOR}.tar.gz 2>&1 | progressfilt
  358.  
  359. sleep 1 | echo -e "\nDerompessing Guacamole Server Source...\n" | pv -qL 25; echo -e "\nDerompessing Guacamole Server Source...\n" >> $logfile  2>&1
  360. pv ${GUACA_SERVER}.tar.gz | tar xzf - | tee -a $logfile && rm -f ${GUACA_SERVER}.tar.gz | tee -a $logfile
  361. mv ${GUACA_SERVER} server | tee -a $logfile
  362.  
  363. #sleep 1 | echo -e "\nDerompessing Guacamole Client...\n" | pv -qL 25
  364. #pv ${GUACA_CLIENT}.tar.gz | tar xzf - | tee -a $logfile && rm -f ${GUACA_CLIENT}.tar.gz | tee -a $logfile
  365. #mv ${GUACA_CLIENT} client | tee -a $logfile
  366.  
  367. sleep 1 | echo -e "\nDecrompressing Guacamole JDBC Extension...\n" | pv -qL 25; echo -e "\nDecrompressing Guacamole JDBC Extension...\n" >> $logfile  2>&1
  368. pv ${GUACA_JDBC}.tar.gz | tar xzf - | tee -a $logfile && rm -f ${GUACA_JDBC}.tar.gz | tee -a $logfile
  369. mv ${GUACA_JDBC} extension | tee -a $logfile
  370.  
  371. sleep 1 | echo -e "\nDecompressing MySQL Connector...\n" | pv -qL 25; echo -e "\nDecompressing MySQL Connector...\n" >> $logfile  2>&1
  372. pv ${MYSQL_CONNECTOR}.tar.gz | tar xzf - | tee -a $logfile && rm -f ${MYSQL_CONNECTOR}.tar.gz | tee -a $logfile
  373.  
  374. sleep 1 | echo -e "\nCompiling Gucamole Server...\n" | pv -qL 25; echo -e "\nCompiling Gucamole Server...\n" >> $logfile  2>&1
  375. cd server
  376. ./configure --with-init-dir=/etc/init.d | tee -a $logfile
  377. make | tee -a $logfile
  378. sleep 1 && make install | tee -a $logfile
  379. sleep 1 && ldconfig | tee -a $logfile
  380. cd ..
  381.  
  382. # sleep 1 | echo -e "\nCompiling Gucamole Client...\n" | pv -qL 25
  383. # cd client
  384. # mvn package
  385. # cp guacamole/doc/example/guacamole.properties /etc/guacamole/
  386. # cp guacamole/doc/example/user-mapping.xml /etc/guacamole/
  387.  
  388. sleep 1 | echo -e "\nCopying Gucamole Client...\n" | pv -qL 25; echo -e "\nCopying Gucamole Client...\n" >> $logfile  2>&1
  389. cp -v client/guacamole.war ${LIB_DIR}guacamole.war | tee -a $logfile
  390. #cp -v client/guacamole.war /var/lib/tomcat/webapps/guacamole.war | tee -a $logfile
  391.  
  392. sleep 1 | echo -e "\nMaking Guacamole configurtion files...\n" | pv -qL 25; echo -e "\nMaking Guacamole configurtion files...\n" >> $logfile  2>&1
  393. echo "# Hostname and port of guacamole proxy
  394. guacd-hostname: ${SERVER_HOSTNAME}
  395. guacd-port:     ${GUACA_PORT}
  396.  
  397. # MySQL properties
  398. mysql-hostname: ${SERVER_HOSTNAME}
  399. mysql-port: ${MYSQL_PORT}
  400. mysql-database: ${DB_NAME}
  401. mysql-username: ${DB_USER}
  402. mysql-password: ${DB_PASSWD}
  403. mysql-default-max-connections-per-user: 0
  404. mysql-default-max-group-connections-per-user: 0" > /etc/guacamole/${GUACA_CONF}
  405.  
  406. sleep 1 | echo -e "\nMaking Guacamole simbolic links...\n" | pv -qL 25; echo -e "\nMaking Guacamole simbolic links...\n" >> $logfile  2>&1
  407. ln -vfs ${LIB_DIR}guacamole.war /var/lib/tomcat/webapps | tee -a $logfile || exit 1
  408. ln -vfs /etc/guacamole/${GUACA_CONF} /usr/share/tomcat/.guacamole/ | tee -a $logfile || exit 1
  409. ln -vfs ${LIB_DIR}lib/ /usr/share/tomcat/.guacamole/ | tee -a $logfile || exit 1
  410. ln -vfs ${LIB_DIR}extensions/ /usr/share/tomcat/.guacamole/ | tee -a $logfile || exit 1
  411. ln -vfs /usr/local/lib/freerdp/guac* /usr/lib${ARCH}/freerdp | tee -a $logfile || exit 1
  412.  
  413. sleep 1 | echo -e "\nCopying Guacamole JDBC Extension to Extensions Dir...\n" | pv -qL 25; echo -e "\nCopying Guacamole JDBC Extension to Extensions Dir...\n" >> $logfile  2>&1
  414. cp -v extension/mysql/guacamole-auth-jdbc-mysql-${GUACA_VER}.jar ${LIB_DIR}extensions/ | tee -a $logfile || exit 1
  415.  
  416. sleep 1 | echo -e "\nCopying MySQL Connector to Lib Dir...\n" | pv -qL 25; echo -e "\nCopying MySQL Connector to Lib Dir...\n" >> $logfile  2>&1
  417. cp -v mysql-connector-java-${MYSQL_CONNECTOR_VER}/mysql-connector-java-${MYSQL_CONNECTOR_VER}-bin.jar ${LIB_DIR}/lib/ | tee -a $logfile || exit 1
  418.  
  419. if [ $CENTOS_VER -ge 7 ]; then
  420.     sleep 1 | echo -e "\nSetting MariaDB Service...\n" | pv -qL 25; echo -e "\nSetting MariaDB Service...\n" >> $logfile  2>&1
  421.     systemctl enable mariadb.service | tee -a $logfile
  422.     systemctl restart mariadb.service | tee -a $logfile
  423.     sleep 1 | echo -e "\nSetting Root Password for MariaDB...\n" | pv -qL 25; echo -e "\nSetting Root Password for MariaDB...\n" >> $logfile  2>&1
  424. else
  425.     sleep 1 | echo -e "\nSetting MySQL Service...\n" | pv -qL 25; echo -e "\nSetting MySQL Service...\n" >> $logfile  2>&1
  426.     chkconfig mysqld on | tee -a $logfile
  427.     service mysqld start | tee -a $logfile
  428.     sleep 1 | echo -e "\nSetting Root Password for MySQL...\n" | pv -qL 25; echo -e "\nSetting Root Password for MySQL...\n" >> $logfile  2>&1
  429. fi
  430.  
  431. mysqladmin -u root password ${MYSQL_PASSWD} | tee -a $logfile || exit 1
  432.  
  433. sleep 1 | echo -e "\nCreating BD & User for Guacamole...\n" | pv -qL 25; echo -e "\nCreating BD & User for Guacamole...\n" >> $logfile  2>&1
  434. mysql -u root -p${MYSQL_PASSWD} -e "CREATE DATABASE ${DB_NAME};" | tee -a $logfile || exit 1
  435. mysql -u root -p${MYSQL_PASSWD} -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DB_NAME}.* TO '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASSWD}';" | tee -a $logfile || exit 1
  436. mysql -u root -p${MYSQL_PASSWD} -e "FLUSH PRIVILEGES;" | tee -a $logfile || exit 1
  437.  
  438. sleep 1 | echo -e "\nCreating Guacamole Tables...\n" | pv -qL 25; echo -e "\nCreating Guacamole Tables...\n" >> $logfile  2>&1
  439. cat extension/mysql/schema/*.sql | mysql -u root -p${MYSQL_PASSWD} -D ${DB_NAME} | tee -a $logfile
  440.  
  441. sleep 1 | echo -e "\nSetting Tomcat Server...\n" | pv -qL 25; echo -e "\nSetting Tomcat Server...\n" >> $logfile  2>&1
  442. sed -i '72i URIEncoding="UTF-8"' /etc/tomcat/server.xml
  443. sed -i '92i <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" \
  444.                maxThreads="150" scheme="https" secure="true" \
  445.                clientAuth="false" sslProtocol="TLS" \
  446.                keystoreFile="/var/lib/tomcat/webapps/.keystore" \
  447.                keystorePass="JKSTORE_PASSWD" \
  448.                URIEncoding="UTF-8" />' /etc/tomcat/server.xml
  449. sed -i "s/JKSTORE_PASSWD/${JKSTORE_PASSWD}/g" /etc/tomcat/server.xml
  450.  
  451. if [ $INSTALL_MODE = "silent" ]; then
  452.     sleep 1 | echo -e "\nGenerating the Java KeyStore\n" | pv -qL 25; echo -e "\nGenerating the Java KeyStore\n" >> $logfile  2>&1
  453.     noprompt="-noprompt -dname CN=,OU=,O=,L=,S=,C="
  454. else
  455.     sleep 1 | echo -e "\nPlease complete the Wizard for the Java KeyStore\n" | pv -qL 25; echo -e "\nPlease complete the Wizard for the Java KeyStore\n" >> $logfile  2>&1
  456. fi
  457. keytool -genkey -alias Guacamole -keyalg RSA -keystore /var/lib/tomcat/webapps/.keystore -storepass ${JKSTORE_PASSWD} -keypass ${JKSTORE_PASSWD} ${noprompt} | tee -a $logfile
  458.  
  459. sleep 1 | echo -e "\nSetting Tomcat and Guacamole Service...\n" | pv -qL 25; echo -e "\nSetting Tomcat and Guacamole Service...\n" >> $logfile  2>&1
  460.  
  461. if [ $CENTOS_VER -ge 7 ]; then
  462.     systemctl enable tomcat.service >> $logfile  2>&1
  463.     systemctl start tomcat.service >> $logfile  2>&1
  464.     chkconfig guacd on >> $logfile  2>&1
  465.     systemctl start guacd.service >> $logfile  2>&1
  466. else
  467.     chkconfig tomcat on
  468.     service tomcat start >> $logfile  2>&1
  469.     chkconfig guacd on >> $logfile  2>&1
  470.     service guacd start >> $logfile  2>&1
  471. fi
  472. }
  473.  
  474. selinuxchanges () {
  475. sleep 1 | echo -e "\nDisabling SELinux...\n" | pv -qL 25; echo -e "\nDisabling SELinux...\n" >> $logfile  2>&1
  476. sed -i 's/enforcing/disabled/g' /etc/selinux/config pv | tee -a $logfile
  477. setenforce 0
  478. sestatus >> $logfile 2>&1
  479. }
  480.  
  481. nginxinstall ()
  482. {
  483. sleep 1 | echo -e "\nInstalling Nginx repository..."; echo -e "\nInstalling Nginx repository..." >> $logfile  2>&1
  484. echo '[nginx]
  485. name=nginx repo
  486. baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
  487. gpgcheck=0
  488. enabled=1' > /etc/yum.repos.d/nginx.repo
  489.  
  490. sleep 1 | echo -e "\nInstalling Nginx..."; echo -e "\nInstalling Nginx..." >> $logfile  2>&1
  491. yum install -y nginx pv | tee -a $logfile
  492. RETVAL=${PIPESTATUS[0]} ; echo -e "yum install RC is: $RETVAL" >> $logfile  2>&1
  493.  
  494. sleep 1 | echo -e "\nMaking Nginx Backup\nmv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.ori.bkp" | pv -qL 25; echo -e "\nMaking Nginx Backup\nmv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.ori.bkp" >> $logfile  2>&1
  495. mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.ori.bkp | tee -a $logfile
  496. sleep 1 | echo -e "\nMaking Nginx configurations..." | pv -qL 25; echo -e "\nMaking Nginx configurations..." >> $logfile  2>&1
  497. echo 'server {
  498.     listen 80;
  499.     server_name localhost;
  500.  
  501.     location /_new-path_/ {
  502.         proxy_pass http://_SERVER_HOSTNAME_:8080/guacamole/;
  503.         proxy_buffering off;
  504.         proxy_http_version 1.1;
  505.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  506.         proxy_set_header Upgrade $http_upgrade;
  507.         proxy_set_header Connection $http_connection;
  508.         proxy_cookie_path /guacamole/ /_new-path_/;
  509.         access_log off;
  510.     }
  511. }' > /etc/nginx/conf.d/guacamole.conf
  512. sed -i "s/_SERVER_HOSTNAME_/${GUACASERVER_HOSTNAME}/g" /etc/nginx/conf.d/guacamole.conf
  513. sed -i "s/_new-path_/${GUACAMOLE_URIPATH}/g" /etc/nginx/conf.d/guacamole.conf
  514.  
  515. echo 'server {
  516.     listen              443 ssl http2;
  517.     server_name         localhost;
  518.     ssl_certificate     guacamole.crt;
  519.     ssl_certificate_key guacamole.key;
  520.     ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
  521.     ssl_ciphers         HIGH:!aNULL:!MD5;
  522.  
  523.     location /_new-path_/ {
  524.         proxy_pass http://_SERVER_HOSTNAME_:8080/guacamole/;
  525.         proxy_buffering off;
  526.         proxy_http_version 1.1;
  527.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  528.         proxy_set_header Upgrade $http_upgrade;
  529.         proxy_set_header Connection $http_connection;
  530.         proxy_cookie_path /guacamole/ /_new-path_/;
  531.         access_log off;
  532.     }
  533. }' > /etc/nginx/conf.d/guacamole_ssl.conf
  534. sed -i "s/_SERVER_HOSTNAME_/${GUACASERVER_HOSTNAME}/g" /etc/nginx/conf.d/guacamole_ssl.conf
  535. sed -i "s/_new-path_/${GUACAMOLE_URIPATH}/g" /etc/nginx/conf.d/guacamole_ssl.conf
  536.  
  537.  
  538.  
  539.  
  540. if [ $LETSENCRYPT_CERT = "yes" ]; then
  541.     sleep 1 | echo -e "\nDownloading certboot tool...\n" | pv -qL 25; echo -e "\nDownloading certboot tool...\n" >> $logfile  2>&1
  542.     wget -q https://dl.eff.org/certbot-auto -O /usr/bin/certbot-auto | tee -a $logfile
  543.     sleep 1 | echo -e "\nChanging permissions to certboot...\n" | pv -qL 25; echo -e "\nChanging permissions to certboot...\n" >> $logfile  2>&1
  544.     chmod a+x /usr/bin/certbot-auto | tee -a $logfile
  545.     sleep 1 | echo -e "\nGenerating a ${certype} SSL Certificate...\n" | pv -qL 25; echo -e "\nGenerating a ${certype} SSL Certificate...\n" >> $logfile  2>&1
  546.     certbot-auto certonly -n --agree-tos --standalone --standalone-supported-challenges tls-sni-01 -m "${EMAIL_NAME}" -d "${DOMAIN_NAME}" | tee -a $logfile
  547.     ln -vs "/etc/letsencrypt/live/${DOMAIN_NAME}/fullchain.pem" /etc/nginx/guacamole.crt || true | tee -a $logfile
  548.     ln -vs "/etc/letsencrypt/live/${DOMAIN_NAME}/privkey.pem" /etc/nginx/guacamole.key || true | tee -a $logfile
  549. else
  550.     if [ $INSTALL_MODE = "silent" ]; then
  551.         sleep 1 | echo -e "\nGenerating a ${certype} SSL Certificate...\n" | pv -qL 25; echo -e "\nGenerating a ${certype} SSL Certificate...\n" >> $logfile  2>&1
  552.         subj="-subj /C=XX/ST=/L=City/O=Company/CN=/"
  553.     else
  554.         sleep 1 | echo -e "\nPlease complete the Wizard for the ${certype} SSL Certificate...\n" | pv -qL 25; echo -e "\nPlease complete the Wizard for the ${certype} SSL Certificate...\n" >> $logfile  2>&1
  555.     fi
  556.     openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/guacamole.key -out /etc/nginx/guacamole.crt ${subj} | tee -a $logfile
  557. fi
  558.  
  559. sleep 1 | echo -e "\nStarting Nginx Service...\n" | pv -qL 25; echo -e "\nStarting Nginx Service...\n" >> $logfile  2>&1
  560. if [ $CENTOS_VER -ge 7 ]; then
  561.     systemctl enable nginx.service | tee -a $logfile || exit 1
  562.     systemctl start nginx.service | tee -a $logfile || exit 1
  563. else
  564.     chkconfig nginx on | tee -a $logfile
  565.     service nginx start | tee -a $logfile
  566. fi
  567.  
  568. sleep 1 | echo -e "${Bold}\nIf you need understand the Nginx configurations please go to:\n ${Green} http://nginx.org/en/docs/ ${Reset} ${Bold} \nIf you need replace the certificate file plese read first:\n ${Green} http://nginx.org/en/docs/http/configuring_https_servers.html ${Reset} \n"  | pv -qL 25; echo -e "${Bold}\nIf you need understand the Nginx configurations please go to:\n ${Green} http://nginx.org/en/docs/ ${Reset} ${Bold} \nIf you need replace the certificate file plese read first:\n ${Green} http://nginx.org/en/docs/http/configuring_https_servers.html ${Reset} \n" >> $logfile  2>&1
  569.  
  570. selinuxchanges
  571. }
  572.  
  573.  
  574. firewallD () {
  575.     echo -e "\nMaking Firewall Backup...\ncp /etc/firewalld/zones/public.xml $fwbkpfile" >> $logfile  2>&1
  576.     cp /etc/firewalld/zones/public.xml $fwbkpfile | tee -a $logfile
  577.     if [ $INSTALL_NGINX = "yes" ]; then
  578.         sleep 1 | echo -e "...Opening ports 80 and 443\n" | pv -qL 25; echo -e "...Opening ports 80 and 443\n" >> $logfile  2>&1
  579.         echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-service=http" >> $logfile  2>&1
  580.         firewall-cmd --permanent --zone=public --add-service=http >> $logfile  2>&1
  581.         echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-service=https" >> $logfile  2>&1
  582.         firewall-cmd --permanent --zone=public --add-service=https >> $logfile  2>&1
  583.     fi
  584.     if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ]; then
  585.     sleep 1 | echo -e "...Opening ports 8080 and 8443\n" | pv -qL 25; echo -e "...Opening ports 8080 and 8443\n" >> $logfile  2>&1
  586.         echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-port=8080/tcp" >> $logfile  2>&1
  587.         firewall-cmd --permanent --zone=public --add-port=8080/tcp >> $logfile  2>&1
  588.         echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-port=8443/tcp" >> $logfile  2>&1
  589.         firewall-cmd --permanent --zone=public --add-port=8443/tcp >> $logfile  2>&1
  590.         echo -e "Reload firewall...\nfirewall-cmd --reload\n" >> $logfile  2>&1
  591.     fi
  592.     firewall-cmd --reload >> $logfile  2>&1
  593. }
  594.  
  595. Iptables () {
  596.     echo -e "Making Firewall Backup...\niptables-save >> $fwbkpfile" >> $logfile  2>&1
  597.     iptables-save >> $fwbkpfile  2>&1
  598.     if [ $INSTALL_NGINX = "yes" ]; then
  599.         sleep 1 | echo -e "...Opening ports 80 and 443\n" | pv -qL 25; echo -e "...Opening ports 80 and 443\n" >> $logfile  2>&1
  600.         echo -e "Add new rule...\niptables -I INPUT -m tcp -p tcp --dport 80 -m state --state NEW -j ACCEPT" >> $logfile  2>&1
  601.         iptables -I INPUT -m tcp -p tcp --dport 80 -m state --state NEW -j ACCEPT >> $logfile  2>&1
  602.         echo -e "Add new rule...\niptables -I INPUT -m tcp -p tcp --dport 443 -m state --state NEW -j ACCEPT" >> $logfile  2>&1
  603.         iptables -I INPUT -m tcp -p tcp --dport 443 -m state --state NEW -j ACCEPT >> $logfile  2>&1
  604.     fi
  605.     if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ]; then
  606.         sleep 1 | echo -e "...Opening ports 8080 and 8443\n" | pv -qL 25; echo -e "...Opening ports 8080 and 8443\n" >> $logfile  2>&1
  607.         echo -e "Add new rule...\niptables -I INPUT -m tcp -p tcp --dport 8080 -m state --state NEW -j ACCEPT" >> $logfile  2>&1
  608.         iptables -I INPUT -m tcp -p tcp --dport 8080 -m state --state NEW -j ACCEPT >> $logfile  2>&1
  609.         echo -e "Add new rule...\niptables -I INPUT -m tcp -p tcp --dport 8443 -m state --state NEW -j ACCEPT" >> $logfile  2>&1
  610.         iptables -I INPUT -m tcp -p tcp --dport 8443 -m state --state NEW -j ACCEPT >> $logfile  2>&1
  611.     fi
  612.     echo -e "Save new rules\nservice iptables save\n" >> $logfile  2>&1
  613.     service iptables save >> $logfile  2>&1
  614. }
  615.  
  616. firewallsetting () {
  617. sleep 1 | echo -e "\nSetting Firewall...\n" | pv -qL 25; echo -e "\nSetting Firewall..." >> $logfile  2>&1
  618. echo -e "Take Firewall RC...\n" >> $logfile  2>&1
  619. echo -e "rpm -qa | grep firewalld" >> $logfile  2>&1
  620. rpm -qa | grep firewalld >> $logfile  2>&1
  621. RETVALqaf=$?
  622. echo -e "\nservice firewalld status" >> $logfile  2>&1
  623. service firewalld status >> $logfile  2>&1
  624. RETVALsf=$?
  625.  
  626. if [ $RETVALsf -eq 0 ]; then
  627.     sleep 1 | echo -e "...firewalld is installed and started on the system\n" | pv -qL 25; echo -e "...firewalld is installed and started on the system\n" >> $logfile  2>&1
  628.     firewallD
  629. elif [ $RETVALqaf -eq 0 ]; then
  630.     sleep 1 | echo -e "...firewalld is installed but not enabled or started on the system\n" | pv -qL 25; echo -e "...firewalld is installed but not enabled or started on the system\n" >> $logfile  2>&1
  631.     firewallD
  632. else
  633.     sleep 1 | echo -e "...firewalld is not installed on the system\n" | pv -qL 25; echo -e "...firewalld is not installed on the system\n" >> $logfile  2>&1
  634.     echo -e "Checking Firewall RC..." >> $logfile  2>&1
  635.     rpm -qa | grep iptables-services >> $logfile  2>&1
  636.     RETVALqai=$?
  637.     service iptables status >> $logfile  2>&1
  638.     RETVALsi=$?
  639.  
  640.     if [ $RETVALsi -eq 0 ]; then
  641.         sleep 1 | echo -e "...iptables service is installed and started on the system\n" | pv -qL 25; echo -e "...iptables service is installed and started on the system\n" >> $logfile  2>&1
  642.         Iptables
  643.     elif [ $RETVALqaf -eq 0 ]; then
  644.         sleep 1 | echo -e "...iptables is installed but not enabled or started on the system\n" | pv -qL 25; echo -e "...iptables is installed but not enabled or started on the system\n" >> $logfile  2>&1
  645.         Iptables
  646.     else
  647.             sleep 1 | echo -e "...iptables service is not installed on the system\n" | pv -qL 25; echo -e "...iptables service is not installed on the system\n" >> $logfile  2>&1
  648.             sleep 1 | echo -e "Please check and configure you firewall...\nIn order to Guacamole work properly open the ports tcp 8080 and 8443." | pv -qL 25; echo -e "Please check and configure you firewall...\nIn order to Guacamole work properly open the ports tcp 80, 443, 8080 and 8443." >> $logfile  2>&1
  649.     fi
  650. fi
  651. }
  652.  
  653.  
  654. showmessages () {
  655. sleep 1 | echo -e "\nFinished Successfully\n" | pv -qL 25; echo -e "\nFinished Successfully\n" >> $logfile  2>&1
  656. sleep 1 | echo -e "\nYou can check the log file ${logfile}\n" | pv -qL 25; echo -e "\nYou can check the log file ${logfile}\n" >> $logfile  2>&1
  657. sleep 1 | echo -e "\nYour firewall backup file ${fwbkpfile}\n" | pv -qL 25; echo -e "\nYour firewall backup file ${fwbkpfile}\n" >> $logfile  2>&1
  658. if [ $INSTALL_NGINX = "yes" ]; then
  659.     sleep 1 | echo -e "\nTo manage the Guacamole GW via proxy go to http://<IP>/${GUACAMOLE_URIPATH}/ or https://<IP>/${GUACAMOLE_URIPATH}/\n" | pv -qL 25; echo -e "\nTo manage the Guacamole GW via proxy go to http://<IP>/${GUACAMOLE_URIPATH}/ or https://<IP>/${GUACAMOLE_URIPATH}/\n" >> $logfile  2>&1
  660. fi
  661. if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ]; then
  662.     sleep 1 | echo -e "\nTo manage the Guacamole GW go to http://<IP>:8080/${GUACAMOLE_URIPATH}/ or https://<IP>:8443/${GUACAMOLE_URIPATH}/\n" | pv -qL 25; echo -e "\nTo manage the Guacamole GW go to http://<IP>:8080/${GUACAMOLE_URIPATH}/ or https://<IP>:8443/${GUACAMOLE_URIPATH}/\n" >> $logfile  2>&1
  663. sleep 1 | echo -e "\nThe username and password is: guacadmin\n" | pv -qL 25; echo -e "\nThe username and password is: guacadmin\n" >> $logfile  2>&1
  664. fi
  665. sleep 1 | echo -e "\nIf you have any suggestions please write to: correo@nacimientohernan.com.ar\n" | pv -qL 25; echo -e "\nIf you have any suggestions please write to: correo@nacimientohernan.com.ar\n" >> $logfile  2>&1
  666. }
  667.  
  668.  
  669. # Start
  670. if [[ $INSTALL_MODE = "interactive"  &&  $INSTALL_MODE != "silent" && $INSTALL_MODE != "proxy" ]] ; then menu; fi
  671. if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ] || [ $INSTALL_NGINX = "yes" ]; then reposinstall; fi
  672. if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ]; then yumupdate; fi
  673. if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ]; then guacamoleinstall; fi
  674. if [ $INSTALL_NGINX = "yes" ]; then nginxinstall; fi
  675. if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ] || [ $INSTALL_NGINX = "yes" ]; then firewallsetting; fi
  676. if [ $INSTALL_MODE = "interactive" ] || [ $INSTALL_MODE = "silent" ] || [ $INSTALL_NGINX = "yes" ]; then showmessages; fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top