On Wed, Apr 27, 2022 at 3:30 AM Rafael Cervillera <[email protected]> wrote:

> Hello all.
>
> Firstable, thanks for the awesome work with Apache Guacamole.
>
> Our environment is CentOS with Guacamole 1.3.0 and RDP connections to
> Windows10 virtual clients. Now we need to query the active RDP sessions
> in order to shutdown inactive devices and start up in the moment we need
> them.
>
> Our idea is get the active sessions with an SQL query from the command
> line and launch the shutdown/start up process. So, we have looked for a
> SQL table with the active connections to make an SQL query unsucessfully.
>
> Is there any way to do that with SQL?


I wouldn't recommend doing this. Releases from 1.4.0 and older do not
record active sessions in the database.

This has changed recently, and active sessions will have an entry in the
connection history table, but you should still not rely on this. The
existence of an entry within the table doesn't guarantee that there is a
corresponding session. It could also be the case that the server or
database was forcibly shut down, went offline, etc. before the entry could
be updated with the end time.

Or do you have another idea to get the active sessions?
>

If the intent is to start/shutdown resources required for connections, I'd
recommend instead writing an extension that decorates the Connections and
ConnectionGroups of other extensions. By doing this, you can override
connect() to provide whatever additional behavior you need when the
connection starts, and override close() of the returned GuacamoleTunnel to
provide whatever additional behavior you need when the connection is
disconnected.

See:
https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/AuthenticationProvider.html#decorate(org.apache.guacamole.net.auth.UserContext,org.apache.guacamole.net.auth.AuthenticatedUser,org.apache.guacamole.net.auth.Credentials)

There are convenience classes for handling this sort of decoration:

https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/DelegatingUserContext.html
https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/DecoratingDirectory.html

An overview of the format of extensions can be found here:

https://guacamole.apache.org/doc/gug/guacamole-ext.html

- Mike

Reply via email to