Shared connection

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Shared connection

umesh

Hi,

 

I am using custom authentication provider without DB. Now I want to share the created connection with others, can it be done?

 

Regards,

Umesh

Reply | Threaded
Open this post in threaded view
|

Re: Shared connection

Mike Jumper-3
On Wed, Nov 27, 2019 at 11:02 PM Umesh Bhatt <[hidden email]> wrote:

Hi,

 

I am using custom authentication provider without DB. Now I want to share the created connection with others, can it be done?


Yes. Even the database implementation is an authentication provider which leverages the same API. None of the extensions that are part of guacamole-client use anything that a third-party extension cannot use in exactly the same way.

The part of the API that deals with sharing connections with others is pretty abstract. The database implementation uses a link containing a query parameter, but you can do just about anything here. It's really up to you to decide how things will be shared. The extension API conceptualizes this using credentials specific to sharing. Combined with sharing profiles, this mainly allows you to expose the ability to share the connection such that choices for sharing will be available in that "Share" menu within the Guacamole menu:


The technical capability to share an active connection is independent of the above. Internally, all that matters is that you pull the ID generated by guacd for the connection to be shared, and provide that ID (rather than a protocol name) when connecting as a user sharing that connection. That's all you need to do for that second connection to join the first. Regardless of whether you use sharing credentials, the share menu, etc., it's the use of that ID that causes the underlying connection to be a shared connection.


Note that this ID has nothing to do with database IDs or the more generic concept of identifiers in the extension API. It's purely a Guacamole protocol concept, used by guacd to uniquely identify active connections so they can be joined. You can see this covered briefly here:


- Mike

Reply | Threaded
Open this post in threaded view
|

RE: Shared connection

umesh

Hi,

 

Thanks for sharing the information.

I want to generate a shared connection by default with every user connection. This will help Admin to directly connect to user session and see what user is performing in the system.

 

Pls let me know if this is possible.

 

Regards,

Umesh

From: Mike Jumper <[hidden email]>
Sent: Thursday, November 28, 2019 1:11 PM
To: [hidden email]
Subject: Re: Shared connection

 

On Wed, Nov 27, 2019 at 11:02 PM Umesh Bhatt <[hidden email]> wrote:

Hi,

 

I am using custom authentication provider without DB. Now I want to share the created connection with others, can it be done?

 

Yes. Even the database implementation is an authentication provider which leverages the same API. None of the extensions that are part of guacamole-client use anything that a third-party extension cannot use in exactly the same way.

 

The part of the API that deals with sharing connections with others is pretty abstract. The database implementation uses a link containing a query parameter, but you can do just about anything here. It's really up to you to decide how things will be shared. The extension API conceptualizes this using credentials specific to sharing. Combined with sharing profiles, this mainly allows you to expose the ability to share the connection such that choices for sharing will be available in that "Share" menu within the Guacamole menu:

 

 

The technical capability to share an active connection is independent of the above. Internally, all that matters is that you pull the ID generated by guacd for the connection to be shared, and provide that ID (rather than a protocol name) when connecting as a user sharing that connection. That's all you need to do for that second connection to join the first. Regardless of whether you use sharing credentials, the share menu, etc., it's the use of that ID that causes the underlying connection to be a shared connection.

 

 

Note that this ID has nothing to do with database IDs or the more generic concept of identifiers in the extension API. It's purely a Guacamole protocol concept, used by guacd to uniquely identify active connections so they can be joined. You can see this covered briefly here:

 

 

- Mike

 

Reply | Threaded
Open this post in threaded view
|

Re: Shared connection

vnick
On Tue, Dec 3, 2019 at 5:47 AM Umesh Bhatt <[hidden email]> wrote:

Hi,

 

Thanks for sharing the information.

I want to generate a shared connection by default with every user connection. This will help Admin to directly connect to user session and see what user is performing in the system.

 


A feature has recently been added that will allow admins to connect directly to existing sessions without having to generate the shared connection keys.  I believe it's in the git master branch and will be released after the 1.1.0 code (1.2.0 or 2.0.0).

-Nick
Reply | Threaded
Open this post in threaded view
|

RE: Shared connection

umesh

Hi Nick,

 

Since currently it is not available, I am trying to implement in my custom auth provider.

 

I am using GuacamoleConfiguration setConnectionId(ALREADY_ACTIVE_CONNECTION_ID) to join to existing active connection but not seeing it working.

 

What is ConnectionID, is it GUACD connection ID which is usually something like $7beb584d-d6e2-459d-86e9-e726091862cb?

If so how can I retrieve it in my code?

 

Pls suggest.

 

Regards,

Umesh

From: Nick Couchman <[hidden email]>
Sent: Wednesday, December 4, 2019 2:10 AM
To: [hidden email]
Subject: Re: Shared connection

 

On Tue, Dec 3, 2019 at 5:47 AM Umesh Bhatt <[hidden email]> wrote:

Hi,

 

Thanks for sharing the information.

I want to generate a shared connection by default with every user connection. This will help Admin to directly connect to user session and see what user is performing in the system.

 

 

