SSL Connection Error when trying to connect to OpenVAS API in Docker environment

Hello,

I’m encountering an SSL-related error while attempting to connect to the OpenVAS API using Python and the gvm-tools library. I’m running OpenVAS in a Docker container.

Environment:

  • OpenVAS: Running in Docker container
  • Python script: Using gvm-tools library to connect to OpenVAS API

Error message:

[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)
(<class 'ssl.SSLEOFError'>, SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)'), <traceback object at 0x7f1bd1219100>)

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='localhost', port=9392)
gmp = Gmp(connection)
gmp.authenticate('admin', 'admin')

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

# Prints the XML in beautiful form
pretty_print(version)

What I’ve tried:

  • Verified that the OpenVAS container is running
  • Checked the IP address and port for the connection
  • Ensured that the credentials are correct

Questions:

  1. Has anyone encountered a similar SSL error when connecting to OpenVAS in a Docker environment?
  2. Are there any specific configurations needed for the Docker container to allow SSL connections?
  3. Could this be related to how the certificates are set up in the Docker environment?
  4. Are there any known compatibility issues between the latest gvm-tools and the Docker version of OpenVAS?

Any insights or suggestions would be greatly appreciated. Thank you in advance for your help!

Did you checked how to use localhost inside a docker correctly ?