Issues with gvm-cli and <create_credential>

Hello,

I’m trying to migrate from omp to gvm-cli and I’m having the following problem when trying to create a credential which uses a private key to authenticate via SSH:

When I use omp:
omp -u vw -w XXXX -h localhost -p 9390 --pretty-print --xml '<create_credential><name>test</name><login>admin</login><key><private>-----BEGIN RSA PRIVATE KEY----- Private key from id_rsa here -----END RSA PRIVATE KEY-----</private></key></create_credential>'

I get the following response:
<create_credential_response id="b3a5ea03-40af-462c-a91e-39beeea51592" status_text="OK, resource created" status="201"></create_credential_response>

However, when I use gvm-cli:
gvm-cli tls --gmp-username vw --gmp-password XXXX --host localhost --port 9390 --xml '<create_credential><name>test</name><login>admin</login><key><private>-----BEGIN RSA PRIVATE KEY----- Private key from id_rsa here -----END RSA PRIVATE KEY-----</private></key></create_credential>'

I get the following response:
('Error in response. Erroneous private key or associated passphrase', <Element create_credential_response at 0x7fdf875c3dc8>)

Can anyone please tell me how can I create a credential with gvm-cli which uses a rsa key ?

OMP v 1.4.5
gvm-cli 2.0.0.beta1. API version 1.0.0.beta2

This is a general problem in gvm-cli with anything that contains newlines.

There already is a fix for this in our GitHub repository (see https://github.com/greenbone/gvm-tools/pull/141), which will also eventually be included in the next release.

1 Like