# GSM-Appliance Connection with python-gvm in the Network

**URL:** <https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609>\
**Category:** Greenbone Enterprise\
**Created:** [March 10, 2021, 3:05pm UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609 "2021-03-10T15:05:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlorianBc](https://forum.greenbone.net/letter_avatar/florianbc/32/6_449c533f586939b6e5f246632a46421f.png) [@FlorianBc](https://forum.greenbone.net/u/FlorianBc)\
**Post date:** [March 10, 2021, 3:05pm UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609/1 "2021-03-10T15:05:58Z")

</div>

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:**  
**Code:**  
from gvm.connections import SSHConnection, TLSConnection, UnixSocketConnection  
from gvm.protocols.gmpv208 import Gmp

gmp\_obj = TLSConnection(hostname=“10.10.20.150”)  
with Gmp(connection=gmp\_obj) as gmpReady\_obj:  
gmpReady\_obj.authenticate(username=“webadmin”, password=“webadminpassword”)  
print(gmpReady\_obj.get\_version())

**Error:**  
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:**  
**Code:**  
from gvm.connections import SSHConnection, TLSConnection, UnixSocketConnection  
from gvm.protocols.gmpv208 import Gmp

gmp\_obj = SSHConnection(hostname=“10.10.20.150”, port=22, username=“admin”, password=“admin”)  
with Gmp(connection=gmp\_obj) as gmpReady\_obj:  
gmpReady\_obj.authenticate(username=“webadmin”, password=“webadmin”)  
print(gmpReady\_obj.get\_version())

**Error:**  
File “C:\Users\User\AppData\Roaming\Python\Python38\site-packages\paramiko\channel.py”, line 801, in send  
return self.\_send(s, m)  
File “C:\Users\User\AppData\Roaming\Python\Python38\site-packages\paramiko\channel.py”, 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](https://community.greenbone.net/uploads/default/original/2X/4/4037017b64d63201a3ab4f75bc36872e771abadf.png)

Deca-Version:  
20.08.7

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

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

Best Regards,

Florian

---

<div class="post-metadata">

**Author:** ![bricks](https://forum.greenbone.net/user_avatar/forum.greenbone.net/bricks/32/46_2.png) [@bricks](https://forum.greenbone.net/u/bricks)\
**Post date:** [March 10, 2021, 5:21pm UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609/2 "2021-03-10T17:21:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![FlorianBc](https://forum.greenbone.net/letter_avatar/florianbc/32/6_449c533f586939b6e5f246632a46421f.png) [@FlorianBc](https://forum.greenbone.net/u/FlorianBc)\
**Post date:** [March 11, 2021, 9:34am UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609/3 "2021-03-11T09:34:37Z")

</div>

Hi Bricks,

thank you for the answer!

Now the following Code is working:  
 ![image](https://community.greenbone.net/uploads/default/original/2X/8/807443f6cca3ee869f04f9f9e7dae3f14d74bcb8.png)

Maybe it’s would be good to mention that you don’t need to authenticate at the GSM-Appliance in the SSHConnection-Documentation:  
[https://python-gvm.readthedocs.io/en/latest/api/connections.html?highlight=connections#module-gvm.connections](https://python-gvm.readthedocs.io/en/latest/api/connections.html?highlight=connections#module-gvm.connections)

Or alternatively creating a new part in " Using the Greenbone Management Protocol" for python-gvm.  
[https://docs.greenbone.net/GSM-Manual/gos-20.08/en/gmp.html#using-the-greenbone-management-protocol](https://docs.greenbone.net/GSM-Manual/gos-20.08/en/gmp.html#using-the-greenbone-management-protocol)

Thank you again for your help!

Best Regards,

Florian

---

<div class="post-metadata">

**Author:** ![Iason](https://forum.greenbone.net/letter_avatar/iason/32/6_449c533f586939b6e5f246632a46421f.png) [@Iason](https://forum.greenbone.net/u/Iason)\
**Post date:** [June 30, 2021, 8:39am UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609/4 "2021-06-30T08:39:58Z")

</div>

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?  
BR,  
Iason

---

<div class="post-metadata">

**Author:** ![FlorianBc](https://forum.greenbone.net/letter_avatar/florianbc/32/6_449c533f586939b6e5f246632a46421f.png) [@FlorianBc](https://forum.greenbone.net/u/FlorianBc)\
**Post date:** [July 9, 2021, 8:49am UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609/5 "2021-07-09T08:49:21Z")

</div>

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!

BR

Florian

---

<div class="post-metadata">

**Author:** ![system](https://forum.greenbone.net/uploads/default/original/2X/4/4660e797edfaea797a8c9965246072ea26732804.png) [@system](https://forum.greenbone.net/u/system)\
**Post date:** [April 7, 2025, 10:09am UTC](https://forum.greenbone.net/t/gsm-appliance-connection-with-python-gvm-in-the-network/8609/6 "2025-04-07T10:09:29Z")

</div>

Closed on April 7, 2025, 10:09am UTC


