Authentication Failed with gvm-cli (same creds work on the web UI)

I’m a bit new to GMP but have a heavy background in dev and integrations with APIs. However, I’m stumped on this one.

According to GitHub - greenbone/gvm-tools: Remote control your Greenbone Community Edition or Greenbone Enterprise Appliance, you can

Return all tasks visible to the GMP user with the provided credentials

by running:

gvm-cli --gmp-username foo --gmp-password bar socket --xml "<get_tasks/>"

obviously with foo and bar being replaced with their respective values. However, when I perform this exact same command with the “admin” user and the randomly generated password provided during the gvm-setup installation guide, it gives me an “Authentication Failed” error.

I can at least get a 200 OK without using –gmp-username and –gmp-password, but never with those arguments.

┌──(root💀ubuntu)-[~]
└─# gvm-cli socket --xml="<authenticate> <credentials><username>admin</username><password>[my-creds]</password> </credentials></authenticate>"
<authenticate_response status="200" status_text="OK"><role>Admin</role><timezone>UTC</timezone></authenticate_response>

I’m not quite sure why this is the case because the installation/configuration seems pretty straight forward and requires absolutely no input other than simply running the gvm-setup command and observing the output. I can login to the web interface using the exact same credentials. I’ve read the docs (https://gvm-tools.readthedocs.io/en/latest/) already but unfortunately they don’t actually provide a practical way of using gvm-cli. For example, the docs say you can run this:

gvm-cli socket --xml "<get_tasks/>"

and get a 200 OK, but that doesn’t appear to be the case – there are no creds provided in that example, and neither is an example provided of the default ~/.config/gvm-tools.conf file to understand why this command actually works.

I’m using GVM-21.4.0. and have confirmed that my setup installation is OK based on gvm-check-setup

I feel like this is a pretty basic, GMP 101 situation that I can’t figure out. What am I doing wrong here?

Hello there!

Sorry for your troubles. You were totally right, the gvm-cli did not work as expected (because I messed it up!).

I fixed the problem with this PR and you should be able to use gvm-cli as expected again with this release (even without gmp-credentials - you will be asked for them at runtime).

Thank you for reporting!

3 Likes

No problem at all and thanks for the help! Really appreciative for the python scripts because I was able to put together many parts of the example scripts to create a pretty nice script to control a lot of the functionality.

Thanks for the update as well!

2 Likes