Hi Russell, Nick, Team, Could you help to solve this issue? Probably the URL
is incorrect. Thank you in advance. I added some "echo" lines to see
output: ------------------------------------------ echo -e "TOKEN:
$TOKEN" echo -e "RESPONSE: $RESPONSE" echo -e
"IDENTIFIER: $IDENTIFIER" echo -e "Client Identifier:
$CLIENT_IDENTIFIER" This is my result now: -----------------------
TOKEN: C789F89578D3D7F7956307C26FD24410DEF12D4403495A9E2FBA43E31F92557D
RESPONSE: {"message":"Unexpected internal
error","translatableMessage":{"key":"APP.TEXT_UNTRANSLATED","variables":{"MESSAGE":"Unexpected
internal
error"}},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
IDENTIFIER: null Client Identifier: Error creating connection. Is is
correct now? It looks like the "RESPONSE" curl URL is invalid?! The
"permission denied" disappeared, but another error appeared. --
Best regards Marcin ------------------------------------------------- Dnia
11 lutego 2024 22:53 i.no...@wp.pl <i.no...@wp.pl> napisał(a): Hi
Russell, I have a .NET application that already uses bash scripts and I would
like to maintain this standard if possible. I checked provided GITHUB repo and
I see that some updates were very long ago and the Readme.md file is empty - no
documentation. Thank you for your help. -- Marcin
---------------------------------------------------------------------------
Dnia 11 lutego 2024 00:17 Russell Sayers <russell.say...@gmail.com>
napisał(a): Hi MK, Is Python an option for you? I’ve used this API wrapper
in the past: github.com https://github.com/pschmitt/guacapy Russ On Sun,
Feb 11, 2024 at 01:38 i.no...@wp.pl < i.no...@wp.pl > wrote: I
forgot to add the logs: DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected
error in REST endpoint. Feb 10 15:24:36 server[104645]:
java.lang.NullPointerException: null "POST
/guacamole/api/session/data/mysql/connections HTTP/1.1" 500 203
----------- Regards MK ---------------------------- Dnia 10 lutego 2024
15:27 i.no...@wp.pl < i.no...@wp.pl > napisał(a): Hi Nick, Thank
you for your response! I modified the script according to your information.
---------------------- SCRIPT ---------------------- #!/bin/bash # Obtain
the Guacamole authentication token TOKEN=$(curl -s -X POST -H
"Content-Type: application/x-www-form-urlencoded" -d
"username=guacadmin&password=guacadmin" localhost:8080
http://localhost:8080/guacamole/api/tokens | jq -r '.authToken') #
Define the API endpoint for creating connections in Guacamole
API_ENDPOINT=" localhost:8080
http://localhost:8080/guacamole/api/session/data/mysql/connections " #
Define the connection data in JSON format CONNECTION_DATA='{
"name": "Connection name", "protocol":
"rdp", "parameters": { "hostname":
"10.194.53.45", "port": "3389",
"username": "user", "password":
"password" } }' # Make a POST request to create a new
connection using the Guacamole API RESPONSE=$(curl -s -X POST -H
"Content-Type: application/json" -H "Guacamole-Token: $TOKEN"
-d "$CONNECTION_DATA" $API_ENDPOINT) # Extract the connection
identifier from the response IDENTIFIER=$(echo "$RESPONSE" | jq -r
'.identifier') if [ "$IDENTIFIER" != "null" ]; then
# Construct the base64url-encoded client identifier
CLIENT_IDENTIFIER=$(echo -n
"{\"id\":\"$IDENTIFIER\",\"type\":\"c\",\"dataSource\":\"mysql\"}"
| base64 -w0 | tr '+/' '-_' | tr -d '=') URL="
localhost:8080 http://localhost:8080/guacamole/#/client/$CLIENT_IDENTIFIER
" echo "Client Identifier: $CLIENT_IDENTIFIER" echo "URL:
$URL" else echo -e "TOKEN: $TOKEN" echo -e "RESPONSE:
$RESPONSE" echo -e "IDENTIFIER: $IDENTIFIER" echo -e
"Client Identifier: $CLIENT_IDENTIFIER" echo "Error creating
connection." fi ---------------------- SCRIPT END ----------------------
I added some "echo" lines to see output:
------------------------------------------ echo -e "TOKEN: $TOKEN"
echo -e "RESPONSE: $RESPONSE" echo -e "IDENTIFIER:
$IDENTIFIER" echo -e "Client Identifier: $CLIENT_IDENTIFIER"
This is my result now: ----------------------- TOKEN:
C789F89578D3D7F7956307C26FD24410DEF12D4403495A9E2FBA43E31F92557D RESPONSE:
{"message":"Unexpected internal
error","translatableMessage":{"key":"APP.TEXT_UNTRANSLATED","variables":{"MESSAGE":"Unexpected
internal
error"}},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
IDENTIFIER: null Client Identifier: Error creating connection. Is is
correct now? It looks like the "RESPONSE" curl URL is invalid?! The
"permission denied" disappeared, but another error appeared.
------------------------------------- Thank you for your help. -- MK
Dnia 09 lutego 2024 16:47 Nick Couchman < vn...@apache.org > napisał(a):
On Fri, Feb 9, 2024 at 6:46 AM i.no...@wp.pl < i.no...@wp.pl >
wrote: Hello, I've installed Apache Guacamole v.1.5.4 on Linux CentOS
8.5 - I'm able to login to GUI, create users, connection, etc. I
installed database (MySQL) as well (to manage users, connection) with all
needed *.jar files according to doc guacamole.apache.org
https://guacamole.apache.org/doc/gug/jdbc-auth.html After that, I'm able
to login as ""guacadmin" user to GUI and manage connections etc.
Now, I want to create URL to direct connection to my VM, but I found errors
like below: ------------------------------ SCRIPT
------------------------------------- #!/bin/bash TOKEN=$(curl -s -X POST
-H "Content-Type: application/x-www-form-urlencoded" -d
"username=guacadmin&password=guacadmin" localhost:8080
http://localhost:8080/guacamole/api/tokens | jq -r '.authToken') #
Endpoint API Guacamole API_ENDPOINT=" localhost:8080
http://localhost:8080/guacamole/api/session/data/mysql/connections "
CONNECTION_DATA='{ "name": "Connection name",
"protocol": "rdp", "parameters": {
"hostname": "10.194.53.45", "port":
"3389", "username": "user",
"password": "password" } }' RESPONSE=$(curl -s -X
POST -H "Content-Type: application/json" -H "Authorization: Bearer
$TOKEN" -d "$CONNECTION_DATA" $API_ENDPOINT) I don't think
you're using the correct header, here for the Guacamole authentication
token - you should be passing a header called "Guacamole-Token" with
the Guacamole authorization token. Guacamole does not generally use the
"Authorization" header. CONNECTION_ID=$(echo $RESPONSE | jq -r
'.identifier') if [ "$CONNECTION_ID" != "null" ];
then URL=" localhost:8080
http://localhost:8080/guacamole/#/client/$CONNECTION_ID?token=$TOKEN "
echo "Connection ID: $CONNECTION_ID" echo "URL: $URL" else
echo "Error creating connection." fi Two issues, here: *
We've removed the ?token= parameter in recent versions in favor of a model
that prefers/uses a header, instead, so you should leave off the token= part of
this. * Your path for the connection (/client/$CONNECTION_ID) won't work -
the client identifier is not the same as the connection ID, but is, instead, a
base 64 encoding of the type of connection (connection or connection group),
the data source (pgsql, mysql, etc.), and the connection identifier. See:
github.com
https://github.com/apache/guacamole-client/blob/22fe53fde50fd139cb86091912e1ae50d348add8/guacamole/src/main/frontend/src/app/navigation/types/ClientIdentifier.js#L40-L71
-Nick