Any way to pass environment variables into gsa container?

Hi, I’m trying to change the timeout on the GSA web portal container. Is there any way to be able to pass environment variables into the containers? If so, is there a list of valid environment variables posted anywhere? I don’t see anything in the documentation. Thanks.

Hello deeemmbee, and welcome to the Greenbone Community Forum. :slightly_smiling_face:

You don’t need to pass an environment variable to the GSA container to change the timeout. You can simply add an argument that speicifies the timeout when starting the gsad.service:

  • Open a root shell in the gsa container (i.e. docker exec -ti <ContainerID> bash)
  • Change your directory to /lib/systemd/system (cd /lib/systemd/system)
  • You may need to install an editor like nano or vim (apt update && apt install nano)
  • In the gsad.service file, append --timeout=<TimeoutMinutes> to the line that starts with ExecStart
  • Save and exit the file
  • Restart the gsad service or the whole container, whatever is more convenient to you

More detailed information about the web frontend timeout can be found here.

EDIT: In case you want to see all the available options for the gsad service, you can simply run gsad --help in the GSA container. :slight_smile:

Thanks for the tip. The only issue I have with this method is that, every time I pull an updated container from the Docker repository, the changes will be overwritten an I’ll need to go and do this process again. I was hoping there might be a way to pass the variable in so that, when the container is updated, it doesn’t lose its configuration.

Unfortunately, I don’t know of any environment variable that GSA uses to set the timeout. It’s very much possible that I’m missing something here, so if any more experienced people read this, feel free to correct me.

Maybe you can configure your Docker setup so the gsad.service file will be stored in a persistent location?

If you are using our community containers including the compose file you can’t use or change the service file to adjust the gsad start parameters. Instead you can adjust the compose file to run a different command for starting gsad.

3 Likes

Bingo! That did it. I created a volume that I mounted to the container with a modified startup file in it. My gsa section now looks like this and it seems to be working just as expected. Thanks!

  gsa:
    image: greenbone/gsa:stable
    restart: on-failure
    ports:
      - 80:80
    command:
      - /persistent_data/start-gsad
    volumes:
      - gvmd_socket_vol:/run/gvmd
      - /var/lib/docker/volumes/gce-persistent_data:/persistent_data
    depends_on:
      - gvmd
2 Likes