You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by "i.noska@wp.pl" <i....@wp.pl> on 2023/06/26 17:54:33 UTC

Apache Guacamole API (URL generation) - ERORR

Hello Team,   I need your help. I have installed Apache Guacamole, and everything is working fine. I used Docker images for the installation. Now, I want to utilize the Guacamole API to generate a connection link (URL) to any virtual machine in my environment. I don&#39;t want to use the Apache Guacamole GUI; instead, I want the link to be generated based on the data I provide. I&#39;m attaching my code and the error I&#39;m receiving.    Please help me identify the issue. What is wrong? what is missing?  Thank you in advance!    ------------------------------------- MY CODE --------------------------   import   requests   guacamole_server   =   &#39; localhost:80 http://localhost:80/guacamole &#39;  guacamole_username   =   &#39;test&#39;  guacamole_password   =   &#39;Test123!&#39;   # Log in and generate token  login_url   =   f &#34; { guacamole_server } /api/tokens&#34;  response   =   requests . post ( login_url ,  data = { &#39;username&#39; :  guacamole_username ,  &#39;password&#39; :  guacamole_password })   if   response . status_code   ==   200 :       token   =   response . json ()[ &#39;authToken&#39; ]  else :       print ( &#34;Error log in to Guacamole!&#34; )       exit ()   # Create a new connection  data_source   =   &#39;mysql&#39;       create_connection_url   =   f &#34; { guacamole_server } /api/session/data/ { data_source } /connections&#34;   headers   =  {       &#39;Content-Type&#39; :  &#39;application/json&#39; ,       &#39;Authorization&#39; :  f &#39;Bearer  { token } &#39; ,       &#39;Guacamole-Token&#39; :  token ,  }   connection_data   =  {       &#39;name&#39; :  &#39;New connection&#39; ,   # Name of the new connection       &#39;protocol&#39; :  &#39;ssh&#39; ,   # Protocol, np. ssh       &#39;parameters&#39; : {           &#39;hostname&#39; :  &#39;10.1.1.11&#39; ,   # Remote IP address (ssh: linux)           &#39;port&#39; :  22 ,   # Port number           &#39;username&#39; :  &#39;root&#39; ,   # User name           &#39;password&#39; :  &#39;password&#39;    # Password      }  }   response   =   requests . post ( create_connection_url ,  headers = headers ,  json = connection_data )   if   response . status_code   ==   200 :       connection_id   =   response . json ()[ &#39;id&#39; ]       print ( &#34;The new connection has been created. ID:&#34; ,  connection_id )  else :       print ( &#34;Error occurred: the connection was not created!&#34; ,  response . text )     ERROR  Error occurred: the connection was not created: {&#34;message&#34;:&#34;Unexpected internal error&#34;,&#34;translatableMessage&#34;:{&#34;key&#34;:&#34;APP.TEXT_UNTRANSLATED&#34;,&#34;variables&#34;:{&#34;MESSAGE&#34;:&#34;Unexpected internal error&#34;}},&#34;statusCode&#34;:null,&#34;expected&#34;:null,&#34;type&#34;:&#34;INTERNAL_ERROR&#34;}   ----------------------------- Thank you in advance.   
     
      
       
        Dnia 26 czerwca 2023 15:06 Nick Couchman &lt;vnick@apache.org&gt; napisał(a):
       
    
       
         On Mon, Jun 26, 2023 at 7:21 AM Eby Mani &lt;eby_km@yahoo.com.invalid&gt; wrote: 
 
  
 Hello Mike, 
  
 Many thanks, there are few java based 2fa email projects on github, is there a how to guide/documentation on adapting these for guacamole-ext ?. 
 
  
 The best place to start would be the following, which covers 
 guacamole-ext and how to build an extension. It doesn&#39;t necessarily 
 cover the specifics of &#34;Authentication system xyz exists on github, 
 here&#39;s how you plug it into Guacamole&#34; - it&#39;s more a general reference 
 on the guacamole-ext framework. 
  
 guacamole.apache.org https://guacamole.apache.org/doc/gug/guacamole-ext.html 
  
 If it&#39;s something you&#39;re interested in doing, and contributing to the 
 community, I&#39;d suggest that you request a Jira account and create an 
 issue to track it, and then submit a pull request so that the changes 
 can be reviewed and merged. 
  
 -Nick 
  
 --------------------------------------------------------------------- 
 To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org 
 For additional commands, e-mail: user-help@guacamole.apache.org

Re: Apache Guacamole API (URL generation) - ERORR

