greenbone / notus-scanner

Notus is a vulnerability scanner for creating results from local security checks
https://greenbone.github.io/docs/
GNU Affero General Public License v3.0
41 stars 12 forks source link

Docker compose notus scaner error - Temporary failure in name resolution #241

Closed posi91 closed 2 years ago

posi91 commented 2 years ago

Hello, I am trying the docker-compose that is in the link https://greenbone.github.io/docs/latest/22.4/container/index.html#starting-the-vulnerability-management, and I have a problem with the notus scanner, the only thing I do in the compose is add the parameter container_name and add the network to each container, is it necessary for the mqtt-broker to be in the default network?

Compose

  mqtt-broker:
    restart: on-failure
    image: greenbone/mqtt-broker
    container_name: greenbone-mqtt-broker
    ports:
      - 1883:1883
    networks:
      -test_net

  note-scanner:
    restart: on-failure
    image: greenbone/notus-scanner:stable
    container_name: greenbone-notus-scanner
    volumes:
      -notus_data_vol:/var/lib/notus
      - gpg_data_vol:/etc/openvas/gnupg
    environment:
      NOTUS_SCANNER_MQTT_BROKER_ADDRESS: mqtt-broker
      NOTUS_SCANNER_PRODUCTS_DIRECTORY: /var/lib/notus
    depends_on:
      - mqtt-broker
      -gpg-data
    networks:
      -test_net

volumes:
  gpg_data_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:

networks:
    test_net:
      external: true

log output


greenbone-notus-scanner exited with code 1
greenbone-notus-scanner | 2022-08-04 03:25:22,230 notus-scanner: INFO: (notus.scanner.daemon) Starting notus-scanner version 22.4.0.
greenbone-notus-scanner | Traceback (most recent call last):
greenbone-notus-scanner | File "/usr/local/bin/notus-scanner", line 8, in <module>
greenbone-notus-scanner | sys.exit(main())
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/notus/scanner/daemon.py", line 158, in main
greenbone-notus-scanner | run_daemon(
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/notus/scanner/daemon.py", line 126, in run_daemon
greenbone-notus-scanner | daemon = MQTTDaemon(client)
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/notus/scanner/messaging/mqtt.py", line 163, in __init__
greenbone-notus-scanner | self._client.connect()
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/notus/scanner/messaging/mqtt.py", line 69, in connect
greenbone-notus-scanner | return super().connect(
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 914, in connect
greenbone-notus-scanner | return self.reconnect()
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1044, in reconnect
greenbone-notus-scanner | socket = self._create_socket_connection()
greenbone-notus-scanner | File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
greenbone-notus-scanner | return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
greenbone-notus-scanner | File "/usr/lib/python3.9/socket.py", line 822, in create_connection
greenbone-notus-scanner | for res in getaddrinfo(host, port, 0, SOCK_STREAM):
greenbone-notus-scanner | File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
greenbone-notus-scanner | for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
greenbone-notus-scanner | socket.gaierror: [Errno -3] Temporary failure in name resolution

Thank you,

bjoernricks commented 2 years ago

Hi, you either need to ensure that your network resolves mqtt-broker to the corresponding container or you need to adjust NOTUS_SCANNER_MQTT_BROKER_ADDRESS of the notus-scanner container to the new DNS name.