You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by on 2019/02/22 09:48:59 UTC
Guacamole-Keycloak OpenID Adaptation
Hello,
I am trying to adapt Guacamole with Keycloak using guacamole-auth-openid-1.0.0.jar. My current settings in Guacamole properties are:
Guacamole Properties:
openid-authorization-endpoint:http://10.0.2.4:8080/auth/realms/Guacamole-Client/protocol/openid-connect/auth
openid-jwks-endpoint: http://10.0.2.4:8080/auth/realms/Guacamole-Client/protocol/openid-connect/certs
openid-issuer: http://10.0.2.4:8080/auth/realms/Guacamole-Client
openid-client-id: Guacamole
openid-redirect-uri : http://10.0.2.6:8080/guacamole/
I have also renamed the guacamole-auth-openid module in order to load first.
In Keycloak i have created a client for guacamole according to the above settings:
Client ID: Guacamole
Access Type: public
Standard Flow Enabled: Off
Implicit Flow Enabled: On
Direct Access Grants Enabled: Off
Authorization Enabled: Off
Valid Redirect URIs: http://10.0.2.6:8080/guacamole/*
Base UrL: http://10.0.2.6:8080/guacamole/
So far when i am trying to access guacamole i am getting the login screen of keycloak, so the open id Module seems to work fine.
When i enter the user's credential to keycloak and i press login, i get into a redirect Loop. In this loop keycloak is trying to do a POST request to Guacamole and i keep getting invalid login response.More specifically the content of response is :
,\"expected\":[{\"name\":\"id_token\",\"type\":\"GUAC_OPENID_TOKEN\",\"authorizationURI\":\"http://10.0.2.7:8080/auth/realms/nodejs-example/protocol/openid-connect/auth?scope=openid+profile&response_type=id_token&client_id=Guacamole&redirect_uri=http%3A%2F%2F10.0.2.6%3A8080%2Fguacamole%2F%23%2F&nonce=4797kjoq9jdccrgboupkpv9sau\"}]
There is also another thread in this mailing list about this loop but no one gave a clear answer.(http://mail-archives.apache.org/mod_mbox/guacamole-user/201802.mbox/%3C0C10A49B-1D86-461C-80EB-4EA3F04B603E@justin-tech.com%3E)
After reading a bit about guacamole i tried to send credentials with different names using Keylcoak mappers and even changed the openid-username-claim-type on guacamole properties but still i haven't managed to solve this problem. Also, i don't know if the user must be in Guacamole postgres Database before the login from OpenId
Thank you for your time,
Konstantinos
Re: Guacamole-Keycloak OpenID Adaptation
Posted by .
On 2019/02/25 18:54:44, Nick Couchman <vn...@apache.org> wrote:
> >
> > Thanks for your answer. You were right it is not a POST request but a GET
> > request that is coming from keycloak redirect, and it is bundled with the
> > token that contains the necessary informations.
> >
> > After seeing some Guacamole logs i am verifying that guacamole cant read
> > the token that i am sending to it. I am using
> > guacamole-auth-openid-1.0.0.jar module for the Open Id adaptation.
> >
> > There are a few things that i tried like changing the preferred_username
> > keycloak attribute to email using mappers in order to give the credentials
> > to guacamole as it is asked but still i think GUacame cant read the token
> > that i am sending.
> >
> > Also another problem that i have is that i cant monitor the logs from the
> > open id module in GUACAMOLE .
> >
> > I would really appreciate any suggestions for this issue. All threads that
> > were found in the internet are ending in the same place that i am with this
> > implementation.
> >
> >
> A couple of things I can think of:
> - Might try setting DEBUG logging for Guacamole client and see if anything
> else useful is logged:
> http://guacamole.apache.org/doc/gug/configuring-guacamole.html#webapp-logging
> - The OpenID module only supports the Implicit Flow, and not the
> Authentication (Basic) Flow. If Keycloak does not implement or accept the
> Implicit Flow, but expects Authentication Flow, you may be hitting an issue
> with that.
>
> -Nick
>
Hi Nick thanks for your feedpack, I have already enabled implicit flow. I am trying to use logs in order to loate the actual problem . I am using centos7 for both guacamole and keycloak. Even though i have edited logback.xml and set it to trace accord to https://guacamole.apache.org/doc/gug/configuring-guacamole.html , i cant get back any trace in centos 7 in /var/log/messages or in catalina.out.
Do you have any experience with logging on guacamole ??Any tip is appreciated.
Thanks in advance
Konstantinos
Re: Guacamole-Keycloak OpenID Adaptation
Posted by Nick Couchman <vn...@apache.org>.
>
> Thanks for your answer. You were right it is not a POST request but a GET
> request that is coming from keycloak redirect, and it is bundled with the
> token that contains the necessary informations.
>
> After seeing some Guacamole logs i am verifying that guacamole cant read
> the token that i am sending to it. I am using
> guacamole-auth-openid-1.0.0.jar module for the Open Id adaptation.
>
> There are a few things that i tried like changing the preferred_username
> keycloak attribute to email using mappers in order to give the credentials
> to guacamole as it is asked but still i think GUacame cant read the token
> that i am sending.
>
> Also another problem that i have is that i cant monitor the logs from the
> open id module in GUACAMOLE .
>
> I would really appreciate any suggestions for this issue. All threads that
> were found in the internet are ending in the same place that i am with this
> implementation.
>
>
A couple of things I can think of:
- Might try setting DEBUG logging for Guacamole client and see if anything
else useful is logged:
http://guacamole.apache.org/doc/gug/configuring-guacamole.html#webapp-logging
- The OpenID module only supports the Implicit Flow, and not the
Authentication (Basic) Flow. If Keycloak does not implement or accept the
Implicit Flow, but expects Authentication Flow, you may be hitting an issue
with that.
-Nick
Re: Guacamole-Keycloak OpenID Adaptation
Posted by .
On 2019/02/22 10:23:17, Nick Couchman <vn...@apache.org> wrote:
> >
> > So far when i am trying to access guacamole i am getting the login screen
> > of keycloak, so the open id Module seems to work fine.
> > When i enter the user's credential to keycloak and i press login, i get
> > into a redirect Loop. In this loop keycloak is trying to do a POST request
> > to Guacamole and i keep getting invalid login response.More specifically
> > the content of response is :
> >
> > ,\"expected\":[{\"name\":\"id_token\",\"type\":\"GUAC_OPENID_TOKEN\",\"authorizationURI\":\"
> > http://10.0.2.7:8080/auth/realms/nodejs-example/protocol/openid-connect/auth?scope=openid+profile&response_type=id_token&client_id=Guacamole&redirect_uri=http%3A%2F%2F10.0.2.6%3A8080%2Fguacamole%2F%23%2F&nonce=4797kjoq9jdccrgboupkpv9sau\
> > <http://10.0.2.7:8080/auth/realms/nodejs-example/protocol/openid-connect/auth?scope=openid+profile&response_type=id_token&client_id=Guacamole&redirect_uri=http%3A%2F%2F10.0.2.6%3A8080%2Fguacamole%2F%23%2F&nonce=4797kjoq9jdccrgboupkpv9sau%5C>
> > "}]
> >
> >
> This is a shot in the dark, so to speak, because I'm not very familiar with
> OpenId, but the POST might be your issue. IIRC, Guacamole expects the
> redirect to be a GET, not a POST, and this may be why you're seeing the
> redirect loop. Is it possible to configure Keycloak to use a GET redirect
> instead of POST?
>
>
> >
> > After reading a bit about guacamole i tried to send credentials with
> > different names using Keylcoak mappers and even changed the
> > openid-username-claim-type on guacamole properties but still i haven't
> > managed to solve this problem. Also, i don't know if the user must be in
> > Guacamole postgres Database before the login from OpenId
> >
> >
> >
> No, the user doesn't need to be present in order for the login to succeed,
> although the user will need to be present in order to assign permissions.
>
> -Nick
> Hi NIck,
Thanks for your answer. You were right it is not a POST request but a GET request that is coming from keycloak redirect, and it is bundled with the token that contains the necessary informations.
After seeing some Guacamole logs i am verifying that guacamole cant read the token that i am sending to it. I am using guacamole-auth-openid-1.0.0.jar module for the Open Id adaptation.
There are a few things that i tried like changing the preferred_username keycloak attribute to email using mappers in order to give the credentials to guacamole as it is asked but still i think GUacame cant read the token that i am sending.
Also another problem that i have is that i cant monitor the logs from the open id module in GUACAMOLE .
I would really appreciate any suggestions for this issue. All threads that were found in the internet are ending in the same place that i am with this implementation.
Thanks in advance,
Konstantinos
Re: Guacamole-Keycloak OpenID Adaptation
Posted by Nick Couchman <vn...@apache.org>.
>
> So far when i am trying to access guacamole i am getting the login screen
> of keycloak, so the open id Module seems to work fine.
> When i enter the user's credential to keycloak and i press login, i get
> into a redirect Loop. In this loop keycloak is trying to do a POST request
> to Guacamole and i keep getting invalid login response.More specifically
> the content of response is :
>
> ,\"expected\":[{\"name\":\"id_token\",\"type\":\"GUAC_OPENID_TOKEN\",\"authorizationURI\":\"
> http://10.0.2.7:8080/auth/realms/nodejs-example/protocol/openid-connect/auth?scope=openid+profile&response_type=id_token&client_id=Guacamole&redirect_uri=http%3A%2F%2F10.0.2.6%3A8080%2Fguacamole%2F%23%2F&nonce=4797kjoq9jdccrgboupkpv9sau\
> <http://10.0.2.7:8080/auth/realms/nodejs-example/protocol/openid-connect/auth?scope=openid+profile&response_type=id_token&client_id=Guacamole&redirect_uri=http%3A%2F%2F10.0.2.6%3A8080%2Fguacamole%2F%23%2F&nonce=4797kjoq9jdccrgboupkpv9sau%5C>
> "}]
>
>
This is a shot in the dark, so to speak, because I'm not very familiar with
OpenId, but the POST might be your issue. IIRC, Guacamole expects the
redirect to be a GET, not a POST, and this may be why you're seeing the
redirect loop. Is it possible to configure Keycloak to use a GET redirect
instead of POST?
>
> After reading a bit about guacamole i tried to send credentials with
> different names using Keylcoak mappers and even changed the
> openid-username-claim-type on guacamole properties but still i haven't
> managed to solve this problem. Also, i don't know if the user must be in
> Guacamole postgres Database before the login from OpenId
>
>
>
No, the user doesn't need to be present in order for the login to succeed,
although the user will need to be present in order to assign permissions.
-Nick