Gvmd.sock does not exist

Hi everyone,
i got gvm20.08 running on ubuntu20.04.
iI wanted to create a target via gvm-cli with gvm-cli socket --xml "<create_target><name>check_mk</name><hosts>"x.x.x.x"</hosts></create_target>" , i get the error Socket /var/run/gvmd.sock does not exist

gvmd.sock does exist, but in /opt/gvm/var/run/gvmd.sock.

this may sound dumb, but how can i tell gvm to look in another path to get this running?

best regards,
Yannick

gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock

image

The default can also be changed via the config file. Please take a look at the docs

Thank you for the quick reply.

i tried to change the socketpath, now i am getting a Typeerror in my cli.py
gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock Traceback (most recent call last): File "/opt/gvm/.local/bin/gvm-cli", line 8, in <module> sys.exit(main()) File "/opt/gvm/.local/lib/python3.8/site-packages/gvmtools/cli.py", line 106, in main if len(xml) == 0: TypeError: object of type 'NoneType' has no len()
is there something else i have to consider?

best regards

I used gvm-tools “dependabot/add-v2-config-file”, hope this one is correct since master branches should not be used.
i still can figure out why the python file gives me TypeError: object of type 'NoneType' has no len() , when i try to change the socketpath.

best regards,
Yannick

For Python the standard way to install software is using pip. You have selected a branch created from a GitHub bot for updating some dependencies. As you can image you shouldn’t do that.

Every git repository has a README.md file that contains advises for the installation. If you are not a developer please always follow these advises. See https://github.com/greenbone/gvm-tools#installation for the gvm-tools installation.

i did a new clean install of gvm-tools like its in the README.md
unfortunately i get the same error in the same line.

I installed all the GVM configuration files and libraries under /opt/gvm, so maybe i need to do a new setup of gvm20.08 without setting different paths?

Could you please paste the full command line you are using?

first i tried to define a target
gvm-cli socket --xml "<create_target><name>check_mk</name><hosts>"x.x.x.x"</hosts></create_target>"

got the error Socket /var/run/gvmd.sock does not exist .

you gave me a hint with gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock (path is correct),
but it returns me an error in cli.py line 106

right now i am setting up gvm20.08 again very carefully.

best regards,
Yannick

gvmd_sock

Hi,
so i did a new clean setup of gvm 20.08 and it works just fine. i can create targets and tasks and run scans via webgui, but still i cant create targets via cli.
it still says gvmd.sock does not exist, so i tried to change the socketpath like in the picture, but it drops the same error.

what can i do to get this running?

best regards,
yannick

That’s of course not a full command. You need to issue a xml command afterwards.

gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock --xml "<create_target><name>check_mk</name><hosts>"x.x.x.x"</hosts></create_target>"

Easiest is to just request the version as a test

gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock --xml "<get_version/>"

1 Like

ah okay, thank you.

Requesting the version gives me
<get_version_response status="200" status_text="OK"><version>20.08</version>/get_version_response> everythings good here.

If i try to create a target with the added xml command, it returns me :
gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock --xml "<create_target><name>check_mk</name><hosts>"149.201.14.25"</hosts></create_target>"

Response Error 400. Only command GET_VERSION is allowed before AUTHENTICATE

from this ouput i think i need to authenticate first with --gmp-username xy --gmp-password yx .

for example i tried gvm-cli --gmp-username xxyy --gmp-password yyxx socket --socketpath /opt/gvm/var/run/gvmd.sock --xml "<create_target><name>check_mk</name><hosts>"x.x.x.x"</hosts></create_target>"

which returned me the same error like above so the syntax must be completely wrong.

so i read the docs again and found this one
gvm-cli --gmp-username webadmin --gmp-password kennwort ssh \ --hostname 192.168.222.115 \ --xml "<create_target><name>Suspect Host</name>\ <hosts>$IPADDRESS</hosts></create_target>"

but it gives me SSH connection failed . Even i think SSH is working i think i still need to give the correct socket, but if i do so the syntax is incorrect.

best regards,
yannick

ahh of course no ssh nor tls is working, i didnt do the setup yet. i was just too excited finding a command which i can use for creating a target.

still, i am figuring out how the syntax could be

best regards