ekollof / gentlsa

Tool for DANE/TLSA (with Cloudflare API support)
Other
16 stars 4 forks source link

socket.gaierror: [Errno -5] No address associated with hostname #8

Open jult opened 11 months ago

jult commented 11 months ago

Can't seem to resolve to itself. This is on a debian 12 server with Python 3.11.2 DNS is fully functional (I can ping and resolve everywhere, and localhost is 127.0.0.1 in /etc/hosts etcetera), so I'm not able to solve this issue. Seems a python version issue.

Traceback (most recent call last):
  File "/root/gentlsa/gentlsa.py", line 276, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/gentlsa/gentlsa.py", line 221, in main
    certobj = getsmtpcert(connhost, port)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/gentlsa/gentlsa.py", line 52, in getsmtpcert
    serv = smtplib.SMTP(addr, port=port)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 341, in connect
    self.sock = self._get_socket(host, port, self.timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 312, in _get_socket
    return socket.create_connection((host, port), timeout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 827, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -5] No address associated with hostname
Traceback (most recent call last):
  File "/root/gentlsa/gentlsa.py", line 276, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/gentlsa/gentlsa.py", line 221, in main
    certobj = getsmtpcert(connhost, port)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/gentlsa/gentlsa.py", line 52, in getsmtpcert
    serv = smtplib.SMTP(addr, port=port)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 341, in connect
    self.sock = self._get_socket(host, port, self.timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 312, in _get_socket
    return socket.create_connection((host, port), timeout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 827, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -5] No address associated with hostname
Exception: Connection error: [Errno -5] No address associated with hostname
>>> Certificate Information:
Traceback (most recent call last):
  File "/root/gentlsa/gentlsa.py", line 276, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/gentlsa/gentlsa.py", line 222, in main
    printcertinfo(certobj, hostname, port, args['--info'])
  File "/root/gentlsa/gentlsa.py", line 96, in printcertinfo
    print(f"Serial : {certobj.get_serial_number():x}")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_serial_number'

Anyone ideas? Am I missing a python module? I installed all mentioned in the requirements file.