cli: Rename the env vars for the params

It also shortens the command-line argument in exec.sh

#4 - Investigate extending pr0xy to use SAM
This commit is contained in:
2020-12-13 20:19:58 +01:00
parent 8026c04a7b
commit 177a4ad5f7
3 changed files with 14 additions and 15 deletions

View File

@@ -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"]

View File

@@ -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

View File

@@ -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(