On 11/17/2023 1:18 PM, Kai wrote:
Hello,

I came across Guacamole some days ago and I'm quite impressed about how quick I got an example running. Originally, I was planning on doing some connections to virtual machines behind a gateway by using a remote desktop client with some scripts, but the web solution can be more convenient.

As virtualization I use Proxmox and I have some dedicated VMs only running some old software without internet. They also shouldn't be running all the time for power and performance reasons.
  I'm connecting to them by RDP and also tried this in Guacamole.

I currently use some easy scripts to startup and suspend the machines before and after a RDP session. What could be the best way for me to integrate running some additional script? I looked at the wake-on-lan as example. I saw that the client web application only collects these information and the server application does the waiting and sending within C code.

As I can easily control the Proxmox VMs by using the Proxmox Rest API, I only plan to integrate some http requests before showing the RDP and after closing it. My idea was to integrate these requests somewhere in the client web application, but I didn't see a good way, yet.
Are there suggestions what position would be best?

You can hook into the connection process for any connection by leveraging decoration to wrap the connection objects returned by other extensions:

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)

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

Wrapping a Connection and its connect() implementation will allow you to hook in before a connection is established, while overriding the close() function of the returned GuacamoleTunnel will allow you to hook into when the connection is closed down. You just need to make sure that your implementation correctly *unwraps* any wrapped objects before they are passed to Directory functions like update(), as implementations may expect to receive objects of the same type that they returned via a previous call to get(). You can use DecoratingDirectory to make this much easier to do correctly:

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

It is also possible to inject arbitrary connection attributes at the UserContext level such that administrators are presented with additional configuration options when creating/updating a connection, if that's something you're looking to do.

- Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to