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

cli: notices don't work behind a proxy #32304

Closed
1 task
rix0rrr opened this issue Nov 27, 2024 · 3 comments · Fixed by #32590
Closed
1 task

cli: notices don't work behind a proxy #32304

rix0rrr opened this issue Nov 27, 2024 · 3 comments · Fixed by #32590
Assignees
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI

Comments

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 27, 2024

Describe the bug

[11:54:39] Could not refresh notices: Error: Request timed out

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

They work

Current Behavior

Fetching them fails

Reproduction Steps

I'm trying a fairly elaborate setup on Mac OS to prevent a process' network traffic except through a proxy, using the _svn user that's standard on the system but otherwise unused. I probably shouldn't do this, but I'm nothing if not lazy.

# Make the '_svn' user part of 'staff' so it has a fighting chance of reading home directories
$ sudo dseditgroup -o edit -a _svn -t user staff

# Make mitmproxy directory readable by staff
$ chmod -R g+r /Users/huijbers/.mitmproxy
# pf.conf

scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"

# Allow all traffic on loopback interface
pass quick on lo0 all

# Allow established connections
pass in proto tcp from any to any flags S/SA keep state
pass in proto udp from any to any keep state

# Allow localhost traffic
pass in from 127.0.0.1 to 127.0.0.1
pass out from 127.0.0.1 to 127.0.0.1

pass out proto { tcp, udp } from any to 127.0.0.1 user { _svn }
block drop out proto { tcp, udp } all user { _svn }
# Apply firewall rules
sudo pfctl -f pf.conf

# Have mitmproxy running somewhere

# Start CDK CLI as _svn
$ sudo -Eu _svn env CDK_HOME=$HOME/.cdk AWS_CA_BUNDLE=$HOME/.mitmproxy/mitmproxy-ca.pem HTTPS_PROXY=http://localhost:8080  npx cdk deploy -vv

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

Framework Version

No response

Node.js Version

OS

Language

TypeScript

Language Version

No response

Other information

No response

@rix0rrr rix0rrr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. p1 labels Nov 27, 2024
@ashishdhingra
Copy link
Contributor

Issue opened by CDK team.

@ashishdhingra ashishdhingra added package/tools Related to AWS CDK Tools or CLI effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 27, 2024
@otaviomacedo otaviomacedo self-assigned this Dec 18, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2024
Issacwww pushed a commit to Issacwww/aws-cdk that referenced this issue Dec 23, 2024
### Issue

Fixes aws#32304

### Reason for this change

The CLI doesn't respect the proxy configuration (either via command line
or via environment variables) to fetch notices. As a result, customers
who can only access the internet via a proxy will never see notices.

### Description of changes

- Proxy agent construction refactored into a public method, to be
reused.
- `Settings` has two new keys: `proxy` and `caBundlePath`.
- These new settings are passed to the `Notices` class, which internally
uses them to make the GET request to the notices URL.
- Proxy integ test now also asserts that the notices URL is intercepted
by the proxy.

### Description of how you validated changes

Proxy integ test, and manual tests with `mitmproxy`.

### Checklist
- [x] My code adheres to the [CONTRIBUTING
GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and
[DESIGN
GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license*
rix0rrr pushed a commit to aws/aws-cdk-cli-testing that referenced this issue Dec 24, 2024
### Issue

Fixes aws/aws-cdk#32304

### Reason for this change

The CLI doesn't respect the proxy configuration (either via command line
or via environment variables) to fetch notices. As a result, customers
who can only access the internet via a proxy will never see notices.

### Description of changes

- Proxy agent construction refactored into a public method, to be
reused.
- `Settings` has two new keys: `proxy` and `caBundlePath`.
- These new settings are passed to the `Notices` class, which internally
uses them to make the GET request to the notices URL.
- Proxy integ test now also asserts that the notices URL is intercepted
by the proxy.

### Description of how you validated changes

Proxy integ test, and manual tests with `mitmproxy`.

### Checklist
- [x] My code adheres to the [CONTRIBUTING
GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and
[DESIGN
GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license*
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants