Rundeck API authentication question (version 4.9.0) – what am I doing wrong (note real values have been redacted).
I am trying to follow the instructions at https://docs.rundeck.com/docs/api/rundeck-api.html#password-authentication
$ curl -X POST --cookie-jar newcookies.txt http://HOST:POST/j_security_check&j_username=USER&j_password=PASSWORD
The user and password are the admin ones and are able to create tokens if I login to the GUI with them.
This writes out a Cookie value to newcookies.txt, and I then take the JSESSIONID and the cookie value and try and get a list of tokens
$ curl --cookie "JSESSIONID=valueofthecookie" -X GET -H "Content-Type: application/json" http://HOST:PORT/api/37/tokens
which returns
{"error":true,"apiversion":42,"errorCode":"unauthorized","message":"(unauthenticated) is not authorized for: /api/37/tokens"}
I have checked the above, using both the ansible uri module, as I want to provision a new token using IaC as using curl with the same results, but neither seem to work. Can anyone provide a worked example that does actually, so login and just list the tokens.
Thanks, Will.
Hi William,
Use preferably authentication tokens, instead login/passwd
Example :
$ export token='<yourtoken>
$ curl -m10 -sX "GET" -H "Accept: application/json" -H
"X-Rundeck-Auth-Token: $token"
"http://rundeck:4440/api/41/metrics/healthcheck" | jq -C
gives you
{
"dataSource.connection.time": {
"healthy": true,
"message": "Datasource connection healthy with timeout 5
seconds",
"duration": 2,
"timestamp": "2023-01-25T13:40:19.197+01:00"
},
"quartz.scheduler.threadPool": {
"healthy": true,
"duration": 0,
"timestamp": "2023-01-25T13:40:19.194+01:00"
}
}
--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/bae0b2e3-1729-4554-a34c-c0edc246d039n%40googlegroups.com.
-- Xavier Humbert CRT Supervision et Exploitation de Niveau 1 Rectorat de Nancy-Metz 03 83 86 27 39