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

ec2-instance-connect open-tunnel failed when NO_PROXY not set. #8023

Closed
sayurin opened this issue Jul 7, 2023 · 5 comments
Closed

ec2-instance-connect open-tunnel failed when NO_PROXY not set. #8023

sayurin opened this issue Jul 7, 2023 · 5 comments
Assignees
Labels
bug This issue is a bug. customization Issues related to CLI customizations (located in /awscli/customizations) p1 This is a high priority issue

Comments

@sayurin
Copy link

sayurin commented Jul 7, 2023

Describe the bug

ec2-instance-connect open-tunnel failed when NO_PROXY not set.

Expected Behavior

open-tunnel successfully connected.

Current Behavior

following error message.

2023-07-07 17:47:08,068 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli\clidriver.py", line 460, in main
  File "awscli\clidriver.py", line 595, in __call__
  File "awscli\customizations\commands.py", line 205, in __call__
  File "awscli\customizations\ec2instanceconnect\opentunnel.py", line 145, in _run_main
  File "awscli\customizations\ec2instanceconnect\websocket.py", line 326, in run
  File "awscli\customizations\ec2instanceconnect\websocket.py", line 363, in _open_websocket_connection
  File "awscli\customizations\ec2instanceconnect\websocket.py", line 158, in connect
TypeError: argument of type 'NoneType' is not iterable

argument of type 'NoneType' is not iterable
kex_exchange_identification: Connection closed by remote host

Reproduction Steps

  1. Setup EC2 Instance, EC2 Instance Connect and EC2 Instance Connect Endpoint. (Instance ID as i-xxxx).
  2. Setup HTTP Proxy (Proxy address as proxy.example.com:8080).
  3. Set environment variable HTTP_PROXY to use proxy.
    In bash, export HTTP_PROXY=http://proxy.example.com:8080.
    In PowerShell $env:HTTP_PROXY="http://proxy.example.com:8080".
  4. Unset env NO_PROXY.
    In bash, unset NO_PROXY.
    In PowerShell, $env:NO_PROXY="".
  5. Run aws cli aws ec2-instance-connect ssh --connection-type eice --instance-id i-xxxx --debug.
    This will fail with the error written at Current Behavior.

Workarround,

  1. Set environment variable NO_PROXY to dummy value.
    In bash, export NO_PROXY=1.
    In PowerShell, $env:NO_PROXY="1".
  2. Run aws cli aws ec2-instance-connect ssh --connection-type eice --instance-id i-xxxx --debug.
    This will success as expected behavior.

Possible Solution

no_proxy = environment.get("NO_PROXY")
if proxy_url and parsed_url.hostname not in no_proxy:

If environment variable NO_PROXY is not set, no_proxy become NoneType.

Additional Information/Context

For workaround, set environment variable NO_PROXY with dummy value.

CLI version used

4.12.7

Environment details (OS name and version, etc.)

Windows and CloudShell.

@sayurin sayurin added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 7, 2023
@tim-finnigan tim-finnigan self-assigned this Jul 7, 2023
@tim-finnigan
Copy link
Contributor

Hi @sayurin thanks for reaching out. I'm having trouble reproducing this issue, could you share your debug logs (with any sensitive info redacted) by adding --debug to your command?

@tim-finnigan tim-finnigan added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 7, 2023
@sayurin
Copy link
Author

sayurin commented Jul 10, 2023

@tim-finnigan I updated description, repro steps. Please try with --connection-type eice option.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 10, 2023
@tim-finnigan tim-finnigan added bug This issue is a bug. customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue labels Jul 10, 2023
@tim-finnigan
Copy link
Contributor

Thanks for following up, I can reproduce the issue now. We will reach out to the team working this customization for next steps.

@tim-finnigan tim-finnigan added p1 This is a high priority issue and removed p2 This is a standard priority issue labels Jul 10, 2023
@tim-finnigan
Copy link
Contributor

Closing as #8039 was merged, please update to v2.13.2+ per the CHANGELOG and let us know if you run into any issues. Thanks again for reporting this!

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. customization Issues related to CLI customizations (located in /awscli/customizations) p1 This is a high priority issue
Projects
None yet
Development

No branches or pull requests

2 participants