diff --git a/.gitignore b/.gitignore index 84c010e..4c49bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -vars.sh +.env diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3915833..c760008 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,6 +3,7 @@ # User greeting echo "Welcome to Windscribe HTTP proxy!" echo "WINDSCRIBE_COUNTRY set to: ${WINDSCRIBE_COUNTRY}" +echo "HOST_PORT set to: ${HOST_PORT}" # For OpenVPN operation mkdir -p /dev/net @@ -10,10 +11,12 @@ mknod /dev/net/tun c 10 200 # Start windscribe service /etc/init.d/windscribe-cli start #"Starting windscribe ... OK\n" +read WINDSCRIBE_PID < /etc/windscribe/windscribe.pid +echo "Windscribe service started on container PID ${WINDSCRIBE_PID}" if [ -z "$WINDSCRIBE_USERNAME" ] || [ -z "$WINDSCRIBE_PASSWORD" ]; then - # Login interactively + # Login interactively (requires interactive shell) windscribe login else # Simulate "interactive" login @@ -31,12 +34,12 @@ fi windscribe account # Final config tweaks possible now logged in -windscribe firewall off #Null since IPTables is dummy -windscribe protocol tcp #May potentially work better over NAT +#windscribe firewall off #Proxy operation does not require this be disabled so we'll leave as is +windscribe protocol tcp #We switch this as it may potentially work better over some NAT configurations windscribe connect ${WINDSCRIBE_COUNTRY} # Start tinyproxy HTTP proxy service -/etc/init.d/tinyproxy start +echo "Starting HTTP proxy on host port ${HOST_PORT} (HOST_PORT)..." +# Wait for tinyproxy daemon (hopefully forever) else docker dies :( +/usr/sbin/tinyproxy -d -# Wait for ever else docker dies :( -sleep infinity diff --git a/env.sample b/env.sample new file mode 100755 index 0000000..31a6ab7 --- /dev/null +++ b/env.sample @@ -0,0 +1,6 @@ +WINDSCRIBE_USERNAME= # Insert Windscribe account username here +WINDSCRIBE_PASSWORD= # Corresponding account password + +#Optional +LOCAL_PORT= # Local port number to run HTTP proxy on (8888 is default) +WINDSCRIBE_COUNTRY= # Chnage VPN server country (Current location as determined by Windscribe is default) diff --git a/localproxy.sh b/localproxy.sh index e05ebec..0bd8680 100755 --- a/localproxy.sh +++ b/localproxy.sh @@ -1,6 +1,6 @@ #!/bin/bash -source ./vars.sh +export $(grep -v '^#' .env | xargs -d '\n') IMAGE_NAME="dilks/windscribe-httpproxy" DNS1="1.1.1.1" @@ -11,7 +11,7 @@ docker run --rm -d \ --env WINDSCRIBE_COUNTRY="$WINDSCRIBE_COUNTRY" \ --env WINDSCRIBE_USERNAME \ --env WINDSCRIBE_PASSWORD \ --p $LOCAL_PORT:8888 \ +-p $HOST_PORT:8888 \ --dns "${DNS1}" \ --dns "${DNS2}" \ "${IMAGE_NAME}"