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

socket.gaierror: [Errno -3] Temporary failure in name resolution #499

Closed roysbike closed 1 year ago

roysbike commented 1 year ago

mqtt broker 10.66.30.1:1883 . i use start each service in docker run. For a number of reasons, I don't use docker-compose. What name can he not resolve?

2023-05-24 11:55:49,181 notus-scanner: DEBUG: (notus.scanner.utils) Finishing daemon process
2023-05-24 11:56:50,351 notus-scanner: INFO: (notus.scanner.daemon) Starting notus-scanner version 22.4.5.
2023-05-24 11:56:50,352 notus-scanner: DEBUG: (notus.scanner.loader.gpg_sha_verifier) Using /etc/openvas/gnupg as GnuPG home.
2023-05-24 11:56:50,361 notus-scanner: DEBUG: (gnupg) 11: gpg --status-fd 2 --no-tty --no-verbose --fixed-list-mode --batch --with-colons --homedir /etc/openvas/gnupg --version
2023-05-24 11:56:50,362 notus-scanner: DEBUG: (gnupg) stderr reader: <Thread(Thread-1, initial daemon)>
2023-05-24 11:56:50,365 notus-scanner: DEBUG: (gnupg) stdout reader: <Thread(Thread-2, initial daemon)>
2023-05-24 11:56:50,406 notus-scanner: DEBUG: (gnupg) chunk: b'gpg (GnuPG) 2.2.27\nlibgcrypt 1.8.8\nCopyright (C) 2021 Free Software Foundation, Inc.\nLicense GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent per'
Traceback (most recent call last):
  File "/usr/local/bin/notus-scanner", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/notus/scanner/daemon.py", line 154, in main
    run_daemon(
  File "/usr/local/lib/python3.9/dist-packages/notus/scanner/daemon.py", line 116, in run_daemon
    daemon = MQTTDaemon(client)
  File "/usr/local/lib/python3.9/dist-packages/notus/scanner/messaging/mqtt.py", line 160, in __init__
    self._client.connect()
  File "/usr/local/lib/python3.9/dist-packages/notus/scanner/messaging/mqtt.py", line 66, in connect
    return super().connect(
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 914, in connect
    return self.reconnect()
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1044, in reconnect
    sock = self._create_socket_connection()
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
    return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
  File "/usr/lib/python3.9/socket.py", line 822, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
2023-05-24 11:56:50,446 notus-scanner: DEBUG: (notus.scanner.utils) Finishing daemon process

- docker run --name $CI_PROJECT_NAME -t
     --add-host mqtt-broker:10.66.30.1
     -e NOTUS_SCANNER_MQTT_BROKER_ADDRESS=mqtt-broker
     -e MQTT_BROKER_ADDRESS=mqtt-broker
     -e NOTUS_SCANNER_PRODUCTS_DIRECTORY=/var/lib/notus/products
     -e NOTUS_SCANNER_LOG_LEVEL=DEBUG
     --restart on-failure
     --network host
     -v notus_data_vol:/var/lib/notus
     -v gpg_data_vol:/etc/openvas/gnupg
     -d $IMAGE_URL
greenbone-notus-scanner
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=greenbone4-test
TERM=xterm
NOTUS_SCANNER_MQTT_BROKER_ADDRESS=mqtt-broker
MQTT_BROKER_ADDRESS=mqtt-broker
NOTUS_SCANNER_PRODUCTS_DIRECTORY=/var/lib/notus/products
NOTUS_SCANNER_LOG_LEVEL=DEBUG
PYTHONDONTWRITEBYTECODE=1
PYTHONUNBUFFERED=1
PIP_NO_CACHE_DIR=off
HOME=/root
greenbone-notus-scanner
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.66.30.1  mqtt-broker
cfi-gb commented 1 year ago

Could be a duplicate of #241

roysbike commented 1 year ago

name already added

/etc/hosts 10.66.30.1 mqtt-broker

roysbike commented 1 year ago

I figured it out. The default value is broker.

jjnicola commented 1 year ago

It seems it was a configuration issue. Therefore, closing it here.