A feature has recently been added that will allow admins to connect directly to existing sessions without having to generate the shared connection keys.  I believe it's in the git master branch and will be released after the 1.1.0 code (1.2.0 or 2.0.0).

 

-Nick

Reply | Threaded
Open this post in threaded view
|

Re: Shared connection

vnick
On Wed, Dec 4, 2019 at 5:46 AM Umesh Bhatt <[hidden email]> wrote:

Hi Nick,

 

Since currently it is not available, I am trying to implement in my custom auth provider.

 


Well, it isn't *released*, but it is available...in git master.  However, doing it in a custom authentication module should be fine, as well.
 

I am using GuacamoleConfiguration setConnectionId(ALREADY_ACTIVE_CONNECTION_ID) to join to existing active connection but not seeing it working.

 

What is ConnectionID, is it GUACD connection ID which is usually something like $7beb584d-d6e2-459d-86e9-e726091862cb?

If so how can I retrieve it in my code?

 


This is automatically generated when the connection is started, so you'll need to retrieve a list of active connections, which will give you the UUID (collection of random letters and numbers above) and then select the correct connection.

-Nick
Reply | Threaded
Open this post in threaded view
|

RE: Shared connection

umesh

Hi Nick,

 

I am trying to get active connections using below code but it is always fails and error details are not clear.

Also in connDir.getAll(null), we need to provide identifiers. Can you pls explain how to get this?

 

Regards,

Umesh

 

private void printActiveConnections(AuthenticatedUser usr) {

            try {

                  System.out.println("Listing active connections.");

                  if(usr == null) {

                        System.out.println("No user object.");

                        return;

                  }

                       

                  System.out.println("usr = " + usr.getIdentifier());

                  UserContext ctxt = null;

                  try {

                        ctxt = getUserContext(usr);

                        if(ctxt == null) {

                              System.out.println("No user context.");

                              return;

                        }

                  } catch(GuacamoleException ex) {

                        System.out.println(ex.getMessage());

                  }

                 

                  Directory<ActiveConnection> connDir = ctxt.getActiveConnectionDirectory();

                  if(connDir == null) {

                        System.out.println("No connection directory.");

                        return;

                  }

                 

                  Collection<ActiveConnection> allConns = connDir.getAll(null);

                  if(allConns == null || allConns.isEmpty()) {

                        System.out.println("No active connections.");

                        return;

                  }

                 

                  for(ActiveConnection conn : allConns) {

                        System.out.println("Conn Identifier = " + conn.getConnectionIdentifier() +

                                    " Identifier = " + conn.getIdentifier() +

                                    " Remote host = " + conn.getRemoteHost() +

                                    " Username = " + conn.getUsername());

                  }

            } catch (Exception ex) {

                  System.out.println("Error: " + ex.getMessage());

            }

      }

 

From: Nick Couchman <[hidden email]>
Sent: Wednesday, December 4, 2019 11:31 PM
To: [hidden email]
Subject: Re: Shared connection

 

On Wed, Dec 4, 2019 at 5:46 AM Umesh Bhatt <[hidden email]> wrote:

Hi Nick,

 

Since currently it is not available, I am trying to implement in my custom auth provider.

 

 

Well, it isn't *released*, but it is available...in git master.  However, doing it in a custom authentication module should be fine, as well.

 

I am using GuacamoleConfiguration setConnectionId(ALREADY_ACTIVE_CONNECTION_ID) to join to existing active connection but not seeing it working.

 

What is ConnectionID, is it GUACD connection ID which is usually something like $7beb584d-d6e2-459d-86e9-e726091862cb?

If so how can I retrieve it in my code?

 

 

This is automatically generated when the connection is started, so you'll need to retrieve a list of active connections, which will give you the UUID (collection of random letters and numbers above) and then select the correct connection.

 

-Nick

Reply | Threaded
Open this post in threaded view
|

RE: Shared connection

umesh

Hi,

 

Any inputs what am I missing in below code? This is written in my simple custom auth provider.

 

Regards,

Umesh

From: Umesh Bhatt <[hidden email]>
Sent: Wednesday, December 11, 2019 11:29 AM
To: [hidden email]
Subject: RE: Shared connection

 

Hi Nick,

 

I am trying to get active connections using below code but it is always fails and error details are not clear.

Also in connDir.getAll(null), we need to provide identifiers. Can you pls explain how to get this?

 

Regards,

Umesh

 

private void printActiveConnections(AuthenticatedUser usr) {

            try {

                  System.out.println("Listing active connections.");

                  if(usr == null) {

                        System.out.println("No user object.");

                        return;

                  }

                       

                  System.out.println("usr = " + usr.getIdentifier());

                  UserContext ctxt = null;

                  try {

                        ctxt = getUserContext(usr);

                        if(ctxt == null) {

                              System.out.println("No user context.");

                              return;

                        }

                  } catch(GuacamoleException ex) {

                        System.out.println(ex.getMessage());

                  }

                 

                  Directory<ActiveConnection> connDir = ctxt.getActiveConnectionDirectory();

                  if(connDir == null) {

                        System.out.println("No connection directory.");

                        return;

                  }

                 

                  Collection<ActiveConnection> allConns = connDir.getAll(null);

                  if(allConns == null || allConns.isEmpty()) {

                        System.out.println("No active connections.");

                        return;

                  }

                 

                  for(ActiveConnection conn : allConns) {

                        System.out.println("Conn Identifier = " + conn.getConnectionIdentifier() +

                                    " Identifier = " + conn.getIdentifier() +

                                    " Remote host = " + conn.getRemoteHost() +

                                    " Username = " + conn.getUsername());

                  }

            } catch (Exception ex) {

                  System.out.println("Error: " + ex.getMessage());

            }

      }

 

