Creating ssh credential issue using gvm-cli

Hi,

I’m experiencing an issue using gvm-cli to create ssh credentials.

My goal is to create a “username + ssh key”.

Below the command:

/opt/gvm/.local/bin/gvm-cli socket --xml "
<create_credential>
<name>toto</name>
<login>toto
<type>usk
<key>
<phrase>
<private>
-----BEGIN RSA PRIVATE KEY-----
[…]
-----END RSA PRIVATE KEY-----
</private>
</key>
</create_credential>"

The user is well created without error but when I try to use it, ssh connection doesn’t work.
I’ve noticed that public key generated is empty when I download it from Web interface in Configuration > Credentials > Download Public Key

The workaround I’ve found is to edit the user from Web interface and upload the private key file. Doing it, the public key is well created and I’m able to connect to targets.

But I’d like to create credentials automatically without manual action.

Technical informations:

GVM 20.08
gvm-cli 2.1.0 (API version 1.6.0)
Installation done from source builds
return of my command: <create_credential_response status=“201” status_text=“OK, resource created” id=“8d775f4e-479d-4356-af86-cd0736e03c82”/>

Thanks a lot for your help.

Hi,
unfortunately i cant help you solving your problem.
I just got curious reading your topic. For what use you want to upload your privatekey?
the private key is to authenticae yourself to where the public key is stored.
Or how should i interpret the option in “configuration->credentials”? its confusing me a little

Hi,

Thanks for your reply and sorry for my confusing explanation.

To resume, I wan to create ssh credential using gvm-cli.

The credentials are well created but the ssh connection for vulnerability scanning doesn’t work.

But when I connect to GVM Web interface, then go to configuration > credentials > edit previously created credentials.and reupload SSH private key and relauch scanning, the ssh connection works.

I hope that my explanation is more precise.

Seb.