Monday 4 April 2016

♣Installing Guacamole ( Web based HTML 5 Free RDP Client) from source♦



Installing Guacamole ( Web based HTML 5 RDP Client) from source

Guacamole is getting most popular nowdays since it can be integrated to any of the programming language to access the remote servers either over the RDP protocol or VNC protocol without proving users to login credentials. I see it’s a first initiate of such solution ie HTML5 Clientless Remote Desktop
Role of Guacomole
I see this tools will be useful those who is looking for RDP access to office from remote location without opening any port in firewall or not establishing VPN connection to access to server. he can access the RDP server immediately after the Guacamole login.
Pls keep in mind that opening Guacamole portal to public without SSL security is a RISK. So act wisely
Guacomole website provides binary distribution for Ubuntu and fedora. My initial attempts was with Ubuntu 12.04 LTS and 11. Really Sucks !! Both attempts were failed due to lack of dependencies and may crashed Ubuntu package integrity. So I plan to compile it from source.
Compiling Guacomole
I got it work on Amazon Linux AMI (32 bit) and CentOS 6 as well.
Package Requirements are
a. libguac-0.7.0.tar.gz
b. guacd-0.6.2.tar.gz
c. libguac-client-rdp-0.7.1.tar.gz [ I skipped this option since I uses only RDP support]
d. libguac-client-rdp-0.7.0.tar.gz
e. guacamole-0.7.0.tar.gz
f. apache-maven-3.0.4-bin.tar.gz
g. YUM package support for freerdp,libvncserver [optional],cairo-devel, automake,libtool,gcc++
h. You may need to install repository support for RpmForge and EPEL repository.

