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

Rotating proxy using fck-nat #69

Open
garysassano opened this issue Feb 3, 2024 · 7 comments
Open

Rotating proxy using fck-nat #69

garysassano opened this issue Feb 3, 2024 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@garysassano
Copy link

Can you link 5 Elastic IP addresses to your EC2 instance? The scenario involves an AWS Lambda function invoking the NAT Instance, which then selects a random EIP for internet requests, effectively creating a rotating proxy system.

@fl0wo
Copy link

fl0wo commented Feb 4, 2024

That would be very useful indeed.

I would like the NAT instance to have some external IPs within an "IP list" (allow-list).
Perhaps the "eip_id" directive in the configuration file could turn into an "array of EIP ids"?

Then, for example, a Lambda inside that NAT would address the outside with "one of these public IPs" (randomly chosen each time).

@AndrewGuenther AndrewGuenther added this to the 2.0 milestone Feb 9, 2024
@AndrewGuenther AndrewGuenther added the enhancement New feature or request label Feb 9, 2024
@AndrewGuenther
Copy link
Owner

This can be done with snat, but I'm worried about breaking existing users and consumers of the eip_id directive. I was already planning to migrate to snat for v2 so I'm going to keep this in mind when doing that and tag for the 2.0 release.

@fl0wo
Copy link

fl0wo commented Feb 10, 2024

Thank you Andrew for the update.

Do you think it is somehow possible to achieve the same result with the current version of fck-nat?

Maybe by spinning up 5 different fck-nat instances under the same VPC? Each with an associated eip_id, resulting in 5 IPs.

I'm not sure, do you think this is feasible?

@AndrewGuenther
Copy link
Owner

@fl0wo It wouldn't be possible as you've described. You get only one default route per subnet. So while you could have many subnets each with a default route pointing to a different fck-nat, it wouldn't quite be the behavior requested in the initial submission.

@garysassano
Copy link
Author

AWS just introduced the ability to dynamically remove and add EIPs to EC2 instances. I believe this feature could be a game-changer for implementing a rotating proxy with fck-nat.

@AndrewGuenther
Copy link
Owner

I don't see how that feature changes anything here?

@garysassano
Copy link
Author

garysassano commented Apr 26, 2024

My understanding is that if you replace the EIP, you are essentially changing the public IP address of the NAT instance. Consequently, any traffic routed through the NAT instance, including traffic from your Lambda functions, will use the new EIP for internet access.

To clarify, this method could be used to rotate the NAT instance EIP at a predetermined interval (every X minutes). This is different from the approach that was mentioned earlier, which involved selecting a random EIP from a pool for each individual request. Both methods offer IP diversification, but they achieve it in distinct ways.

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

No branches or pull requests

3 participants