uploading SSH keys via REST API (format issues)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

uploading SSH keys via REST API (format issues)

L2 Linker

I'm trying to upload SSH keys vie REST API, but I don't know how to "build" the secret.

I have a working private key in a typical format:

-----BEGIN OPENSSH PRIVATE KEY-----

AAAAA

BBBB

CCCC

.....

-----END OPENSSH PRIVATE KEY-----

 

This can't be uploaded. In following format "-----BEGIN OPENSSH PRIVATE KEY----- AAAAA BBBB CCCC .....-----END OPENSSH PRIVATE KEY-----" it can be uploaded, but CyberArk is not "understanding" that format anymore

CACPM690E Error occurred during SSH key rotate operation. Error: CACPM688E PuttyGen execution failed. Reason: puttygen: error loading `.\tmp\keygen_in-KEY_MGR_DSS_AIX-TestSafe3-Root-test_stefanaixdsa-02-01-21 14-01-42.tmp': unrecognised key type

When I upload the key in PVWA, i get the information: "Leading/trailing white space character(s) were identified in the password, these characters will be automatically removed." a simple TRIM function is not helping. I asssume that I have to handle the line brakes in the string somehow. Does someone have experience with that?

 

1 accepted solution

Accepted Solutions

L2 Linker

for anyone who is interested:

$bodysecret = Get-Content $templatefile.secret 

 $bodysecret=$bodysecret | out-string

is working for me.

 

View solution in original post

5 REPLIES 5

L7 Applicator

CyberArk currently only understands SSH keys in PEM format. You are uploading a key in OpenSSH format. Convert it (or just recreate it using "ssh-keygen -m pem ....") and try again.

thanks for your input. I have exactly the same behavior with the pem format.

L2 Linker

for anyone who is interested:

$bodysecret = Get-Content $templatefile.secret 

 $bodysecret=$bodysecret | out-string

is working for me.

 

L3 Networker

Hi @St H​  I have the exact same problem I dont quite understand how you managed to solve it

"for anyone who is interested:

$bodysecret = Get-Content $templatefile.secret 

 $bodysecret=$bodysecret | out-string

is working for me."

 

what do you mean by that?

Thank you 🙂

Hi, already 2 years ago 😄

In my opinion the issue is the format of the secret. I had a csv file with a list of SSH keys accounts (imported to $templatefile).

1) I extracted the value for the key listed in column secret

2) I used the Out-String cmdlet to convert the input object into strings

  • 1 accepted solution
  • 1707 Views
  • 5 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!