Setting up ssl/tls for docker

How to set up ssl/tls certificate for web Greenbone Security Assistant in docker containers?

I found this instruction - SSL Support? · Issue #28 · immauss/openvas · GitHub.

Do i have to(?):

  • add variable HTTPS=true to docker-compose.yml
    image: greenbone/gvmd:stable
           HTTPS: true
    restart: on-failure
  • then just copy my keys to:

But it doesn’t work for me :frowning: There are no https connection and /data folder in container.

Hi, is completely unrelated to our Greenbone Community Containers. If something isn’t mentioned in our docs at Greenbone Community Documentation it doesn’t exist.

To answer that question, this isn’t possible at the moment without adjusting and re-building the gsad container image (gvmd has nothing to do with https) by yourself.


Could you show me an instruction or give a hint how to “adjusting and re-building the gsad container image” for https support? Please.

That one is mine. :slight_smile: For future reference you can get to me a lot quicker with an issue here:

use HTTPS=true will enable the HTTPS and create certificates if they don’t already exists.
You could then replace them as you suggested.
The startup scripts install the keys as:


As long as you use those names with your certs, it should work like a charm. If not, please open an issue and I’ll do my best to help you work it out.


1 Like

I found this thread due to its subject, but the thread turned to another project. There is a solution to enabling SSL in gsad in the community container set. After a lot of trial and error, the solution is quite easy, I’m surprised no one has posted it in the documentation or on this forum before (at least that search finds).

It requires 2 modifications to the docker-compose.yaml and the creation of a certificate/key pair.

First find the “gsa” block in the yaml file and change the block to be like this:

    image: greenbone/gsa:stable
      - GSAD_ARGS=--no-redirect
    restart: on-failure
      - 9392:443
      - gvmd_socket_vol:/run/gvmd
      - source: server-certificate
        target: /var/lib/gvm/CA/servercert.pem
      - source: private-key
        target: /var/lib/gvm/private/CA/serverkey.pem
      - gvmd

Key changes here:

  1. First adding the environment option overrides the default passed to the gsad program (default is --http-only), this enables the SSL port, and disables the redirection on port 80, which isn’t needed and sometimes causes issues starting for reasons…
  2. Second change the target (internal) port from 80 to 443 gsad will now listen to
  3. Third is the addition of the secrets block to provide the container with a certificate and key, in the locations it expects them by default.

Next ADD to the bottom of the docker-compose.yaml, a block like this:

    file: /home/someusr/docker_keys/servercert.pem
    file: /home/someusr/docker_keys/serverkey.pem

This block defines the secrets used in the gsa block. The paths here are wherever you want to put the files. They can be generated easily enough, example for cert gen:

openssl req -x509 -newkey rsa:4096 -keyout serverkey.pem -out servercert.pem -nodes -subj '/CN=localhost' -addext 'subjectAltName = DNS:localhost' -days 365