How to communicate with a remote Greenbone Community Containers server via TLSConnection

Hello, I install the Greenbone Community Containers 22.4 according to this wizard:Greenbone Community Containers 22.4 - Greenbone Community Documentation
I use docker-compose to pull Greenbone Community Containers 22.4, and open Greenbone Security Assistant in the browser successfully。
I want to use python combined with API(python-gvm) to get scan results and create new scan tasks. How to communicate with a remote Greenbone Community Containers server via TLSConnection, How to configure it on the server side. An error occurred when I used the following code

import gvm
from gvm.protocols.latest import Gmp
from gvm.transforms import EtreeTransform
from gvm.xml import pretty_print

connection =gvm.connections.TLSConnection(hostname='xxx.xxx.xxx.xxx', port='xxxx')
gmp = Gmp(connection)
gmp.authenticate('admin', 'admin')

# Retrieve current GMP version
version = gmp.get_version()

# Prints the XML in beautiful form
pretty_print(version)


error like this "FileNotFoundError: [Errno 2] No such file or directory".

My environment:vmware kali (Greenbone Community Containers 22.4)
windows10 (where python code runs)

I want to get the scan results through the python code in windows, what should I do.

I’ve written two sections for accessing gvmd via gvm-tools in our docs

If that doesn’t fit to your use case and you really want to use TLS you need to adjust the starting command of gvmd to use TLS instead of a unix socket. That requires generating TLS certs and putting them into the container. Personally I don’t know all the details about the setup and there is also no documentation at Greenbone side.

1 Like