Skip to content

OSPD cannot find socket in docker container #550

Open

Description

@gooseleggs

Using the docker-compose.yml the openvasd service definition is missing the OSPD socket to connect to.

The error is shown here:

root@tpg-scanner:/opt/container/prod/greenbone# docker logs greenbone-community-edition-openvasd-1
2025-02-12T01:01:21.788661Z  INFO openvasd: Configuring storage devices mode=ServiceNotus storage_type=InMemory
2025-02-12T01:01:21.789603Z  INFO openvasd: Using in-memory storage. No sensitive data will be stored on disk.
2025-02-12T01:01:21.803006Z  WARN openvasd: OSPD socket /var/run/ospd/ospd-openvas.sock does not exist. Some commands will not work until the socket is created!
2025-02-12T01:01:21.805083Z  WARN openvasd: enable_get_scans=false
2025-02-12T01:01:21.815617Z  WARN openvasd::controller::context: Neither mTLS nor an API key are set. /scans endpoint is unsecured.

This causes scans to be completed very quick.

Adding
- ospd_openvas_socket_vol:/var/run/ospd to the volumes definition of the service and restarting, while giving the error means that the OSPD can execute the plugins.

The error can probably be resolved by adding a dependency for startup.

Activity

  1. added
    bug
    on Feb 12, 2025
  2. ArnoStiefvater commented on Feb 13, 2025

    @ArnoStiefvater

    Hey @gooseleggs

    the line 2025-02-12T01:01:21.803006Z WARN openvasd: OSPD socket /var/run/ospd/ospd-openvas.sock does not exist. Some commands will not work until the socket is created! seems to be an output bug as openvasd does not need a ospd socket when running in mode=ServiceNotus.

    For your other point, can you please provide the docker-compose.yml you used? Is it the current yml of the docs (https://github.com/greenbone/docs/blob/main/src/_static/docker-compose-22.4.yml)?

  3. gooseleggs commented on Feb 13, 2025

    @gooseleggs
    Author

    It appears that this issue is in the wrong repository! Sorry - should it be moved?

    Anyway. Yes, I think I am using the 22.4 docker-compose.yml. I found a few around the place. This is the current one that I am using:

    name: greenbone-community-edition
    
    services:
      vulnerability-tests:
        image: registry.community.greenbone.net/community/vulnerability-tests
        environment:
          FEED_RELEASE: '24.10'
        volumes:
          - vt_data_vol:/mnt
    
      notus-data:
        image: registry.community.greenbone.net/community/notus-data
        volumes:
          - notus_data_vol:/mnt
    
      scap-data:
        image: registry.community.greenbone.net/community/scap-data
        volumes:
          - scap_data_vol:/mnt
    
      cert-bund-data:
        image: registry.community.greenbone.net/community/cert-bund-data
        volumes:
          - cert_data_vol:/mnt
    
      dfn-cert-data:
        image: registry.community.greenbone.net/community/dfn-cert-data
        volumes:
          - cert_data_vol:/mnt
        depends_on:
          - cert-bund-data
    
      data-objects:
        image: registry.community.greenbone.net/community/data-objects
        environment:
          FEED_RELEASE: '24.10'
        volumes:
          - data_objects_vol:/mnt
    
      report-formats:
        image: registry.community.greenbone.net/community/report-formats
        environment:
          FEED_RELEASE: '24.10'
        volumes:
          - data_objects_vol:/mnt
        depends_on:
          - data-objects
    
      gpg-data:
        image: registry.community.greenbone.net/community/gpg-data
        volumes:
          - gpg_data_vol:/mnt
    
      redis-server:
        image: registry.community.greenbone.net/community/redis-server
        restart: on-failure
        volumes:
          - redis_socket_vol:/run/redis/
    
      pg-gvm:
        image: registry.community.greenbone.net/community/pg-gvm:stable
        restart: on-failure
        volumes:
          - psql_data_vol:/var/lib/postgresql
          - psql_socket_vol:/var/run/postgresql
    
      gvmd:
        image: registry.community.greenbone.net/community/gvmd:stable
        restart: on-failure
        volumes:
          - gvmd_data_vol:/var/lib/gvm
          - scap_data_vol:/var/lib/gvm/scap-data/
          - cert_data_vol:/var/lib/gvm/cert-data
          - data_objects_vol:/var/lib/gvm/data-objects/gvmd
          - vt_data_vol:/var/lib/openvas/plugins
          - psql_data_vol:/var/lib/postgresql
          - gvmd_socket_vol:/run/gvmd
          - ospd_openvas_socket_vol:/run/ospd
          - psql_socket_vol:/var/run/postgresql
        depends_on:
          pg-gvm:
            condition: service_started
          scap-data:
            condition: service_completed_successfully
          cert-bund-data:
            condition: service_completed_successfully
          dfn-cert-data:
            condition: service_completed_successfully
          data-objects:
            condition: service_completed_successfully
          report-formats:
            condition: service_completed_successfully
    
      gsa:
        image: registry.community.greenbone.net/community/gsa:stable
        restart: on-failure
        ports:
          - 127.0.0.1:80:80
        volumes:
          - gvmd_socket_vol:/run/gvmd
        depends_on:
          - gvmd
      # Sets log level of openvas to the set LOG_LEVEL within the env
      # and changes log output to /var/log/openvas instead /var/log/gvm
      # to reduce likelyhood of unwanted log interferences
      configure-openvas:
        image: registry.community.greenbone.net/community/openvas-scanner:stable
        volumes:
          - openvas_data_vol:/mnt
          - openvas_log_data_vol:/var/log/openvas
        command:
          - /bin/sh
          - -c
          - |
            printf "table_driven_lsc = yes\nopenvasd_server = http://openvasd:80\n" > /mnt/openvas.conf
            sed "s/127/128/" /etc/openvas/openvas_log.conf | sed 's/gvm/openvas/' > /mnt/openvas_log.conf
            chmod 644 /mnt/openvas.conf
            chmod 644 /mnt/openvas_log.conf
            touch /var/log/openvas/openvas.log
            chmod 666 /var/log/openvas/openvas.log
    
      # shows logs of openvas
      openvas:
        image: registry.community.greenbone.net/community/openvas-scanner:stable
        restart: on-failure
        volumes:
          - openvas_data_vol:/etc/openvas
          - openvas_log_data_vol:/var/log/openvas
        command:
          - /bin/sh
          - -c
          - |
            cat /etc/openvas/openvas.conf
            tail -f /var/log/openvas/openvas.log
        depends_on:
          configure-openvas:
            condition: service_completed_successfully
    
      openvasd:
        image: registry.community.greenbone.net/community/openvas-scanner:stable
        restart: on-failure
        environment:
          # `service_notus` is set to disable everything but notus,
          # if you want to utilize openvasd directly removed `OPENVASD_MODE`
          OPENVASD_MODE: service_notus
          GNUPGHOME: /etc/openvas/gnupg
          LISTENING: 0.0.0.0:80
        volumes:
          - openvas_data_vol:/etc/openvas
          - openvas_log_data_vol:/var/log/openvas
          - gpg_data_vol:/etc/openvas/gnupg
          - notus_data_vol:/var/lib/notus
          - ospd_openvas_socket_vol:/var/run/ospd
        # enable port forwarding when you want to use the http api from your host machine
        # ports:
        #   - 127.0.0.1:3000:80
        depends_on:
          vulnerability-tests:
            condition: service_completed_successfully
          configure-openvas:
            condition: service_completed_successfully
          gpg-data:
            condition: service_completed_successfully
        networks:
          default:
            aliases:
              - openvasd
    
      ospd-openvas:
        image: registry.community.greenbone.net/community/ospd-openvas:stable
        restart: on-failure
        hostname: ospd-openvas.local
        cap_add:
          - NET_ADMIN # for capturing packages in promiscuous mode
          - NET_RAW # for raw sockets e.g. used for the boreas alive detection
        security_opt:
          - seccomp=unconfined
          - apparmor=unconfined
        command:
          [
            "ospd-openvas",
            "-f",
            "--config",
            "/etc/gvm/ospd-openvas.conf",
            "--notus-feed-dir",
            "/var/lib/notus/advisories",
            "-m",
            "666",
          ]
        volumes:
          - gpg_data_vol:/etc/openvas/gnupg
          - vt_data_vol:/var/lib/openvas/plugins
          - notus_data_vol:/var/lib/notus
          - ospd_openvas_socket_vol:/run/ospd
          - redis_socket_vol:/run/redis/
          - openvas_data_vol:/etc/openvas/
          - openvas_log_data_vol:/var/log/openvas
        depends_on:
          redis-server:
            condition: service_started
          gpg-data:
            condition: service_completed_successfully
          vulnerability-tests:
            condition: service_completed_successfully
          configure-openvas:
            condition: service_completed_successfully
    
      gvm-tools:
        image: registry.community.greenbone.net/community/gvm-tools
        volumes:
          - gvmd_socket_vol:/run/gvmd
          - ospd_openvas_socket_vol:/run/ospd
        depends_on:
          - gvmd
          - ospd-openvas
    
    volumes:
      gpg_data_vol:
      scap_data_vol:
      cert_data_vol:
      data_objects_vol:
      gvmd_data_vol:
      psql_data_vol:
      vt_data_vol:
      notus_data_vol:
      psql_socket_vol:
      gvmd_socket_vol:
      ospd_openvas_socket_vol:
      redis_socket_vol:
      openvas_data_vol:
      openvas_log_data_vol:
    

    I have put the additional line in as per my previous comment. Without it, I found that a scan would complete in approx 1 minute. With the additional volume line in, it scanned for ~10 minutes on the one machine.

  4. postleon commented on Oct 9, 2025

    @postleon

    gsa:
    image: registry.community.greenbone.net/community/gsa:stable
    restart: on-failure
    ports:
    - 9392:80

  5. bjoernricks commented on Oct 10, 2025

    @bjoernricks
    Contributor

    gsa: image: registry.community.greenbone.net/community/gsa:stable restart: on-failure ports: - 9392:80

    This has nothing to do with this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions