-
-
Save dimzon/c98ca0b41e1840982f7734839d1f2d18 to your computer and use it in GitHub Desktop.
VPN via Redsocks
This file contains hidden or 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
#!/usr/bin/env bash | |
set -xe | |
SSH_USER_PWD="${SSH_USER_PWD}" | |
SSH_USER="${SSH_USER}" | |
VPN_GATEWAY="${VPN_GATEWAY}" | |
sshpass -p "${SSH_USER_PWD}" ssh -o StrictHostKeyChecking=no -v "${SSH_USER}@${VPN_GATEWAY}" -22 -D 9999 -nf "sleep 90000" & | |
echo 'base{log_debug = on; log_info = on; log = "file:/tmp/reddi.log";daemon = on; redirector = iptables;}redsocks { local_ip = 127.0.0.1; local_port = 12345; ip = 127.0.0.1;port = 9999; type = socks5; }' > ~/redsocks.conf | |
sudo redsocks -c ~/redsocks.conf & | |
sudo iptables -t nat -N REDSOCKS | |
sudo iptables -t nat -A REDSOCKS -p tcp -d 10.0.0.0/8 -j DNAT --to 127.0.0.1:12345 | |
sudo iptables -t nat -A OUTPUT -d 10.0.0.0/8 -j REDSOCKS | |
sudo iptables -t nat -I PREROUTING 1 -d 10.0.0.0/8 -j REDSOCKS |
This file contains hidden or 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
#!/bin/bash -x | |
set -e | |
sudo locale-gen UTF-8 | |
sudo apt-get install redsocks sshpass -y | |
sudo apt-get autoremove | |
wget -O ~/circleci-tunnel.sh https://gist.github.com/davidlukac/d980c1fcb7584ffbfc53f4780efe3fcd/raw/951a892aeac86acfb012ff05209314e9342961b8/circleci-tunnel.sh | |
chmod +x ~/circleci-tunnel.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment