| Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
docpublic:systemes:remotelabsguacamole [2020/06/15 10:49] procacci@tem-tsp.eu [packages depandances] |
docpublic:systemes:remotelabsguacamole [2020/06/18 15:25] (current) procacci@tem-tsp.eu [packages repositories] |
| * https://www.byteprotips.com/?p=2391 | * https://www.byteprotips.com/?p=2391 |
| |
| | |
| | ==== environement ==== |
| | |
| | installation faite en centos 8 et tomcat 9 (tar.gz dans /opt/tomcat) |
| ==== packages repositories ==== | ==== packages repositories ==== |
| |
| <code> | <code> |
| [root@rlab ~]# dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm | [root@rlab ~]# dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm |
| [root@rlabw ~]# yum install dnf-plugins-core | [root@rlab ~]# yum install dnf-plugins-core |
| [root@rlabw ~]# dnf config-manager --enable PowerTools | [root@rlab ~]# dnf config-manager --enable PowerTools |
| </code> | </code> |
| |
| make[1] : on quitte le répertoire « /opt/guacamole-server-1.1.0 » | make[1] : on quitte le répertoire « /opt/guacamole-server-1.1.0 » |
| </code> | </code> |
| | |
| | ==== make install ==== |
| | |
| | <code> |
| | [root@rlab guacamole-server-1.1.0]# make install |
| | Making install in src/libguac |
| | make[1] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/libguac » |
| | Making install in . |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/libguac » |
| | make[3] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/libguac » |
| | /usr/bin/mkdir -p '/usr/local/lib' |
| | /bin/sh ../../libtool --mode=install /usr/bin/install -c libguac.la '/usr/local/lib' |
| | libtool: install: /usr/bin/install -c .libs/libguac.so.17.0.0 /usr/local/lib/libguac.so.17.0.0 |
| | libtool: install: (cd /usr/local/lib && { ln -s -f libguac.so.17.0.0 libguac.so.17 || { rm -f libguac.so.17 && ln -s libguac.so.17.0.0 libguac.so.17; }; }) |
| | libtool: install: (cd /usr/local/lib && { ln -s -f libguac.so.17.0.0 libguac.so || { rm -f libguac.so && ln -s libguac.so.17.0.0 libguac.so; }; }) |
| | libtool: install: /usr/bin/install -c .libs/libguac.lai /usr/local/lib/libguac.la |
| | libtool: install: /usr/bin/install -c .libs/libguac.a /usr/local/lib/libguac.a |
| | libtool: install: chmod 644 /usr/local/lib/libguac.a |
| | libtool: install: ranlib /usr/local/lib/libguac.a |
| | libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/local/lib |
| | ---------------------------------------------------------------------- |
| | Libraries have been installed in: |
| | /usr/local/lib |
| | If you ever happen to want to link against installed libraries |
| | in a given directory, LIBDIR, you must either use libtool, and |
| | specify the full pathname of the library, or use the '-LLIBDIR' |
| | flag during linking and do at least one of the following: |
| | - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable |
| | during execution |
| | - add LIBDIR to the 'LD_RUN_PATH' environment variable |
| | during linking |
| | - use the '-Wl,-rpath -Wl,LIBDIR' linker flag |
| | - have your system administrator add LIBDIR to '/etc/ld.so.conf' |
| | |
| | See any operating system documentation about shared libraries for |
| | more information, such as the ld(1) and ld.so(8) manual pages. |
| | ---------------------------------------------------------------------- |
| | /usr/bin/mkdir -p '/usr/local/include/guacamole' |
| | /usr/bin/install -c -m 644 guacamole/audio.h guacamole/audio-fntypes.h guacamole/audio-types.h guacamole/client-constants.h guacamole/client.h guacamole/client-fntypes.h guacamole/client-types.h guacamole/error.h guacamole/error-types.h guacamole/hash.h guacamole/layer.h guacamole/layer-types.h guacamole/object.h guacamole/object-types.h guacamole/parser-constants.h guacamole/parser.h guacamole/parser-types.h guacamole/plugin-constants.h guacamole/plugin.h guacamole/pool.h guacamole/pool-types.h guacamole/protocol.h guacamole/protocol-constants.h guacamole/protocol-types.h guacamole/socket-constants.h guacamole/socket.h guacamole/socket-fntypes.h guacamole/socket-types.h guacamole/stream.h guacamole/stream-types.h guacamole/string.h guacamole/timestamp.h guacamole/timestamp-types.h guacamole/unicode.h guacamole/user.h guacamole/user-constants.h guacamole/user-fntypes.h guacamole/user-types.h guacamole/socket-ssl.h '/usr/local/include/guacamole' |
| | make[3] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/libguac » |
| | make[2] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/libguac » |
| | ... |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/protocols/kubernetes » |
| | /usr/bin/mkdir -p '/usr/local/lib' |
| | /bin/sh ../../../libtool --mode=install /usr/bin/install -c libguac-client-kubernetes.la '/usr/local/lib' |
| | libtool: warning: relinking 'libguac-client-kubernetes.la' |
| | ... |
| | make[4] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/protocols/rdp » |
| | /usr/bin/mkdir -p '/usr/local/lib' |
| | /bin/sh ../../../libtool --mode=install /usr/bin/install -c libguac-client-rdp.la '/usr/local/lib' |
| | libtool: warning: relinking 'libguac-client-rdp.la' |
| | ... |
| | /usr/bin/mkdir -p '/usr/lib64/freerdp2' |
| | /bin/sh ../../../libtool --mode=install /usr/bin/install -c libguac-common-svc-client.la libguacai-client.la '/usr/lib64/freerdp2' |
| | libtool: warning: relinking 'libguac-common-svc-client.la' |
| | libtool: install: (cd /opt/guacamole-server-1.1.0/src/protocols/rdp; /bin/sh "/opt/guacamole-server-1.1.0/libtool" --silent --tag CC --mode=relink gcc -Werror -Wall -Iinclude -I../../../src/libguac -I/usr/include/freerdp2/ -I/usr/include/winpr2 -g -O2 -module -avoid-version -shared -lfreerdp2 -lfreerdp-client2 -lwinpr2 -o libguac-common-svc-client.la -rpath /usr/lib64/freerdp2 plugins/guac-common-svc/libguac_common_svc_client_la-guac-common-svc.lo ../../../src/libguac/libguac.la ) |
| | libtool: install: /usr/bin/install -c .libs/libguac-common-svc-client.soT /usr/lib64/freerdp2/libguac-common-svc-client.so |
| | libtool: install: /usr/bin/install -c .libs/libguac-common-svc-client.lai /usr/lib64/freerdp2/libguac-common-svc-client.la |
| | libtool: warning: relinking 'libguacai-client.la' |
| | libtool: install: (cd /opt/guacamole-server-1.1.0/src/protocols/rdp; /bin/sh "/opt/guacamole-server-1.1.0/libtool" --silent --tag CC --mode=relink gcc -Werror -Wall -Iinclude -I../../../src/common -I../../../src/common-ssh -I../../../src/libguac -I/usr/include/freerdp2/ -I/usr/include/winpr2 -g -O2 -module -avoid-version -shared -lpthread -lfreerdp2 -lfreerdp-client2 -lwinpr2 -o libguacai-client.la -rpath /usr/lib64/freerdp2 channels/audio-input/libguacai_client_la-audio-buffer.lo plugins/guacai/libguacai_client_la-guacai-messages.lo plugins/guacai/libguacai_client_la-guacai.lo plugins/libguacai_client_la-ptr-string.lo ../../../src/common/libguac_common.la ../../../src/libguac/libguac.la ) |
| | libtool: install: /usr/bin/install -c .libs/libguacai-client.soT /usr/lib64/freerdp2/libguacai-client.so |
| | libtool: install: /usr/bin/install -c .libs/libguacai-client.lai /usr/lib64/freerdp2/libguacai-client.la |
| | libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/lib64/freerdp2 |
| | ---------------------------------------------------------------------- |
| | Libraries have been installed in: |
| | /usr/lib64/freerdp2 |
| | ... |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/protocols/ssh » |
| | /usr/bin/mkdir -p '/usr/local/lib' |
| | /bin/sh ../../../libtool --mode=install /usr/bin/install -c libguac-client-ssh.la '/usr/local/lib' |
| | libtool: warning: relinking 'libguac-client-ssh.la' |
| | ... |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/protocols/vnc » |
| | /usr/bin/mkdir -p '/usr/local/lib' |
| | /bin/sh ../../../libtool --mode=install /usr/bin/install -c libguac-client-vnc.la '/usr/local/lib' |
| | libtool: warning: relinking 'libguac-client-vnc.la' |
| | ... |
| | /usr/bin/install -c -m 644 man/guacd.8 '/usr/local/share/man/man8' |
| | make[2] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/guacd » |
| | make[1] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/guacd » |
| | Making install in src/guacenc |
| | make[1] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/guacenc » |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/guacenc » |
| | /usr/bin/mkdir -p '/usr/local/bin' |
| | /bin/sh ../../libtool --mode=install /usr/bin/install -c guacenc '/usr/local/bin' |
| | libtool: install: /usr/bin/install -c .libs/guacenc /usr/local/bin/guacenc |
| | /usr/bin/mkdir -p '/usr/local/share/man/man1' |
| | /usr/bin/install -c -m 644 man/guacenc.1 '/usr/local/share/man/man1' |
| | make[2] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/guacenc » |
| | make[1] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/guacenc » |
| | Making install in src/guaclog |
| | make[1] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/guaclog » |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0/src/guaclog » |
| | /usr/bin/mkdir -p '/usr/local/bin' |
| | /bin/sh ../../libtool --mode=install /usr/bin/install -c guaclog '/usr/local/bin' |
| | libtool: install: /usr/bin/install -c .libs/guaclog /usr/local/bin/guaclog |
| | /usr/bin/mkdir -p '/usr/local/share/man/man1' |
| | /usr/bin/install -c -m 644 man/guaclog.1 '/usr/local/share/man/man1' |
| | make[2] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/guaclog » |
| | make[1] : on quitte le répertoire « /opt/guacamole-server-1.1.0/src/guaclog » |
| | make[1] : on entre dans le répertoire « /opt/guacamole-server-1.1.0 » |
| | make[2] : on entre dans le répertoire « /opt/guacamole-server-1.1.0 » |
| | make[2]: rien à faire pour « install-exec-am ». |
| | make[2]: rien à faire pour « install-data-am ». |
| | make[2] : on quitte le répertoire « /opt/guacamole-server-1.1.0 » |
| | make[1] : on quitte le répertoire « /opt/guacamole-server-1.1.0 » |
| | </code> |
| | |
| | <code> |
| | [root@rlab guacamole-server-1.1.0]# ldconfig && cd ~ |
| | [root@rlab ~]# |
| | </code> |
| | |
| | ==== webapp tomcat ==== |
| | |
| | recuperation de Guacamole Web Application (.war) a mettre dans l'aborescence tomcat |
| | |
| | <code> |
| | [root@rlab ~]# wget https://downloads.apache.org/guacamole/1.1.0/binary/guacamole-1.1.0.war |
| | [root@rlab ~]# cp guacamole-1.1.0.war /opt/tomcat/webapps/ |
| | [root@rlab ~]# ls /opt/tomcat/webapps/ |
| | docs examples guacamole-1.1.0 guacamole-1.1.0.war host-manager manager ROOT |
| | </code> |
| | |
| | ==== guacd ==== |
| | |
| | demarer (manuellement pour l'instant) le daemon guacd |
| | |
| | <code> |
| | [root@rlab ~]# /etc/init.d/guacd start |
| | Starting guacd: guacd[27813]: INFO: Guacamole proxy daemon (guacd) version 1.1.0 started |
| | SUCCESS |
| | [root@rlab ~]# /etc/init.d/guacd status |
| | guacd is running with PID=27815. |
| | |
| | [root@rlab ~]# ps auwx |grep guacd |
| | root 27815 0.0 0.6 85292 10028 ? S 14:36 0:00 /usr/local/sbin/guacd -p /var/run/guacd.pid |
| | |
| | </code> |
| | |
| | ==== reverse-proxy ==== |
| | |
| | le support de proxy-ajp n'est pas compatible avec les websocket guacamole (force un retour a http) et apache 2.4.3 ne support pas la method HTTP PATCH ce qui rend inoperant l'interface de management de guacamole , on va donc utiliser le mod_proxy sous apache . |
| | |
| | avant tout s'assurer de mettre URIEncoding="UTF-8" dans la configuration du serveur tomcat afin d'assurer le transit de noms d'application et/ou pearametre contenant des carateres non-latin, cyrilic etc ... |
| | |
| | <code> |
| | [root@rlab conf]# vim /opt/tomcat/conf/server.xml |
| | |
| | <Connector port="8080" protocol="HTTP/1.1" |
| | connectionTimeout="20000" |
| | URIEncoding="UTF-8" |
| | redirectPort="8443" /> |
| | </code> |
| | |
| | === remote IP === |
| | |
| | par defaut quand tomcat est derriere un proxy , il voit les requetes clientes venir de l'IP du proxy, in convient pour les logs et potentiels controles d'acces a base d'IP de transporter par le proxy le vrai IP source du client, cela se fait avec le header HTTP X-Forwarded-For en configurant le Valve RemoteIpValve dans server.xml |
| | |
| | <code> |
| | [root@rlab conf]# vim /opt/tomcat/conf/server.xml |
| | |
| | <!-- https://guacamole.apache.org/doc/gug/proxying-guacamole.html |
| | Configuring Tomcat to pass through the remote IP address provided by the reverse proxy in the X-Forwarded-For header |
| | requires the configuration of what Tomcat calls a Valve. |
| | In this case, it is the RemoteIpValve and is configured in the conf/server.xml file, in the <Host> section |
| | --> |
| | <Valve className="org.apache.catalina.valves.RemoteIpValve" |
| | internalProxies="127.0.0.1" |
| | remoteIpHeader="x-forwarded-for" |
| | remoteIpProxiesHeader="x-forwarded-by" |
| | protocolHeader="x-forwarded-proto" /> |
| | |
| | </Host> |
| | </code> |
| | |
| | |
| | === apache proxy === |
| | |
| | les directives ProxyPass et ProxyPassReverse fournis par le mod_proxy assure le lien de proxy entre apache et tomcat |
| | |
| | <code> |
| | [root@rlab conf.d]# vim /etc/httpd/conf.d/ssl.conf |
| | |
| | #https://guacamole.apache.org/doc/gug/proxying-guacamole.html |
| | <Location /guacamole/> |
| | Order allow,deny |
| | Allow from all |
| | ProxyPass http://127.0.0.1:8080/guacamole-1.1.0/ flushpackets=on |
| | ProxyPassReverse http://127.0.0.1:8080/guacamole-1.1.0/ |
| | ProxyPassReverseCookiePath /guacamole-1.1.0/ /guacamole/ #because location diffrences from apache to tomcat, cookies need to match |
| | </Location> |
| | </code> |
| | |
| | === apache log === |
| | |
| | il est inutile de loger toutes les requetes http de courte durée du aux steams dans le http-tunnel (si pas de websockets) |
| | |
| | <code> |
| | [root@rlab conf.d]# vim /etc/httpd/conf.d/ssl.conf |
| | |
| | <VirtualHost _default_:443> |
| | |
| | |
| | SetEnvIf Request_URI "^/guacamole/tunnel" dontlog |
| | CustomLog /var/log/httpd/guac.log common env=!dontlog |
| | </code> |
| | |
| | |
| | ==== database ==== |
| | |
| | afin de permettre a plusieurs utilisateurs de se conencter et enregistrer des preferences il convient de definir une database |
| | |
| | === arborescence extension === |
| | |
| | la database ou autre modules d'authentification (ldap, cas ) sont fournit sous forme de module quil faut deployer dans une arborescence specifique que nous créons dans /usr/share/tomcat/.guacamole |
| | |
| | <code> |
| | [root@rlab etc]# mkdir -p /usr/share/tomcat/.guacamole/{extensions,lib} |
| | </code> |
| | |
| | === modules === |
| | |
| | recuperation et deploiement des modules pour la database |
| | |
| | <code> |
| | [root@rlab ~]# wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.20-1.el8.noarch.rpm |
| | [root@rlab ~]# yum install mysql-connector-java-8.0.20-1.el8.noarch.rpm |
| | [root@rlab ~]# cp /usr/share/java/mysql-connector-java.jar /usr/share/tomcat/.guacamole/lib/ |
| | </code> |
| | |
| | <code> |
| | [root@rlab ~]# wget https://downloads.apache.org/guacamole/1.1.0/binary/guacamole-auth-jdbc-1.1.0.tar.gz |
| | [root@rlab ~]# tar xvfz guacamole-auth-jdbc-1.1.0.tar.gz ^C |
| | [root@rlab ~]# cp guacamole-auth-jdbc-1.1.0/mysql/guacamole-auth-jdbc-mysql-1.1.0.jar /usr/share/tomcat/.guacamole/extensions/ |
| | </code> |
| | |
| | ==== mariaDB ==== |
| | |
| | apres installation de mariadb-server , on va le securiser |
| | |
| | <code> |
| | [root@rlab ~]# systemctl start mariadb.service |
| | [root@rlab ~]# mysql_secure_installation |
| | Set root password? [Y/n] Y |
| | New password: |
| | Re-enter new password: Secret Pa U g... S.. ip5 d Da |
| | Password updated successfully! |
| | Reloading privilege tables.. |
| | ... Success! |
| | Remove anonymous users? [Y/n] y |
| | ... Success! |
| | Normally, root should only be allowed to connect from 'localhost'. This |
| | ensures that someone cannot guess at the root password from the network. |
| | Disallow root login remotely? [Y/n] y |
| | ... Success! |
| | Remove test database and access to it? [Y/n] y |
| | - Dropping test database... |
| | ... Success! |
| | - Removing privileges on test database... |
| | ... Success! |
| | Reload privilege tables now? [Y/n] y |
| | Thanks for using MariaDB! |
| | </code> |
| | |
| | <code> |
| | [root@rlab ~]# mysql -u root -p |
| | |
| | MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS guacdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; |
| | Query OK, 1 row affected (0.000 sec) |
| | MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON guacdb.* TO 'guacuser'@'localhost' IDENTIFIED BY 'secretUg...G...d' WITH GRANT OPTION; |
| | Query OK, 0 rows affected (0.000 sec) |
| | MariaDB [(none)]> flush privileges; |
| | Query OK, 0 rows affected (0.000 sec) |
| | MariaDB [(none)]> quit |
| | </code> |
| | |
| | creation des table et user : |
| | |
| | <code> |
| | [root@rlab ~]# cat /root/guacamole-auth-jdbc-1.1.0/mysql/schema/001-create-schema.sql | mysql -u root -p guacdb |
| | [root@rlab ~]# cat /root/guacamole-auth-jdbc-1.1.0/mysql/schema/002-create-admin-user.sql | mysql -u root -p guacdb |
| | </code> |
| | |
| | === configuration / properties === |
| | |
| | <code> |
| | [root@rlab ~]# mkdir -p /etc/guacamole/ && vi /etc/guacamole/guacamole.properties |
| | [root@rlab ~]# cat /etc/guacamole/guacamole.properties |
| | # MySQL properties |
| | mysql-hostname: localhost |
| | mysql-port: 3306 |
| | mysql-database: guacdb |
| | mysql-username: guacuser |
| | mysql-password: secret |
| | #Additional settings |
| | mysql-default-max-connections-per-user: 0 |
| | mysql-default-max-group-connections-per-user: 0 |
| | </code> |
| | |
| | === permissions === |
| | |
| | <code> |
| | [root@rlab ~]# chmod 0400 /etc/guacamole/guacamole.properties |
| | [root@rlab ~]# chown tomcat:tomcat /etc/guacamole/guacamole.properties |
| | [root@rlab ~]# ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat/.guacamole/ |
| | |
| | [root@rlab ~]# chown tomcat:tomcat /opt/tomcat/webapps/guacamole-1.1.0.war |
| | </code> |
| | |
| | ==== GUACAMOLE_HOME ==== |
| | |
| | Tres imprtant pour la configurations des plugins/modules , il faut s'assurer que tomcat charge bien les paremtrages definit dans guacamole.properties. ceci se fait grace à la variable GUACAMOLE_HOME qui est fixé par defaut a /etc/guacamole/ |
| | |
| | comme ci-dessus nus avons definit les propriété dans /usr/share/tomcat/.guacamole/ avec un jeux de liens, et que le homedir du user tomcat dans mon installation est ici dans /opt/tomcat, il convient egalement de créé un lien depuis /opt/tomcat/.guacamole vers /usr/share/tomcat/.guacamole |
| | |
| | cf https://guacamole.apache.org/doc/gug/configuring-guacamole.html Overriding GUACAMOLE_HOME => Creating a directory named .guacamole, within the home directory of the user running the servlet container. This directory will automatically be used for GUACAMOLE_HOME if it exists. |
| | |
| | |
| | <code> |
| | [root@rlab /opt/tomcat]# ln -s /usr/share/tomcat/.guacamole .guacamole |
| | </code> |
| | |
| | Apres redemarrage de tomcat , on peut enfin se connecter avec la compte guacadmin (cf fichier d'import sql : 002-create-admin-user.sql) et ainsi changer le password de cet administrateur |
| | |
| | https://rlab.domain.top/guacamole/#/settings/preferences |
| | |
| | |
| |
| |