From: Nick Couchman <[hidden email]>
Sent: Wednesday, December 4, 2019 11:31 PM
To: [hidden email]
Subject: Re: Shared connection

 

On Wed, Dec 4, 2019 at 5:46 AM Umesh Bhatt <[hidden email]> wrote:

Hi Nick,

 

Since currently it is not available, I am trying to implement in my custom auth provider.

 

 

Well, it isn't *released*, but it is available...in git master.  However, doing it in a custom authentication module should be fine, as well.

 

I am using GuacamoleConfiguration setConnectionId(ALREADY_ACTIVE_CONNECTION_ID) to join to existing active connection but not seeing it working.

 

What is ConnectionID, is it GUACD connection ID which is usually something like $7beb584d-d6e2-459d-86e9-e726091862cb?

If so how can I retrieve it in my code?

 

 

This is automatically generated when the connection is started, so you'll need to retrieve a list of active connections, which will give you the UUID (collection of random letters and numbers above) and then select the correct connection.

 

-Nick

Reply | Threaded
Open this post in threaded view
|

RE: Shared connection

umesh

Hi,

 

I have MyCustomAuthenticationProvider class which is extending SimpleAuthenticationProvider.

Is it possible to get current logged in user context in this?

I think this SimpleAuthenticationProvider::getuserContext() always creates a new SimpleUserContext.

Pls provide your inputs on this.

 

Regards,

Umesh

 

From: Umesh Bhatt <[hidden email]>
Sent: Friday, December 13, 2019 9:59 AM
To: [hidden email]
Subject: RE: Shared connection

 

Hi,

 

Any inputs what am I missing in below code? This is written in my simple custom auth provider.

 

Regards,

Umesh

From: Umesh Bhatt <[hidden email]>
Sent: Wednesday, December 11, 2019 11:29 AM
To: [hidden email]
Subject: RE: Shared connection

 

Hi Nick,

 

I am trying to get active connections using below code but it is always fails and error details are not clear.

Also in connDir.getAll(null), we need to provide identifiers. Can you pls explain how to get this?

 

Regards,

Umesh

 

private void printActiveConnections(AuthenticatedUser usr) {

            try {

                  System.out.println("Listing active connections.");

                  if(usr == null) {

                        System.out.println("No user object.");

                        return;

                  }

                       

                  System.out.println("usr = " + usr.getIdentifier());

                  UserContext ctxt = null;

                  try {

                        ctxt = getUserContext(usr);

                        if(ctxt == null) {

                              System.out.println("No user context.");

                              return;

                        }

                  } catch(GuacamoleException ex) {

                        System.out.println(ex.getMessage());

                  }

                 

                  Directory<ActiveConnection> connDir = ctxt.getActiveConnectionDirectory();

                  if(connDir == null) {

                        System.out.println("No connection directory.");

                        return;

                  }

                 

                  Collection<ActiveConnection> allConns = connDir.getAll(null);

                  if(allConns == null || allConns.isEmpty()) {

                        System.out.println("No active connections.");

                        return;

                  }

                 

                  for(ActiveConnection conn : allConns) {

                        System.out.println("Conn Identifier = " + conn.getConnectionIdentifier() +

                                    " Identifier = " + conn.getIdentifier() +

                                    " Remote host = " + conn.getRemoteHost() +

                                    " Username = " + conn.getUsername());

                  }

            } catch (Exception ex) {

                  System.out.println("Error: " + ex.getMessage());

            }

      }

 

From: Nick Couchman <[hidden email]>
Sent: Wednesday, December 4, 2019 11:31 PM
To: [hidden email]
Subject: Re: Shared connection

 

On Wed, Dec 4, 2019 at 5:46 AM Umesh Bhatt <[hidden email]> wrote:

Hi Nick,

 

Since currently it is not available, I am trying to implement in my custom auth provider.

 

 

Well, it isn't *released*, but it is available...in git master.  However, doing it in a custom authentication module should be fine, as well.

 

I am using GuacamoleConfiguration setConnectionId(ALREADY_ACTIVE_CONNECTION_ID) to join to existing active connection but not seeing it working.

 

What is ConnectionID, is it GUACD connection ID which is usually something like $7beb584d-d6e2-459d-86e9-e726091862cb?

If so how can I retrieve it in my code?

 

 

This is automatically generated when the connection is started, so you'll need to retrieve a list of active connections, which will give you the UUID (collection of random letters and numbers above) and then select the correct connection.

 

-Nick