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

Failed to establish a new connection: [Errno 11001] getaddrinfo failed')) #229

Open
CloudViking86 opened this issue Apr 1, 2022 · 1 comment
Labels
question waiting Waiting for answer

Comments

@CloudViking86
Copy link

CloudViking86 commented Apr 1, 2022

Hello,

First time trying out this project so I might have missed something but I don't believe I have.
Running v.2.0.1 from Windows 10 (Ver: 21H2 Build: 19044.1586)

Trying to login against our ADFS by running (in PowerShell);
aws-adfs login --adfs-host=https://sso.mycompany.com/adfs/ls/idpInitiatedSignOn.aspx?loginToRp=urn:my:urn --role-arn=<our-arn> --region=eu-west-1

but this fails directly with the following error:

Traceback (most recent call last):
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x00000206BD8F22C0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //sso.mycompany.com/adfs/ls/idpInitiatedSignOn.aspx?loginToRp=urn:my:urn/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:my:urn (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000206BD8F22C0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\Scripts\aws-adfs.exe\__main__.py", line 7, in <module>
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\aws_adfs\login.py", line 188, in login
    principal_roles, assertion, aws_session_duration = authenticator.authenticate(config, assertfile=assertfile)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\aws_adfs\authenticator.py", line 15, in authenticate
    response, session = html_roles_fetcher.fetch_html_encoded_roles(
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\aws_adfs\html_roles_fetcher.py", line 102, in fetch_html_encoded_roles
    response = session.post(
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 577, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\my.user\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //sso.mycompany.com/adfs/ls/idpInitiatedSignOn.aspx?loginToRp=urn:my:urn/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:my:urn (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000206BD8F22C0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Entering the same URL as I enter when launching aws-adfs in my browser;
https://sso.mycompany.com/adfs/ls/idpInitiatedSignOn.aspx?loginToRp=urn:my:urn
then I get directed to AWS and is prompted to select a role.

If I try and use the Windows equivalent of curl - Invoke-WebRequest - I get a "200" response;
Invoke-Webrequest -Method GET -Uri https://sso.mycompany.com/adfs/ls/idpInitiatedSignOn.aspx?loginToRp=urn:my:urn -UseBasicParsing

So the URL is reachable and good and works using a browser, why can't I access it when using aws-adfs?

Sorry if this is something elementary.

Best Regards

@mattmauriello
Copy link
Contributor

--adfs-host is looking for a host name, not a URL. try
--adfs-host=sso.mycompany.com

@pdecat pdecat added question waiting Waiting for answer labels Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question waiting Waiting for answer
Projects
None yet
Development

No branches or pull requests

3 participants