You don't use the prefix.
This works for me on the node running slurmrestd on port 8081:
user=someuser
curl --header "X-SLURM-USER-NAME: ${user}" --header "X-SLURM-USER-TOKEN:
$(sudo scontrol toker username=${user}|cut -d='=' -f2-)"
http://localhost:8081/slurm/v0.0.36/ping
Brian Andrus
On 6/14/2021 7:03 AM, Heitor wrote:
Hello,
So far I've been unable to use slurmrestd. I'm running CentOS7 with slurm
20.11.7 from the EPEL7 repo.
I generate a token this way:
$ sudo scontrol token username=ubuntu
SLURM_JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjM2ODA2NjUsImlhdCI6MTYyMzY3ODg2NSwic3VuIjoidWJ1bnR1In0.bNIYye1YJ9jF15sJCljUhd6UQPlW1O9auxjMdUrAZ7M
(Should I use the token with or without the prefix "SLURM_JWT="? Or it does not
matter?)
I then copy the entire string and use curl to make a GET request to the
ping endpoint:
curl --request GET "$host":6820/slurm/v0.0.36/ping \
--location --silent --show-error \
--header "X-SLURM-USER-NAME: ubuntu" \
--header "X-SLURM-USER-TOKEN: $token"
And I get a 401 return with the message "Authentication Failure".
Running slurmrestd with -vvvvv i can see these messages in the log:
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug: parse_http:
[[valkyrien]:60348] Accepted HTTP connection
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug: _on_url:
[[valkyrien]:60348] url path: /slurm/v0.0.36/ping query: (null)
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug2: _on_header_value:
[[valkyrien]:60348] Header: Host Value: 10.220.130.45:6820
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug2: _on_header_value:
[[valkyrien]:60348] Header: User-Agent Value: curl/7.68.0
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug2: _on_header_value:
[[valkyrien]:60348] Header: Accept Value: */*
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug2: _on_header_value:
[[valkyrien]:60348] Header: X-SLURM-USER-NAME Value: ubuntu
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug2: _on_header_value:
[[valkyrien]:60348] Header: X-SLURM-USER-token Value:
SLURM_JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjM2NzcyOTcsImlhdCI6MTYyMzY3NTQ5Nywic3VuIjoidWJ1bnR1In0.ti4fK_mlw7UbQgJB3KGGOFdfuE_voj3TaUHR0ZXr_7U
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug3: _on_headers_complete:
[[valkyrien]:60348] HTTP/1.1 connection
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: operations_router:
[[valkyrien]:60348] GET /slurm/v0.0.36/ping
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug3: rest_auth/jwt:
slurm_rest_auth_p_authenticate: slurm_rest_auth_p_authenticate:
[[valkyrien]:60348] attempting user_name ubuntu token authentication
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug2:
_on_message_complete_request: [[valkyrien]:60348] on_http_request rejected:
Unspecified error
Jun 14 13:52:36 juju-9537f4-53 slurmrestd[2902]: debug4: parse_http:
[[valkyrien]:60348] parsed 295/295 bytes
What is this "unspecified error"?
I have the jwt auth plugin enabled in slurm.conf:
AuthAltTypes=auth/jwt
AuthAltParameters="jwt_key=/var/spool/slurmctld/jwt_hs256.key"
Munge is working and I can run jobs with srun/sbatch.
Am I missing something?
Cheers,
Heitor