GSM-Appliance Connection with python-gvm in the Network

Dear Greenbone-Community,

I have searched for the answer, but I was not able to retrieve the information how to use a GSM-Appliance with python-gvm.

What is the problem?
I have some expirience with GSM in the OpenSource edition and I was able to use the API with a connection established via UnixSocketConnection. When I try to use the Module SSHConnection or TLSConnection, our GSM Deca Appliance will respond with an error-message.

My try with TLSConnection:
from gvm.connections import SSHConnection, TLSConnection, UnixSocketConnection
from gvm.protocols.gmpv208 import Gmp

gmp_obj = TLSConnection(hostname=“”)
with Gmp(connection=gmp_obj) as gmpReady_obj:
gmpReady_obj.authenticate(username=“webadmin”, password=“webadminpassword”)

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed
to respond

My try with SSH:
from gvm.connections import SSHConnection, TLSConnection, UnixSocketConnection
from gvm.protocols.gmpv208 import Gmp

gmp_obj = SSHConnection(hostname=“”, port=22, username=“admin”, password=“admin”)
with Gmp(connection=gmp_obj) as gmpReady_obj:
gmpReady_obj.authenticate(username=“webadmin”, password=“webadmin”)

File “C:\Users\User\AppData\Roaming\Python\Python38\site-packages\paramiko\”, line 801, in send
return self._send(s, m)
File “C:\Users\User\AppData\Roaming\Python\Python38\site-packages\paramiko\”, line 1198, in _send
raise socket.error(“Socket is closed”)
OSError: Socket is closed

(Error message shortened)

GMP is activated on the Deca-Appliance:
2021-03-10 15_41_36-Window


Python-gvm version:
Name: python-gvm
Version: 21.1.3

I would be happy if you could help me with this!

Best Regards,


Hi first of all maybe it is easier to write a gmp script then a full application. You should definitely take a look at our gvm-tools. Besides that just create an ssh connection instance without username, password and port. python-gvm uses the necessary defaults for a GSM. TLS is not possible. Since GOS 4 you need to use SSH. Please also don’t forget to activate the remote gmp access in the GOS admin menu.


Hi Bricks,

thank you for the answer!

Now the following Code is working:

Maybe it’s would be good to mention that you don’t need to authenticate at the GSM-Appliance in the SSHConnection-Documentation:

Or alternatively creating a new part in " Using the Greenbone Management Protocol" for python-gvm.

Thank you again for your help!

Best Regards,


1 Like

HI @FlorianBc thank you for sharing your solution. Quick question, how did you deploy the GSM Applicance? is your python runtime on the same host as the GSM?

Hi @Iason ,

sorry for the late response I was in my vaccation.
The GSM appliance that I used is a virtualized system from Greenbone. The picture that I shared in my question was from the commercial system. I did not used the Community version. The Python runtime was on my own Windows 10 Client, that’s the reason why I asked about the SSH connection.

BUT I also used the OpenSource version from GSM before with the Python runtime installed on the same system (Ubuntu Server). The code that I used was basically this, If I remember this correctly. You can use methods like “delete_task” with “gmpReady_obj”.

Maybe you have to make some configuration more on the system itself to establish the connection.
from gvm.connections import UnixSocketConnection
from gvm.protocols.gmpv9 import Gmp, AssetType

gmpConnection_obj = UnixSocketConnection(path=parser.get(“GMSP SOCKET LOCATION”))
with Gmp(connection=gmpConnection_obj) as gmpReady_obj:
gmpReady_obj.authenticate(username=USERNAME, password=PASSWORD)

I hope this helps!