#Unable to add publickey authentication type to admin user via REST API

1 messages · Page 1 of 1 (latest)

thorn warren
#

When i try to add publickey as one of the authentication type for cluster admin user, i am getting "duplicate entry" error. Below is the payload

{
"applications": [
{
"application": "ssh",
"authentication_methods": ["publickey"],
"second_authentication_method": "none"
}
],
"name": "admin",
"owner": {
"name": "cluster01"
},
"role": {
"name": "admin"
}
}

Below is the response

{
"error": {
"message": "duplicate entry",
"code": "1",
"target": "name"
}
}

Attached screenshot shows the current authentication method for admin user. publickey type authentication does not exist. Any idea why ONTAP is throwing duplicate entry error when its clear that publickey type auth method doesnot exist?

calm quest
#

It looks like an entry for admin exists. Are you POSTing or PATCHing?

#

Be aware, that PATCHing will OVERWRITE admin --> SSH --> primary auth --> password with admin --> SSH--> primary auth --> key. I personally would patch the key into secondary auth then confirm with tests then maybe set it as primary, disabling the password for SSH. Be sure you have console access before making these adjustments. 😬

thorn warren
#

I am POSTting the payload ASSUMING that, it will add new entry... it looks like i need to perform PATCH operation.. thank you @calm quest for quick response..

calm quest
#

Sure thing! Don't get locked out!