Skip to content

Instantly share code, notes, and snippets.

@borekon
Last active May 12, 2020 07:37
Show Gist options
  • Save borekon/e0c050f53972a551bbd7eb4efdb6cf58 to your computer and use it in GitHub Desktop.
Save borekon/e0c050f53972a551bbd7eb4efdb6cf58 to your computer and use it in GitHub Desktop.
Script from s4aur0n to install guacaVPN
#!/bin/bash
## Guacamole v1.1.0 (Debian Burst)
# CS3 Group by Pedro C. aka s4ur0n
# @NN2ed_s4ur0n
# info@cs3group.com
#
#
# Favorite tools
#
#clear
echo "Installing Favorite Tools..."
apt -y install vim net-tools bmon htop tcpdump traceroute hping3
#
# Guacamole Main Packages
#
#clear
echo "Installing Guacamole Main Packages..."
apt -y install maven default-jdk git libcairo2-dev libjpeg62-turbo-dev libwebsockets-dev libpng-dev libossp-uuid-dev gcc make dh-autoreconf tomcat9 tomcat9-admin tomcat9-user libavcodec-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev
#
# Guacamole Server
#
#clear
echo "Downloading latest Guacamole Server..."
cd /root
#
# From source package:
#
# wget https://downloads.apache.org/guacamole/1.1.0/source/guacamole-server-1.1.0.tar.gz
# tar -xzf guacamole-server-1.1.0.tar.gz
# cd guacamole-server-1.1.0/
#
git clone git://github.com/apache/guacamole-server.git
cd guacamole-server/
# Only for git version: (see https://guacamole.apache.org/doc/gug/installing-guacamole.html#building-guacamole-client)
autoreconf -fi
./configure --with-init-dir=/etc/init.d
make
make install
ldconfig
#
# Guacamole Client
#
#clear
echo "Downloading latest Guacamole Client..."
cd /root
#
#
# wget https://downloads.apache.org/guacamole/1.1.0/source/guacamole-client-1.1.0.tar.gz
# tar -xzf guacamole-client-1.1.0.tar.gz
# cd guacamole-client-1.1.0/
#
git clone git://github.com/apache/guacamole-client.git
cd guacamole-client
echo JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/" > /etc/environment
source /etc/environment
#clear
echo "You need to patch this files:"
grep -nrw . -e "maven-javadoc-plugin"
echo "Add <source>8</source> below <configuration> at the maven-javadoc-plugin"
echo " "
echo "Example:"
echo " <artifactId>maven-javadoc-plugin</artifactId>"
echo " <version>2.10.3</version>"
echo " <configuration>"
echo " <source>8</source>"
echo " ..."
read -n 1 -s -r -p "Press any key to continue..."
#clear
echo "Creating war package"
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/" mvn package
mkdir -p /var/lib/tomcat9/webapps
cd guacamole/target/
mv guacamole-1.2.0.war guacamole.war
cp guacamole.war /var/lib/tomcat9/webapps/
#
# Restart services
#
#clear
echo "Restarting services..."
service tomcat9 restart
/etc/init.d/guacd start
#
# Create config
#
#clear
echo "Creating Guacamole config..."
mkdir /etc/guacamole /usr/share/tomcat9/.guacamole
cd /etc/guacamole
echo "guacd-hostname: localhost
guacd-port: 4822
user-mapping: /etc/guacamole/user-mapping.xml
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml" > guacamole.properties
ln -s guacamole.properties /usr/share/tomcat9/.guacamole/
#
# Create service user
#
#clear
read -p "Define a user for administration panel: " guacauser
read -s -p "Define a user password: " guacapassword
read -p "Define an IP for the remote host:" ip
read -p "Define a remote user:" ruser
echo '<user-mapping>
<authorize username="'$guacauser' "password="'$guacapassword'">
<connection name="SSH"><protocol>ssh</protocol>
<param name="hostname">'$ip'</param>
<param name="port">22</param>
<param name="username">'$ruser'</param></connection></authorize></user-mapping>' > user-mapping.xml
chmod 600 user-mapping.xml
chown tomcat:tomcat user-mapping.xml
echo 'Remember add in authorize encoding="md5" and generate pass with printf "%s" "<password>" | md5sum'
#
# Restart main services
#
#clear
echo "Restarting main services"
# Restart all main services
service tomcat9 restart
/etc/init.d/guacd restart
echo "Connect to http://$ip:8080/guacamole with $guacauser and your password"
echo "See https://guacamole.apache.org/doc/gug/"
echo "See https://guacamole.apache.org/doc/gug/configuring-guacamole.html for user-mapping"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment