How to reduce data traffic?

2021-11-01 Thread takuya morita
Hi, Guacamole support.
I'm Takuya.

I want to reduce data traffic when using Guacamole.
We know that resolution and color depth have a lot to do with it.
Are there any other factors that have a significant impact on data traffic?


Re: Custom auth: updateAuthenticatedUser() not updating list of available connections

2021-11-01 Thread Mike Jumper
On Mon, Nov 1, 2021 at 3:37 PM Dustin Lang  wrote:

> Hi Nick,
>
> Thanks for your reply.  But I'm confused -- in
> updateAuthenticatedUser(AuthenticatedUser, Credentials), how can I get the
> current UserContext object associated with that auth user?
> SimpleAuthenticatedUser is a private class in SimpleAuthenticationProvider,
> otherwise I could cast it and .getAuthorizedConfigurations()...
>

For the UserContext, there is a separate updateUserContext() function that
receives the previous UserContext instance:

https://guacamole.apache.org/doc/1.3.0/guacamole-ext/org/apache/guacamole/net/auth/AuthenticationProvider.html#updateUserContext-org.apache.guacamole.net.auth.UserContext-org.apache.guacamole.net.auth.AuthenticatedUser-org.apache.guacamole.net.auth.Credentials-

You can't otherwise directly obtain the single UserContext associated with
the AuthenticatedUser because there is no such thing - the relationship
between the AuthenticatedUser and the UserContext(s) is one-to-many, with
each extension having the opportunity to provide their own UserContext for
the AuthenticatedUser instance that may come from another extension. The
interface presented to the user will be a transparently unified view of all
the UserContexts associated with their Guacamole session.

You also do not have to implement updateUserContext() unless the data
exposed by your UserContext implementation needs to change relative to
newly-submitted credentials. Your UserContext can be dynamic and produce
differing sets of connections, users, etc. based on external factors that
are independent of user credentials, such as the contents of a database or
the contents of a REST request to some other service. It's also possible to
have the internal result of attempting to connect to a Connection vary
dynamically - you don't need to bake in static configuration and data ahead
of time, changing things only when an explicit update call occurs.

Beware that the results of REST API requests to Guacamole are cached by the
web application, so if you have confirmed that you are updating your
UserContext but are simply not seeing the results of those updates in the
UI, it may just be that you're seeing the old cached data.

Michael Jumper
CEO, Lead Developer
Glyptodon Inc .

>


Re: Custom auth: updateAuthenticatedUser() not updating list of available connections

2021-11-01 Thread Dustin Lang
Hi Nick,

Thanks for your reply.  But I'm confused -- in
updateAuthenticatedUser(AuthenticatedUser, Credentials), how can I get the
current UserContext object associated with that auth user?
SimpleAuthenticatedUser is a private class in SimpleAuthenticationProvider,
otherwise I could cast it and .getAuthorizedConfigurations()...

Does this imply that I also have to override authenticateUser() to return
some different kind of AuthenticatedUser that isn't private, or something?

Apologies for the naive questions, I'm new to guac and it's been a good 20
years since I've programmed in Java...

thanks,
--dustin

https://github.com/apache/guacamole-client/blob/master/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleAuthenticationProvider.java#L68




On Mon, Nov 1, 2021 at 5:48 PM Nick Couchman  wrote:

> On Mon, Nov 1, 2021 at 5:15 PM Dustin Lang  wrote:
>
>> Hi,
>>
>> I'm trying to set up guacamole so that users on my large multi-user
>> server can start up their own VNC sessions (eg, via an SSH session).  On
>> the user's home page, I want to list all their currently existing VNC
>> sessions.
>>
>> I have adapted the PAMAuthenticationProvider (subclass of
>> SimpleAuthenticationProvider) to do this real-time check for the user's VNC
>> sessions, by overriding getAuthorizedConfigurations(), and also overriding
>> updateAuthenticatedUser() to re-generate that list when the user reloads
>> their home page.
>>
>> BUT, I'm finding that even though I am returning a new AuthenticatedUser
>> with a new set of available connections, the All Connections list on their
>> home page is not updating.
>>
>> Do I need to go in and adjust the existing AuthenticatedUser?, or is
>> there some other method I should be overriding instead?  Or is it not
>> possible to update the list of available connections after login?
>>
>>
> It's definitely possible to do - the JDBC module makes use of this, as you
> can add connections and then go back to the home screen and immediately see
> them.
>
> In the SimpleAuthenticationProvider module, there are a couple of places
> where configs are pulled - one of them is in the getUserContext() method:
>
> https://github.com/apache/guacamole-client/blob/62b26fb594aa160478ce44c6d2bb8e6a1cef4174/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleAuthenticationProvider.java#L157-L172
>
> This calls the getAuthorizedConfigurations() method, so it's possible it
> explains why it's being initially populated correctly, but not updating.
> You may need to update the configurations inside the UserContext that is
> created as part of that getUserContext method.
>
> -Nick
>


Re: SSH SFTP Idle disconnection

2021-11-01 Thread Nick Couchman
On Sun, Oct 31, 2021 at 3:31 AM Shai Roemi  wrote:

> Sorry for the late reply
> I did run guacd in debug mode, no more informative logs appear. As I said
> earlier, I traced the error to this function
> . The documentation
> says NULL is returned on error, although the logs don't print the actual
> error code.
>

My guess is that the function you mention only gets run once, upon initial
connection of the SFTP channel. So, you probably won't get an error out of
that, since you indicate that the SFTP session initially works fine but
stops working somewhere along the way. So, I would guess that function call
succeeds and you won't see any errors there. Of course, I could be wrong
about that, just my guess.


> My next step is to patch guacd to print it, hoping it'll give me more
> information to find the source of the problem.
> Regarding network issues, that was my first guess as well. I reviewed the
> traffic and I see SSH-v2 keepalives transmitting and ack'ing successfully
> at the correct intervals (according to the connection configurations).
>
>
Yes, the SSH keep-alives will be there, and, since the SFTP traffic uses
the same SSH connection as the terminal, I would expect this.


> I very much doubt this is a guacamole bug, but If you have any other ideas
> I'd love to hear them!
> I'll update this thread when I find out anything new, hopefully it'll help
> someone someday :)
>
>
Yeah, it's definitely an odd problem. I'm certainly not saying that it
absolutely couldn't be a bug in Guacamole - there certainly could be some
corner-case it can't deal with, or even in libssh2 or something like that.
But it almost seems like either the network is shutting down parts of the
SSH connection, or the SSH server itself. Very strange - if you're able to
track it down I will definitely be interested to hear what you come up with!

-Nick

>


Re: Need help: Error querying database

2021-11-01 Thread Nick Couchman
On Mon, Nov 1, 2021 at 1:47 AM Son, Tran Ngoc  wrote:

> Dear all,
>
> My Apache Guacamole has been shutdown unplanned. Now it has the following
> error:
>
>
>
> [http-nio-8080-exec-4] ERROR o.a.g.rest.RESTExceptionMapper - Unexpected
> internal error:
>
> ### Error querying database.  Cause:
> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications
> link failure
>
>
>

I would make sure your MySQL or MariaDB server is running correctly. The
error indicates that the JDBC extension cannot contact the database server.

-Nick

>


Re: Custom auth: updateAuthenticatedUser() not updating list of available connections

2021-11-01 Thread Nick Couchman
On Mon, Nov 1, 2021 at 5:15 PM Dustin Lang  wrote:

> Hi,
>
> I'm trying to set up guacamole so that users on my large multi-user server
> can start up their own VNC sessions (eg, via an SSH session).  On the
> user's home page, I want to list all their currently existing VNC sessions.
>
> I have adapted the PAMAuthenticationProvider (subclass of
> SimpleAuthenticationProvider) to do this real-time check for the user's VNC
> sessions, by overriding getAuthorizedConfigurations(), and also overriding
> updateAuthenticatedUser() to re-generate that list when the user reloads
> their home page.
>
> BUT, I'm finding that even though I am returning a new AuthenticatedUser
> with a new set of available connections, the All Connections list on their
> home page is not updating.
>
> Do I need to go in and adjust the existing AuthenticatedUser?, or is there
> some other method I should be overriding instead?  Or is it not possible to
> update the list of available connections after login?
>
>
It's definitely possible to do - the JDBC module makes use of this, as you
can add connections and then go back to the home screen and immediately see
them.

In the SimpleAuthenticationProvider module, there are a couple of places
where configs are pulled - one of them is in the getUserContext() method:
https://github.com/apache/guacamole-client/blob/62b26fb594aa160478ce44c6d2bb8e6a1cef4174/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleAuthenticationProvider.java#L157-L172

This calls the getAuthorizedConfigurations() method, so it's possible it
explains why it's being initially populated correctly, but not updating.
You may need to update the configurations inside the UserContext that is
created as part of that getUserContext method.

-Nick


Custom auth: updateAuthenticatedUser() not updating list of available connections

2021-11-01 Thread Dustin Lang
Hi,

I'm trying to set up guacamole so that users on my large multi-user server
can start up their own VNC sessions (eg, via an SSH session).  On the
user's home page, I want to list all their currently existing VNC sessions.

I have adapted the PAMAuthenticationProvider (subclass of
SimpleAuthenticationProvider) to do this real-time check for the user's VNC
sessions, by overriding getAuthorizedConfigurations(), and also overriding
updateAuthenticatedUser() to re-generate that list when the user reloads
their home page.

BUT, I'm finding that even though I am returning a new AuthenticatedUser
with a new set of available connections, the All Connections list on their
home page is not updating.

Do I need to go in and adjust the existing AuthenticatedUser?, or is there
some other method I should be overriding instead?  Or is it not possible to
update the list of available connections after login?

Thanks for any guidance!
--dustin


(my code:
https://github.com/dstndstn/guacamole-create-vnc/blob/auth/src/main/java/com/github/dstndstn/guacamole/CreateVNCAuthenticator.java#L129
)