Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jult opened this issue Oct 4, 2023 · 0 comments
Open

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

jult opened this issue Oct 4, 2023 · 0 comments

Comments

@jult
Copy link

jult commented Oct 4, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant