curl -X POST -d 'username=MYUSERNAME&password=MYPASSWORD' http://localhost:8080/guacamole/api/tokens
output
{
"authToken": "C90FE11682EE3A8CCA339F1135FF02D0A97CDDDE440A970B559D005517BE6EA8",
"username": "guacadmin",
"dataSource": "postgresql",
"availableDataSources": [
"postgresql",
"postgresql-shared"
]
}
- Get connections list
curl 'http://localhost:8080/guacamole/api/session/data/postgresql/connections?token=<TOKEN>'| jq
output
{
"1": {
"name": "win",
"identifier": "1",
"parentIdentifier": "ROOT",
"protocol": "rdp",
"attributes": {
"guacd-encryption": null,
"failover-only": null,
"weight": null,
"max-connections": null,
"guacd-hostname": null,
"guacd-port": null,
"max-connections-per-user": null
},
"activeConnections": 0,
"lastActive": 1591774964770
},
"2": {
"name": "win1",
"identifier": "2",
"parentIdentifier": "ROOT",
"protocol": "rdp",
"attributes": {
"guacd-encryption": null,
"failover-only": null,
"weight": null,
"max-connections": null,
"guacd-hostname": null,
"guacd-port": null,
"max-connections-per-user": null
},
"activeConnections": 1,
"lastActive": 1591774407688
}
}
Notes (link):
The necessary information is indeed there - you just need to know how to generate the URL. The base64 bit after ".../guacamole/client/" in the URL of a connection is built from the following information:
- The connection identifier (in MySQL / PostgreSQL, this will be the connection ID)
- The type ("c" for connections and "g" for balancing groups)
- The identifier of the auth provider storing the connection data (usually "postgresql", "mysql", or "ldap" - in your case the correct value would be "mysql")
Each of these components separated from the other by a single NULL character (U+0000), with the resulting string encoded with base64.
- Encode string
printf '2\0c\0postgresql' | base64
output
MgBjAHBvc3RncmVzcWw=
- URL
https://localhost:8080/guacamole/#/client/MgBjAHBvc3RncmVzcWw=
oh thank you for this!!!