API Key Manager - Not able to add public key into the Vault
Symptom
We are using the API Key Manager to revoke the existing key and create a new key and subsequently upload the new key into the Vault. We are facing an issue while adding the public key. The error we are getting is " Status Code : 400. Response: {"ErrorCode":"CAWS00001E", "Error Message":"PASWS155E Operation Failed"."
The scanner service running as local system, however, no scan run, error out:
Failed to rotate key. Not Found
Communication with the PVWA server has succeeded
Key rotation request for user PasswordManager failed. Error: System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at CyberArk.Infra.BackendClient.Http.ApiPublicKeyUpdater.<UpdatePublicKey>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CyberArk.Infra.BackendClient.Security.KeyRotation.<SendRotateRequestAsync>d__20.MoveNext()
Environment
11.2 Privileged Access Manager (PAM, self-hosted) Central Policy Manager (CPM) Central Policy Manager (CPM) Windows Machine Auto-Detection
Cause
IIS setting for PVWA side,filtering request HTTP verbs for DELETE.
During ApiKeyManager revocation, it will perform a POST Auth and DELETE AppAuthenticationKeys. It should look something like below (
1.1.1.1 POST /passwordvault/api/auth/cyberark/logon - 443 - 11.1.1.1 - - 200 0 0 144
1.1.1.1 DELETE /passwordvault/api/AppAuthenticationKeys/PasswordManager29 - 443 - 1.1.1.1 - - 204 0 0 85
In problem enviroment, the DELETE AppAuthenticationKeys returns 404 instead of 204:
1.1.1.1 POST /PasswordVault/api/auth/cyberark/logon - 443 - 1.1.1.1 HTTP/1.1 - - 200 0 0 1174 200 482
1.1.1.1 DELETE /PasswordVault/api/AppAuthenticationKeys/PasswordManager - 443 - 1.1.1.1 HTTP/1.1 - - 404 6 0 644 346 8
Resolution
Open IIS Manager, expand sites, Under Default Web Site, select PasswordVault. On the right pane, select Request Filtering, under HTTP Verbs, remove any rules under it, should only have Verb Allowed. Follow by an IIS restart.