Let’s start,
Download and install Rpmforge repository from http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
[root@rc-136 guacomole]#wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
[root@rc-136 guacomole]#rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
[root@rc-136 guacomole]#yum clean all
Now we need to edit /etc/yum.repos.d/epel.repo and make enabled =1 for the first selection “Extra Packages for Enterprise Linux 6″ to install freerdp package.
########### installing dependencies ############
[root@rc-136 guacomole]#yum install libng* freerdp freerdp-devel cairo-devel gcc* gcc++ make automake libtool
[root@rc-136 guacomole]#cd /home/installation/guacomole
#### Installing  libguac  #######
[root@rc-136 guacomole]# tar -xzf libguac-0.7.0.tar.gz
[root@rc-136 guacomole]# cd libguac-0.7.0/
[root@rc-136 guacomole]#  ./configure
[root@rc-136 guacomole]#  make
[root@rc-136 guacomole]#  make install
[root@rc-136 guacomole]#  ldconfig
[root@rc-136 guacomole]#  cd ..
#### Installing  guacd reverse proxy daemon #######
[root@rc-136 guacomole]# tar -xzf guacd-0.7.0.tar.gz
[root@rc-136 guacomole]# cd guacd-0.7.0/
[root@rc-136 guacomole]# ./configure –with-init-dir=/etc/init.d
[root@rc-136 guacomole]# echo “/usr/local/lib” >> /etc/ld.so.conf && ldconfig
[root@rc-136 guacomole]# make
[root@rc-136 guacomole]# make install
#### Installing  RDP support #######
[root@rc-136 guacomole]#  cd ..
[root@rc-136 guacomole]#tar -xzf libguac-client-rdp-0.7.1.tar.gz
[root@rc-136 guacomole]# cd libguac-client-rdp-0.7.1/
[root@rc-136 guacomole]# ./configure
[root@rc-136 guacomole]# make
[root@rc-136 guacomole]# make install
[root@rc-136 guacomole]# ldconfig #### Installing apache-maven package installer #######
[root@rc-136 guacomole]# wget http://www.eng.lsu.edu/mirrors/apache//maven/binaries/apache-maven-2.0.11-bin.tar.gz
[root@rc-136 guacomole]#cp -r apache-maven-2.0.11-bin /usr/local/maven
[root@rc-136 guacomole]#M2_HOME=/usr/local/maven/;export M2_HOME
[root@rc-136 guacomole]#PATH=$PATH:/usr/local/maven/bin;export PATH
#### Installing apache tomcat6 installer #######
[root@rc-136 guacomole]##yum install tomcat6
# webapps directory will in “/var/lib/tomcat6/”
#### Installing Installing Guacamole  building from source #######
[root@rc-136 guacomole]# tar -xzf guacamole-0.6.1.tar.gz
[root@rc-136 guacomole]# cd guacamole-0.6.1/
[root@rc-136 guacomole]# mvn package
[root@rc-136 guacomole]# cp target/guacamole-0.7.0.war  /var/lib/tomcat6/webapps/guacamole.war
[root@rc-136 guacomole]#mkdir /etc/guacamole
[root@rc-136 guacomole]#cp doc/example/guacamole.properties /etc/guacamole/guacamole.properties
[root@rc-136 guacomole]#ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat6/lib/
Now we need to create a guacamole config. file. This will manage all the settings inside the application. Here is one sample file for /etc/guacamole/user-mapping.xml
Create a file (/etc/guacamole/user-mapping.xml) having the following content.
<user-mapping>
<authorize username=”admin” password=”admin”>
<!– First authorized connection –>
<connection name=”VNC_Server_46″>
<protocol>vnc</protocol>
<param name=”hostname”>192.168.0.46</param>
<param name=”port”>5901</param>
<param name=”rain”>pass</param>
</connection>
<connection name=”Windows7_Server”>
<protocol>rdp</protocol>
<param name=”hostname”>192.168.0.71</param>
<param name=”port”>3389</param>
<param name=”username”>user1</param>
<param name=”password”>pass</param>
<param name=”color-depth”>32</param><!– 8,16,24 or 32 –>
<param name=”width”>1280</param>
<param name=”height”>720</param>
</connection>
<connection name=”WindowsXP_61″>
<protocol>rdp</protocol>
<param name=”hostname”>192.168.0.61</param>
<param name=”port”>3389</param>
<param name=”username”>user1</param>
<param name=”password”>pass</param>
<param name=”color-depth”>32</param><!– 8,16,24 or 32 –>
<param name=”width”>1280</param>
<param name=”height”>720</param>
</connection>
</authorize>
</user-mapping>
Now we are going to restart all the services required for this platform.
a. Starting guacd reverse proxy daemon
[root@rc-136 guacamole]# /etc/init.d/guacd start
Starting guacd: guacd[17267]: INFO:  Guacamole proxy daemon (guacd) version 0.7.0
guacd[17267]: INFO:  Successfully bound socket to host ::1, port 4822
guacd[17267]: INFO:  Exiting and passing control to PID 17268
SUCCESS
guacd[17268]: INFO:  Exiting and passing control to PID 17269
[root@rc-136 guacamole]#
[root@rc-136 guacamole]# netstat -nlp | grep “4822”
tcp        0      0 0.0.0.0:4822                0.0.0.0:*                   LISTEN      17269/guacd
[root@rc-136 guacamole]#
Pls note I see some cases, we used to get “server error” when guacd started automatically through startup script. So we need to run it manually after booting.
b. Starting Tomcat service and Guacamole Application.
Pls note that we already had copied guacamole.war inside tomcat webapps (/var/lib/tomcat6/webapps)
[root@rc-136 guacamole]# service tomcat6 start
Starting tomcat6:                                          [  OK  ]
[root@rc-136 guacamole]# netstat -nlp | grep “8080”
tcp        0      0 :::8080                     :::*                        LISTEN      9403/java
[root@rc-136 guacamole]#
c. Setting Guacamole app as proxy application to outside the world in clean url.
Pls note that I did not use any SSL security here. We need to install Apache and edit the config. file. I expect proxy module is already enabled in Apache install.
Edit /etc/httpd/conf/httpd.conf and add the following lines
<Location /guacamole/>
Order allow,deny
Allow from all
ProxyPass ajp://localhost:8009/guacamole/ max=20 flushpackets=on
ProxyPassReverse ajp://localhost:8009/guacamole/
</Location>
Then restart Apache
[root@rc-136 guacamole]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@rc-136 guacamole]#
Now you can access Guacamole over either http://localhost/guacamole or http://localhost:8080/guacamole and configure it on any application you want to integrate.
You will get some issues if you plan to use Guacamole using tomcat url ( localhost:8080) This may lead to get Connection Closed” freequently. So better to configure it as proxy in Apache/or Ngnix using the option max=20 flushpackets=on
Here are some screens
Login form
User name and password will be “admin”

Landing Page

Connecting a Windows XP box from Guacamole

Connecting to Windows 7 Desktop

Multiple session screen

No comments:

Post a Comment

Dear Friend ♥