Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dan-v/awslambdaproxy
An AWS Lambda powered HTTP/SOCKS web proxy
https://github.com/dan-v/awslambdaproxy
aws aws-lambda http-proxy lambda-functions proxy proxy-server rotating-proxy socks5 socks5-proxy tunnel web-traffic
Last synced: 3 months ago
JSON representation
An AWS Lambda powered HTTP/SOCKS web proxy
- Host: GitHub
- URL: https://github.com/dan-v/awslambdaproxy
- Owner: dan-v
- License: mit
- Archived: true
- Created: 2016-12-23T08:12:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-06T04:36:35.000Z (almost 3 years ago)
- Last Synced: 2024-08-01T00:43:12.067Z (5 months ago)
- Topics: aws, aws-lambda, http-proxy, lambda-functions, proxy, proxy-server, rotating-proxy, socks5, socks5-proxy, tunnel, web-traffic
- Language: Go
- Homepage:
- Size: 41.4 MB
- Stars: 764
- Watchers: 21
- Forks: 103
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-network-stuff - **469**星
README
# NOTICE: This project is no longer being maintained
## Overview
awslambdaproxy is an [AWS Lambda](https://aws.amazon.com/lambda/) powered HTTP/SOCKS web proxy. It provides a constantly rotating IP address for your network traffic from all regions where AWS Lambda is available. The goal is to obfuscate your traffic and make it harder to track you as a user.![](/assets/images/overview.gif?raw=true)
## Features
* HTTP/HTTPS/SOCKS5 proxy protocols support (including authentication).
* No special client side software required. Just configure your system to use a proxy.
* Each configured AWS Lambda region provides a large pool of constantly rotating IP address.
* Configurable IP rotation frequency between multiple regions.
* Mostly [AWS free tier](https://aws.amazon.com/free/) compatible (see FAQ below).## Project status
Current code status: proof of concept. This is the first Go application that I've ever written. It has no tests. It may not work. It may blow up. Use at your own risk.## How it works
At a high level, awslambdaproxy proxies TCP/UDP traffic through AWS Lambda regional endpoints. To do this, awslambdaproxy is setup on a publicly accessible host (e.g. EC2 instance) and it handles creating Lambda resources that run a proxy server ([gost](https://github.com/ginuerzh/gost)). Since Lambda does not allow you to connect to bound ports in executing functions, a reverse SSH tunnel is established from the Lambda function to the host running awslambdaproxy. Once a tunnel connection is established, all user traffic is forwarded through this reverse tunnel to the proxy server. Lambda functions have a max execution time of 15 minutes, so there is a goroutine that continuously executes Lambda functions to ensure there is always a live tunnel in place. If multiple regions are specified, user traffic will be routed in a round robin fashion across these regions.![](/assets/images/how-it-works.png?raw=true)
## Installation
- [Terraform](#terraform)
- [Manual](#manual)## Terraform
1. Clone repository and go to the `deployment/terraform` directory:
```sh
git clone [email protected]:dan-v/awslambdaproxy.git && cd awslambdaproxy/deployment/terraform
```2. Install [Terraform](https://www.terraform.io/) and configure your Terraform backend. Read more about Terraform backends [here](https://www.terraform.io/docs/backends/index.html).
3. Create and fill in a variable definitions file ([read more here](https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files)) if you don't want to use default variables values defined in `variables.tf`.
4. Run these commands to init and apply configuration:
```sh
terraform init && terraform apply -auto-approve
```It will create all dependent resources and run awslambdaproxy inside a Docker container. EC2 instance SSH key can be found in AWS Secret Manager in your [AWS Management Console](https://console.aws.amazon.com/).
NOTE: Some AWS regions have a big list of IP CIDR blocks and they can exceed the default limits of security groups ([read more](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html#vpc-limits-security-groups)). In that case, you'll need to make a limit increase request through the `AWS Support Center` by choosing `Create Case` and then choosing `Service Limit Increase` to prevent deployment issues.
## Manual
1. Download a pre-built binary from the [GitHub Releases](https://github.com/dan-v/awslambdaproxy/releases) page.
2. Copy `awslambdaproxy` binary to a publicly accessible linux host (e.g. EC2 instance, VPS instance, etc). You will need to open the following ports on this host:
* Port 22 - functions executing in AWS Lambda will open SSH connections back to the host running `awslambdaproxy`, so this port needs to be open to the world. The SSH key used here is dynamically generated at startup and added to the running users authorized_keys file.
* Port 8080 - the default configuration will start a HTTP/SOCKS proxy listener on this port with default user/password authentication. If you don't want to publicly expose the proxy server, one option is to setup your own VPN server (e.g. [dosxvpn](https://github.com/dan-v/dosxvpn) or [algo](https://github.com/trailofbits/algo)), connect to it, and just run awslambdaproxy with the proxy listener only on localhost (-l localhost:8080).3. Optional, but I'd highly recommend taking a look at the Minimal IAM Policies section below. This will allow you to setup minimal permissions required to setup and run the project. Otherwise, if you don't care about security you can always use an access key with full administrator privileges.
4. `awslambdaproxy` will need access to credentials for AWS in some form. This can be either through exporting environment variables (as shown below), shared credential file, or an IAM role if assigned to the instance you are running it on. See [this](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials) for more details.
```sh
export AWS_ACCESS_KEY_ID=XXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=YYYYYYYYYYYYYYYYYYYYYY
```
5. Run `awslambdaproxy setup`.```sh
./awslambdaproxy setup
```6. Run `awslambdaproxy run`.
```sh
./awslambdaproxy run -r us-west-2,us-west-1,us-east-1,us-east-2
```
7. Configure your web browser (or OS) to use the HTTP/SOCKS5 proxy on the publicly accessible host running `awslambdaproxy` on port 8080.### Minimal IAM Policies
* This assumes you have the AWS CLI setup with an admin user
* Create a user with proper permissions needed to run the setup command. This user can be removed after running the setup command.
```
aws iam create-user --user-name awslambdaproxy-setup
aws iam put-user-policy --user-name awslambdaproxy-setup --policy-name awslambdaproxy-setup --policy-document file://deployment/iam/setup.json
aws iam create-access-key --user-name awslambdaproxy-setup
{
"AccessKey": {
"UserName": "awslambdaproxy-setup",
"Status": "Active",
"CreateDate": "2017-04-17T06:15:18.858Z",
"SecretAccessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"AccessKeyId": "xxxxxxxxxxxxxx"
}
}
```
* Create a user with proper permission needed to run the proxy.
```
aws iam create-user --user-name awslambdaproxy-run
aws iam put-user-policy --user-name awslambdaproxy-run --policy-name awslambdaproxy-run --policy-document file://deployment/iam/run.json
aws iam create-access-key --user-name awslambdaproxy-run
{
"AccessKey": {
"UserName": "awslambdaproxy-run",
"Status": "Active",
"CreateDate": "2017-04-17T06:18:27.531Z",
"SecretAccessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"AccessKeyId": "xxxxxxxxxxxxxx"
}
}
```## Examples
```
# execute proxy in four different regions with rotation happening every 60 seconds
./awslambdaproxy run -r us-west-2,us-west-1,us-east-1,us-east-2 -f 60s# choose a different port and username/password for proxy and add another listener on localhost with no auth
./awslambdaproxy run -l "admin:admin@:8888,localhost:9090"# bypass certain domains from using lambda proxy
./awslambdaproxy run -b "*.websocket.org,*.youtube.com"# specify a dns server for the proxy server to use for dns lookups
./awslambdaproxy run -l "admin:awslambdaproxy@:8080?dns=1.1.1.1"# increase function memory size for better network performance
./awslambdaproxy run -m 512
```## FAQ
1. Should I use awslambdaproxy? That's up to you. Use at your own risk.
2. Why did you use AWS Lambda for this? The primary reason for using AWS Lambda in this project is the vast pool of IP addresses available that automatically rotate.
3. How big is the pool of available IP addresses? This I don't know, but I do know I did not have a duplicate IP while running the proxy for a week.
4. Will this make me completely anonymous? No, absolutely not. The goal of this project is just to obfuscate your web traffic by rotating your IP address. All of your traffic is going through AWS which could be traced back to your account. You can also be tracked still with [browser fingerprinting](https://panopticlick.eff.org/), etc. Your [IP address may still leak](https://ipleak.net/) due to WebRTC, Flash, etc.
5. How often will my external IP address change? I'm not positive as that's specific to the internals of AWS Lambda, and that can change at any time. However, I'll give an example, with 4 regions specified rotating every 5 minutes it resulted in around 15 unique IPs per hour.
6. How much does this cost? awslambdaproxy should be able to run mostly on the [AWS free tier](https://aws.amazon.com/free/) minus bandwidth costs. It can run on a t2.micro instance and the default 128MB Lambda function that is constantly running should also fall in the free tier usage. The bandwidth is what will cost you money; you will pay for bandwidth usage for both EC2 and Lambda.
7. Why does my connection drop periodically? AWS Lambda functions can currently only execute for a maximum of 15 minutes. In order to maintain an ongoing proxy a new function is executed and all new traffic is cut over to it. Any ongoing connections to the previous Lambda function will hard stop after a timeout period. You generally won't see any issues for normal web browsing as connections are very short lived, but for any long lived connections you will see issues. Consider using the `--bypass` flag to specify known domains that you know use persistent connections to avoid having your connection constantly dropping for these.# Contributors
* [yurymkomarov](https://github.com/yurymkomarov) - streamlined the entire deployment process with Terraform.
* [unixfox](https://github.com/unixfox) - contributed the Docker image for awslambdaproxy.# Powered by
* [gost](https://github.com/ginuerzh/gost) - A simple security tunnel written in Golang.
* [yamux](https://github.com/hashicorp/yamux) - Golang connection multiplexing library.
* [goad](https://github.com/goadapp/goad) - Code was borrowed from this project to handle AWS Lambda zip creation and function upload.## Build From Source
1. Install [Go](https://golang.org/dl/) and [go-bindata](https://github.com/go-bindata/go-bindata)2. Fetch the project with `git clone`:
```sh
git clone [email protected]:dan-v/awslambdaproxy.git && cd awslambdaproxy
```3. Run make to build awslambdaproxy. You'll find your `awslambdaproxy` binary in the `artifacts` folder.
```sh
make
```