Hello, all,
I've started writing an extension to Guacamole that is intended to decorate
an existing connection directory, and allow admins to provide a list of
default values for connection parameters, or override (force) values for
connection parameters. I've got the code mostly written and, I think,
working, except for one small issue that I've encountered: the way that I'm
overriding the connection parameters doesn't seem to work with connections
stored in the JDBC module.

The code for this is here:
https://github.com/necouchman/guacamole-client/tree/working/default-template-extension

The extension works roughly like so:
* A YAML file in GUACAMOLE_HOME can contain three different overall
sections:
--> "defaults" - This section is intended to provide defaults and/or
overrides for all connections.
--> "protocols" - Sub-sections of this for each protocol ("rdp","ssh",
etc.) provide defaults and/or overrides that are specific to each protocol.
--> "templates" - A section where named templates can be created and later
selected in the Web UI. This part is not quite implemented, but that's not
relevant to the discussion.
* The extension is installed as a decorating extension, relying on some
underlying module (JDBC, in my case, but could also be JSON or a custom
module) to provide the connections. Each existing connection is wrapped in
a DefaultsConnection [1].
* The DefaultsConnection overrides both the getConfiguration() and
connect() methods. In the getConfiguraiton() method, it pulls in the
wrapped connection's parameters, and then 1) adds any default parameters
that do not exist in the underlying configuration, and 2) replaces any
values that do exist if they are specified as overrides from the default
configuration. The connect() method, at the moment, forces a
getConfiguration() at the time of connection, and then calls the connect()
method for the wrapped connection.

The issue that I'm seeing with connections stored in the JDBC module is
that they don't actually get any of the defaults or the overrides. I
suspect this is because much of the functionality of the connect() method
for the JDBC connections gets delegated to the AbstractGuacamoleTunnel  and
RestrictedGuacamoleTunnel classes, and, that since these are "tunnel'
classes they are actually getting called at the time connect() is called,
and, therefore, the configuration parameters are actually (re-)pulled from
the JDBC models at the time connect() is run, and thus the added and
overridden values are just ignore/discarded/over-overridden by the code
within the Tunnel classes.

So, my question(s) are:
* Is my overall assessment of why this isn't working with the JDBC
connections correct, or am I missing something more fundamental?
* Is there a clean/easy way around this, or would changes have to be made
to the way the JDBC connections handle the tunnel requests to allow
connection parameters to be added or changed at connection time?
* Or is there a different way to accomplish (roughly) what I'm trying to
do, here, without it needing to happen at connection time - some other path
through this that I've just over-looked?

Thanks for the help.

-Nick

[1] -
https://github.com/necouchman/guacamole-client/blob/working/default-template-extension/extensions/guacamole-defaults-templates/src/main/java/org/apache/guacamole/auth/defaults/connection/DefaultsConnection.java

Reply via email to