diff --git a/contained/Dockerfile b/contained/Dockerfile index 883f00e..eb3f9c0 100644 --- a/contained/Dockerfile +++ b/contained/Dockerfile @@ -21,9 +21,10 @@ COPY bin/ /opt/bin # https://it-offshore.co.uk/linux/alpine-linux/55-alpine-linux-lxc-guest-iptables-logging RUN sed -i -e "s/#stack=log1/stack=log1/g" /etc/ulogd.conf -ENV I2PD_IP="172.16.200.10" -ENV I2PD_PORT=4444 -ENV LOCAL_PROXY_PORT=10080 +ENV PROXY_SAM_HOST="172.16.200.10" +ENV PROXY_SAM_PORT=7656 +ENV PROXY_PORT=10080 +ENV PROXY_DNS_PORT=53 ENTRYPOINT ["dumb-init"] CMD ["/bin/bash" , "/opt/bin/exec.sh"] diff --git a/contained/bin/exec.sh b/contained/bin/exec.sh index d377651..e1c60ba 100644 --- a/contained/bin/exec.sh +++ b/contained/bin/exec.sh @@ -9,20 +9,20 @@ IFS=$'\n\t' iptables -t nat -F # https://websistent.com/linux-iptables-log-everything/ -iptables -I INPUT 1 -s $I2PD_IP -j NFLOG -iptables -t nat -I INPUT 1 -s $I2PD_IP -j NFLOG +iptables -I INPUT 1 -s $PROXY_SAM_HOST -j NFLOG +iptables -t nat -I INPUT 1 -s $PROXY_SAM_HOST -j NFLOG iptables -I OUTPUT 1 -j NFLOG iptables -t nat -I OUTPUT 1 -j NFLOG # Make sure traffic to I2P isn't redirected elsewhere iptables -t nat -A OUTPUT -o eth0 \ - -p tcp --dport $I2PD_PORT \ + -p tcp --dport $PROXY_SAM_PORT \ -j ACCEPT -# Redirect all other traffic on eth0 to pr0cks +# Redirect all other traffic on eth0 to trans-proxy iptables -t nat -A OUTPUT -o eth0 \ -p tcp \ - -j REDIRECT --to-ports $LOCAL_PROXY_PORT + -j REDIRECT --to-ports $PROXY_PORT # Reject outgoing DNS requests for now # We don't want them to leak @@ -38,7 +38,4 @@ tcpdump -i any -w /mount/tcp.dmp & export PYTHONPATH=/opt/bin python3 /opt/bin/trans_proxy/cli.py \ - --port ${LOCAL_PROXY_PORT} \ - --sam-host "${I2PD_IP}" \ - --sam-port "${I2PD_PORT}" \ --verbose diff --git a/contained/bin/trans_proxy/cli.py b/contained/bin/trans_proxy/cli.py index b372db3..79f0dc7 100644 --- a/contained/bin/trans_proxy/cli.py +++ b/contained/bin/trans_proxy/cli.py @@ -28,9 +28,10 @@ from trans_proxy import fake_dns from trans_proxy.process import AsyncProcess from trans_proxy.servers import ClientTcpTunnel -ENV_SAM_HOST = "I2P_SAM_HOST" -ENV_SAM_PORT = "I2P_SAM_PORT" -ENV_DNS_PORT = "I2P_DNS_PORT" +ENV_PORT = "PROXY_PORT" +ENV_SAM_HOST = "PROXY_SAM_HOST" +ENV_SAM_PORT = "PROXY_SAM_PORT" +ENV_DNS_PORT = "PROXY_DNS_PORT" logger = logging.getLogger("trans_proxy") @@ -45,7 +46,7 @@ def main(): help="Activates verbose logs") parser.add_argument( "-p", "--port", - default=1234, + default=os.environ.get(ENV_PORT, 1234), type=int, help="Where all traffic should enter to be forwarded") parser.add_argument(