Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use Guacamole Reverse VNC connection

Tags:

vnc

guacamole

I am using Guacamole v0.9.9 and want to connect to my Win 10 laptop which is behind a NAT of my ISP.

I figured I might have to use Reverse VNC for this. The instructions are given here: https://guacamole.incubator.apache.org/doc/gug/configuring-guacamole.html#vnc-reverse-connections

But I am using MYSQL Auth as described here: https://guacamole.incubator.apache.org/doc/0.9.0/gug/mysql-auth.html

The problem is that I am not able to see any options for Reverse Connection in VNC settings and there is no XML file to put the parameters in.

enter image description here

Also there is no instruction what to do after that. In a conventional VNC connection you would run the client in the destination and run the server in listen/reverse mode after giving destination ip. In this case there is no client running. So I am clueless what to do next.

Any help will be much appreciated.

like image 690
Neel Avatar asked Aug 28 '16 09:08

Neel


People also ask

How do I connect to guacamole via VNC?

Connecting: Open the connection within Guacamole, then connect to the port on the Guacamole Server with the VNC client (eg. :9999as shown in the example above). If you don't open the connection within Guacamole first, guacdwon't be listening on the given port.

What is a reverse VNC connection?

Guacamole supports "reverse" VNC connections, where the VNC client listens for an incoming connection from the VNC server. When reverse VNC connections are used, the VNC client and server switch network roles, but otherwise function as they normally would.

How does guacd listen for inbound connections from a VNC server?

If set to "true", instead of connecting to a server at a given hostname and port, guacd will listen on the given port for inbound connections from a VNC server. If reverse connection is in use, the maximum amount of time to wait for an inbound connection from a VNC server, in milliseconds. If blank, the default value is 5000 (five seconds).

How does VNC work?

With the exception of reverse-mode VNC connections, VNC works by making outbound network connections to a particular host which runs one or more VNC servers. Each VNC server is associated with a display number, from which the appropriate port number is derived. The hostname or IP address of the VNC server Guacamole should connect to.


2 Answers

There are a few things you'll need to do in order to setup the reverse-connect functionality:

So in a typical authorization scenario you have something like this in the user-mapping.xml with the necessary information for the reverse-connect:

<authorize username="user" password="password">
    <connection name="reverse">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">9999</param>
        <param name="reverse-connect">true</param>
        <param name="listen-timeout">30000</param>
        <param name="autoretry">true</param>
    </connection>
</authorize>

Since you are doing this through MySQL it's the same principle:

Connections and parameters

Each connection has an entry in the guacamole_connection table, with a one-to-many relationship to parameters, stored as name/value pairs in the guacamole_connection_parameter table.

The guacamole_connection table is simply a pairing of a unique and descriptive name with the protocol to be used for the connection. Adding a connection and corresponding parameters is relatively easy compared to adding a user as there is no salt to generate nor password to hash:

-- Create connection
INSERT INTO guacamole_connection (connection_name, protocol) VALUES ('reverse', 'vnc');
SET @id = LAST_INSERT_ID();

-- Add parameters
INSERT INTO guacamole_connection_parameter VALUES (@id, 'hostname', 'localhost');
INSERT INTO guacamole_connection_parameter VALUES (@id, 'port', '9999');
INSERT INTO guacamole_connection_parameter VALUES (@id, 'reverse-connect', 'true');
...

Connecting:

Open the connection within Guacamole, then connect to the port on the Guacamole Server with the VNC client (eg. :9999 as shown in the example above). If you don't open the connection within Guacamole first, guacd won't be listening on the given port.

If you cannot establish a connection after setting up the user-mapping.xml or MySQL authorization that includes the reverse-connect parameter, it's suggested to install the latest version of libvncserver, which has ENABLED_VNC_LISTEN defined. You should notice when executing Guacamole's ./configure a warning if it's not defined:

--------------------------------------------
 No listening support found in libvncclient.
 Support for listen-mode connections will not be built.
--------------------------------------------
like image 108
l'L'l Avatar answered Oct 11 '22 00:10

l'L'l


To save yourself some hassle you could use a vnc repeater, it will listen for connection from the vnc servers and viewers, and connect the servers and viewers that use the same id

You can get one from here

Get build packages

For Debian use

apt-get install linux-headers-`uname -r` libx11-6 libx11-dev x-window-system-core x-window-system xspecs libxtst6 psmisc build-essential

For CentOS use:

yum install linux-headers-`uname -r` libx11-6 libx11-dev x-window-system-core x-window-system xspecs libxtst6 psmisc build-essential

Get source into /usr/local/src

cd /usr/local/src
wget http://www.wisdomsoftware.gr/download/uvncrep017-ws.tar.gz

Unzip source file

gunzip uvncrep017-ws.tar.gz
tar -xvf uvncrep017-ws.tar

Install startup script

cd uvncrep017-ws
make; make install;

Add a user for the service

useradd uvncrep

Edit /etc/uvnc/uvncrepeater.ini according to your needs.

Check the following parameters:

viewerport = 5901
maxsessions = 10
runasuser = uvncrep
logginglevel = 2
srvListAllow1 = 192.168.0.0 ;Allow network 192.168.x.x
srvListDeny0 = 127.0.0.1 ;Deny loopback
requirelistedserver=1

Start the service

/etc/init.d/uvncrepeater start

Original link: here

Discussion on a board about this: here

like image 32
t1f Avatar answered Oct 11 '22 01:10

t1f