Posted by "i.noska@wp.pl" <i....@wp.pl>.
Hello Team,   Could you help me?    Thank you in advance!  
     
      
       
        Dnia 27 czerwca 2023 12:06 i.noska@wp.pl &lt;i.noska@wp.pl&gt; napisał(a):
       
    
       
         Hello Sean,   Thank you for your response! Ok, I will try do this.   Could you confirm that the code is correct, but only the extension is missing?   Is it possible to add it to docker image?   I tired install Apache Guacamole without docker images, but I didn&#39;t find a good instruction regarding &#34;correct configuration&#34;. If you are able to share any doc? it would be great!   Thank you in advance!   --  Irek  ============================ Dnia 26 czerwca 2023 21:06 Sean Hulbert &lt;  shulbert@securitycentric.net.INVALID &gt; napisał(a):  Hello   Sounds like you want guacamole-auth-quickconnect-1.x.x.tar  guacamole.apache.org https://guacamole.apache.org/doc/gug/adhoc-connections.html  Hope this helps, also you get better response with NGINX [in my
      opinion]    Thank You  Sean Hulbert     On 6/26/2023 10:54 AM,   i.noska@wp.pl  wrote:  Hello Team,  I need your help. I have installed Apache Guacamole, and
        everything is working fine. I used Docker images for the
        installation. Now, I want to utilize the Guacamole API to
        generate a connection link (URL) to any virtual machine in my
        environment. I don&#39;t want to use the Apache Guacamole GUI;
        instead, I want the link to be generated based on the data I
        provide. I&#39;m attaching my code and the error I&#39;m receiving.   Please help me identify the issue. What is wrong? what is
        missing?  Thank you in advance!   ------------------------------------- MY CODE
          --------------------------  import   requests   guacamole_server   =   &#39; localhost:80 http://localhost:80/guacamole &#39;  guacamole_username   =   &#39;test&#39;  guacamole_password   =   &#39;Test123!&#39;   # Log in and generate token  login_url   =   f &#34; { guacamole_server } /api/tokens&#34;  response   =   requests . post ( login_url ,  data = { &#39;username&#39; :  guacamole_username ,  &#39;password&#39; :  guacamole_password })   if   response . status_code   ==   200 :       token   =   response . json ()[ &#39;authToken&#39; ]  else :       print ( &#34;Error log in to Guacamole!&#34; )       exit ()   # Create a new connection  data_source   =   &#39;mysql&#39;      create_connection_url   =   f &#34; { guacamole_server } /api/session/data/ { data_source } /connections&#34;   headers   =  {       &#39;Content-Type&#39; :  &#39;application/json&#39; ,       &#39;Authorization&#39; :  f &#39;Bearer  { token } &#39; ,       &#39;Guacamole-Token&#39; :  token ,  }   connection_data   =  {       &#39;name&#39; :  &#39;New connection&#39; ,   # Name of the new connection       &#39;protocol&#39; :  &#39;ssh&#39; ,   # Protocol, np. ssh       &#39;parameters&#39; : {           &#39;hostname&#39; :  &#39;10.1.1.11&#39; ,   # Remote IP address (ssh: linux)           &#39;port&#39; :  22 ,   # Port number           &#39;username&#39; :  &#39;root&#39; ,   # User name           &#39;password&#39; :  &#39;password&#39;    # Password      }  }   response   =   requests . post ( create_connection_url ,  headers = headers ,  json = connection_data )   if   response . status_code   ==   200 :       connection_id   =   response . json ()[ &#39;id&#39; ]       print ( &#34;The new connection has been created. ID:&#34; ,  connection_id )  else :       print ( &#34;Error occurred: the connection was not created!&#34; ,  response . text )    ERROR  Error occurred:
          the connection was not created: {&#34;message&#34;:&#34;Unexpected
          internal
error&#34;,&#34;translatableMessage&#34;:{&#34;key&#34;:&#34;APP.TEXT_UNTRANSLATED&#34;,&#34;variables&#34;:{&#34;MESSAGE&#34;:&#34;Unexpected
          internal
          error&#34;}},&#34;statusCode&#34;:null,&#34;expected&#34;:null,&#34;type&#34;:&#34;INTERNAL_ERROR&#34;}  -----------------------------  Thank you in advance.  Dnia 26 czerwca 2023 15:06 Nick Couchman   &lt;vnick@apache.org&gt;  napisał(a):  On Mon, Jun 26, 2023 at 7:21 AM Eby Mani   &lt;eby_km@yahoo.com.invalid&gt;  wrote:  Hello Mike,  Many thanks, there are few java based 2fa email
                projects on github, is there a how to
                guide/documentation on adapting these for guacamole-ext
                ?.  The best place to start would be the following, which
              covers  guacamole-ext and how to build an extension. It doesn&#39;t
              necessarily  cover the specifics of &#34;Authentication system xyz
              exists on github,  here&#39;s how you plug it into Guacamole&#34; - it&#39;s more a
              general reference  on the guacamole-ext framework.  guacamole.apache.org https://guacamole.apache.org/doc/gug/guacamole-ext.html  If it&#39;s something you&#39;re interested in doing, and
              contributing to the  community, I&#39;d suggest that you request a Jira account
              and create an  issue to track it, and then submit a pull request so
              that the changes  can be reviewed and merged.  -Nick  ---------------------------------------------------------------------  To unsubscribe, e-mail:   user-unsubscribe@guacamole.apache.org  For additional commands, e-mail:   user-help@guacamole.apache.org

Odp: Re: Apache Guacamole API (URL generation) - ERORR

Posted by "i.noska@wp.pl" <i....@wp.pl>.
Hello Sean,   Thank you for your response! Ok, I will try do this.   Could you confirm that the code is correct, but only the extension is missing?   Is it possible to add it to docker image?   I tired install Apache Guacamole without docker images, but I didn&#39;t find a good instruction regarding &#34;correct configuration&#34;. If you are able to share any doc? it would be great!   Thank you in advance!   --  Irek  ============================ Dnia 26 czerwca 2023 21:06 Sean Hulbert &lt;  shulbert@securitycentric.net.INVALID &gt; napisał(a):  Hello   Sounds like you want guacamole-auth-quickconnect-1.x.x.tar  guacamole.apache.org https://guacamole.apache.org/doc/gug/adhoc-connections.html  Hope this helps, also you get better response with NGINX [in my
      opinion]    Thank You  Sean Hulbert     On 6/26/2023 10:54 AM,   i.noska@wp.pl  wrote:  Hello Team,  I need your help. I have installed Apache Guacamole, and
        everything is working fine. I used Docker images for the
        installation. Now, I want to utilize the Guacamole API to
        generate a connection link (URL) to any virtual machine in my
        environment. I don&#39;t want to use the Apache Guacamole GUI;
        instead, I want the link to be generated based on the data I
        provide. I&#39;m attaching my code and the error I&#39;m receiving.   Please help me identify the issue. What is wrong? what is
        missing?  Thank you in advance!   ------------------------------------- MY CODE
          --------------------------  import   requests   guacamole_server   =   &#39; localhost:80 http://localhost:80/guacamole &#39;  guacamole_username   =   &#39;test&#39;  guacamole_password   =   &#39;Test123!&#39;   # Log in and generate token  login_url   =   f &#34; { guacamole_server } /api/tokens&#34;  response   =   requests . post ( login_url ,  data = { &#39;username&#39; :  guacamole_username ,  &#39;password&#39; :  guacamole_password })   if   response . status_code   ==   200 :       token   =   response . json ()[ &#39;authToken&#39; ]  else :       print ( &#34;Error log in to Guacamole!&#34; )       exit ()   # Create a new connection  data_source   =   &#39;mysql&#39;      create_connection_url   =   f &#34; { guacamole_server } /api/session/data/ { data_source } /connections&#34;   headers   =  {       &#39;Content-Type&#39; :  &#39;application/json&#39; ,       &#39;Authorization&#39; :  f &#39;Bearer  { token } &#39; ,       &#39;Guacamole-Token&#39; :  token ,  }   connection_data   =  {       &#39;name&#39; :  &#39;New connection&#39; ,   # Name of the new connection       &#39;protocol&#39; :  &#39;ssh&#39; ,   # Protocol, np. ssh       &#39;parameters&#39; : {           &#39;hostname&#39; :  &#39;10.1.1.11&#39; ,   # Remote IP address (ssh: linux)           &#39;port&#39; :  22 ,   # Port number           &#39;username&#39; :  &#39;root&#39; ,   # User name           &#39;password&#39; :  &#39;password&#39;    # Password      }  }   response   =   requests . post ( create_connection_url ,  headers = headers ,  json = connection_data )   if   response . status_code   ==   200 :       connection_id   =   response . json ()[ &#39;id&#39; ]       print ( &#34;The new connection has been created. ID:&#34; ,  connection_id )  else :       print ( &#34;Error occurred: the connection was not created!&#34; ,  response . text )    ERROR  Error occurred:
          the connection was not created: {&#34;message&#34;:&#34;Unexpected
          internal
error&#34;,&#34;translatableMessage&#34;:{&#34;key&#34;:&#34;APP.TEXT_UNTRANSLATED&#34;,&#34;variables&#34;:{&#34;MESSAGE&#34;:&#34;Unexpected
          internal
          error&#34;}},&#34;statusCode&#34;:null,&#34;expected&#34;:null,&#34;type&#34;:&#34;INTERNAL_ERROR&#34;}  -----------------------------  Thank you in advance.  Dnia 26 czerwca 2023 15:06 Nick Couchman   &lt;vnick@apache.org&gt;  napisał(a):  On Mon, Jun 26, 2023 at 7:21 AM Eby Mani   &lt;eby_km@yahoo.com.invalid&gt;  wrote:  Hello Mike,  Many thanks, there are few java based 2fa email
                projects on github, is there a how to
                guide/documentation on adapting these for guacamole-ext
                ?.  The best place to start would be the following, which
              covers  guacamole-ext and how to build an extension. It doesn&#39;t
              necessarily  cover the specifics of &#34;Authentication system xyz
              exists on github,  here&#39;s how you plug it into Guacamole&#34; - it&#39;s more a
              general reference  on the guacamole-ext framework.  guacamole.apache.org https://guacamole.apache.org/doc/gug/guacamole-ext.html  If it&#39;s something you&#39;re interested in doing, and
              contributing to the  community, I&#39;d suggest that you request a Jira account
              and create an  issue to track it, and then submit a pull request so
              that the changes  can be reviewed and merged.  -Nick  ---------------------------------------------------------------------  To unsubscribe, e-mail:   user-unsubscribe@guacamole.apache.org  For additional commands, e-mail:   user-help@guacamole.apache.org

Re: Apache Guacamole API (URL generation) - ERORR

Posted by Sean Hulbert <sh...@securitycentric.net.INVALID>.
Hello


Sounds like you want guacamole-auth-quickconnect-1.x.x.tar 
https://guacamole.apache.org/doc/gug/adhoc-connections.html

Hope this helps, also you get better response with NGINX [in my opinion]


*Thank You*
Sean Hulbert
**


On 6/26/2023 10:54 AM, i.noska@wp.pl wrote:
> Hello Team,
>
> I need your help. I have installed Apache Guacamole, and everything is 
> working fine. I used Docker images for the installation. Now, I want 
> to utilize the Guacamole API to generate a connection link (URL) to 
> any virtual machine in my environment. I don't want to use the Apache 
> Guacamole GUI; instead, I want the link to be generated based on the 
> data I provide. I'm attaching my code and the error I'm receiving.
>
> Please help me identify the issue. What is wrong? what is missing?
>
> Thank you in advance!
>
> *------------------------------------- MY CODE --------------------------*
>
> importrequests
> guacamole_server='http://localhost:80/guacamole 
> <http://localhost:80/guacamole>'
> guacamole_username='test'
> guacamole_password='Test123!'
> # Log in and generate token
> login_url=f"{guacamole_server}/api/tokens"
> response=requests.post(login_url, data={'username': 
> guacamole_username, 'password': guacamole_password})
> ifresponse.status_code==200:
> token=response.json()['authToken']
> else:
> print("Error log in to Guacamole!")
> exit()
> # Create a new connection
> data_source='mysql'
> create_connection_url=f"{guacamole_server}/api/session/data/{data_source}/connections" 
>
> headers={
> 'Content-Type': 'application/json',
> 'Authorization': f'Bearer {token}',
> 'Guacamole-Token': token,
> }
> connection_data={
> 'name': 'New connection', # Name of the new connection
> 'protocol': 'ssh', # Protocol, np. ssh
> 'parameters': {
> 'hostname': '10.1.1.11', # Remote IP address (ssh: linux)
> 'port': 22, # Port number
> 'username': 'root', # User name
> 'password': 'password'# Password
>     }
> }
> response=requests.post(create_connection_url, headers=headers, 
> json=connection_data)
> ifresponse.status_code==200:
> connection_id=response.json()['id']
> print("The new connection has been created. ID:", connection_id)
> else:
> print("Error occurred: the connection was not created!", response.text)
>
> *ERROR*
> Error occurred: the connection was not created: {"message":"Unexpected 
> internal 
> error","translatableMessage":{"key":"APP.TEXT_UNTRANSLATED","variables":{"MESSAGE":"Unexpected 
> internal 
> error"}},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
>
> -----------------------------
> Thank you in advance.
>
> Dnia 26 czerwca 2023 15:06 Nick Couchman <vn...@apache.org> napisał(a):
>
>     On Mon, Jun 26, 2023 at 7:21 AM Eby Mani
>     <eb...@yahoo.com.invalid> wrote:
>
>
>         Hello Mike,
>
>         Many thanks, there are few java based 2fa email projects on
>         github, is there a how to guide/documentation on adapting
>         these for guacamole-ext ?.
>
>
>     The best place to start would be the following, which covers
>     guacamole-ext and how to build an extension. It doesn't necessarily
>     cover the specifics of "Authentication system xyz exists on github,
>     here's how you plug it into Guacamole" - it's more a general reference
>     on the guacamole-ext framework.
>
>     https://guacamole.apache.org/doc/gug/guacamole-ext.html
>
>     If it's something you're interested in doing, and contributing to the
>     community, I'd suggest that you request a Jira account and create an
>     issue to track it, and then submit a pull request so that the changes
>     can be reviewed and merged.
>
>     -Nick
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
>     For additional commands, e-mail: user-help@guacamole.apache.org
>