Skip to content

Instantly share code, notes, and snippets.

@tyilo
Created January 14, 2018 23:12
Show Gist options
  • Save tyilo/03889ddc651fcf96e1208b65bfc7aa7f to your computer and use it in GitHub Desktop.
Save tyilo/03889ddc651fcf96e1208b65bfc7aa7f to your computer and use it in GitHub Desktop.
docker: ipsec vpn server + mitmproxy
version: "3"
services:
vpn:
image: hwdsl2/ipsec-vpn-server
env_file:
- ./vpn.env
ports:
- "500:500/udp"
- "4500:4500/udp"
privileged: true
hostname: ipsec-vpn-server
container_name: ipsec-vpn-server
volumes:
- /lib/modules:/lib/modules:ro
command: >
bash -c '
HOST=$$(host -4 mitmproxy | head -1 | awk "{ print \$$4 }") &&
echo "HOST: $$HOST" &&
iptables -t nat -A PREROUTING -i eth+ -p tcp --destination-port 80 -j DNAT --to-destination $$HOST:8080 &&
iptables -t nat -A PREROUTING -i eth+ -p tcp --destination-port 443 -j DNAT --to-destination $$HOST:8080 &&
/opt/src/run.sh
'
mitmproxy:
image: mitmproxy/mitmproxy
ports:
- "8080:8080/tcp"
hostname: mitmproxy
container_name: mitmproxy
command: mitmdump -T --host
# Define your own values for these variables
# - DO NOT put "" or '' around values, or add space around =
# - DO NOT use these special characters within values: \ " '
VPN_IPSEC_PSK=foobar
VPN_USER=foo
VPN_PASSWORD=bar
@crylg
Copy link

crylg commented Nov 28, 2021

user,passwd...

@dkvdm
Copy link

dkvdm commented Jan 6, 2022

Using this creates a recursive request loop, where it keeps trying to loop through mitmproxy to make the request.
Any idea on how to stop this from happening? I'm at wits end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment