forked from onnovalkering/socksx
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding dockerfiles and docker compose files for network functions and…
… proxy chains respectively
- Loading branch information
1 parent
6cdd99c
commit 27bc870
Showing
4 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This Dockerfile is supposed to create a socks proxy server that mimics a firewall. | ||
# This won't build on Mac OS X. Try on Linux or Windows. | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
python3 \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install click socksx | ||
|
||
COPY ./socksx-py/examples/functions.py /functions.py | ||
|
||
EXPOSE 1080 | ||
ENTRYPOINT [ "./functions.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This Dockerfile is used to build a socks proxy server that can be used to encrypt or decrypt the data | ||
FROM rust:1.72 as build | ||
|
||
RUN rustup component add rustfmt | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
cmake \ | ||
make \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy over relevant crates | ||
COPY ./socksx /socksx | ||
|
||
# Build an optimized binary | ||
WORKDIR /socksx | ||
RUN cargo build --example functions --release | ||
|
||
# Define final image | ||
FROM ubuntu:23.10 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libssl3 \ | ||
libuv1 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy `brane-log from the build stage | ||
COPY --from=build /socksx/target/release/examples/functions . | ||
|
||
EXPOSE 1080 | ||
ENTRYPOINT [ "./functions" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Example of two proxy chains simulating a sender node/domain and a receiver node/domains. | ||
# On sender side we have socks proxy, which is connected to a counter (mimicing a firewall) and encrypt | ||
# On receiver side we have socks proxy, which is connected to decrypt and counter | ||
# Communication looks like this: | ||
# sender(client) -> proxy (sender's side) -> counter -> encrypt -> proxy (destination's side) -> decrypt -> counter -> destination | ||
|
||
version: '3.8' | ||
|
||
services: | ||
proxy-main: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "1080:1080" | ||
command: "--host 0.0.0.0 --port 1080 --chain socks6://counter-1:1080 --chain socks6://encrypt:1080 --chain socks6://proxy-other:1080" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.2 | ||
|
||
counter-1: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.counter | ||
command: "--host 0.0.0.0" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.3 | ||
|
||
encrypt: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.encrypt-decrypt | ||
command: "chacha20" | ||
environment: | ||
- CHACHA20_KEY="123456789012345678901234567890" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.4 | ||
|
||
proxy-other: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "1081:1080" | ||
command: "--host 0.0.0.0 --port 1080 --chain socks6://decrypt:1080 --chain socks6://counter-2:1080" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.5 | ||
|
||
counter-2: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.counter | ||
command: "--host 0.0.0.0" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.6 | ||
|
||
decrypt: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.encrypt-decrypt | ||
command: "chacha20" | ||
environment: | ||
- CHACHA20_KEY="123456789012345678901234567890" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.7 | ||
|
||
netcat: | ||
image: busybox | ||
command: "nc -l -p 12345" | ||
ports: | ||
- "12345:12345" | ||
restart: always | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.8 | ||
|
||
networks: | ||
net: | ||
ipam: | ||
driver: default | ||
config: | ||
- subnet: "172.16.238.0/24" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Example of using a standalone proxy to forward traffic to a destination | ||
|
||
version: '3.8' | ||
|
||
services: | ||
proxy: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "1080:1080" | ||
command: "--host 0.0.0.0 --port 1080" | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.2 | ||
|
||
# this will be the destination | ||
netcat: | ||
image: busybox | ||
command: "nc -l -p 12345" | ||
ports: | ||
- "12345:12345" | ||
restart: always | ||
networks: | ||
net: | ||
ipv4_address: 172.16.238.3 | ||
|
||
networks: | ||
net: | ||
ipam: | ||
driver: default | ||
config: | ||
- subnet: "172.16.238.0/24" |