Last active
December 21, 2015 21:23
-
-
Save timrwilliams/d48e6a182d083778fd15 to your computer and use it in GitHub Desktop.
Override QuotaGuard Static Socksify env variable setup with your own socks.conf file
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 | |
# Script inspired by and derived from Proximo (https://github.com/pirateradio/proximo-stacklet) | |
# Usage ./qgoverride rails s | |
if [ "${QUOTAGUARDSTATIC_URL}" == "" ]; then | |
echo "No QUOTAGUARDSTATIC_URL env variable found. Have you installed QuotaGuard Static?" | |
echo "If using Heroku:" | |
echo " heroku addons:add QuotaGuardstatic:test" | |
echo "If using another platform sign-up at quotaguard.com and follow documentation to manually set variable" | |
exit 2 | |
fi | |
SOCKS_DIR="$(dirname $(dirname $(readlink -f ${BASH_SOURCE[0]})))/vendor/dante" | |
QUOTAGUARDSTATIC_USERNAME=$(awk -F'[/@:]' '{print $4}' <<< ${QUOTAGUARDSTATIC_URL}) | |
QUOTAGUARDSTATIC_PASSWORD=$(awk -F'[/@:]' '{print $5}' <<< ${QUOTAGUARDSTATIC_URL}) | |
export SOCKS_CONF="${SOCKS_DIR}/socks.conf.override" | |
export SOCKS_LIBDIR="${SOCKS_DIR}/lib" | |
export SOCKS_USERNAME="${QUOTAGUARDSTATIC_USERNAME}" | |
export SOCKS_PASSWORD="${QUOTAGUARDSTATIC_PASSWORD}" | |
export SOCKS_LIBRARY="${SOCKS_DIR}/lib/libdsocks.so" | |
export SOCKS_USEFULLPATH="true" | |
chmod +x ${SOCKS_DIR}/bin/socksify | |
echo "QuotaGuard Static enabled. Using your manually created socks.conf.override" | |
exec ${SOCKS_DIR}/bin/socksify $* |
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
route { | |
from: 0.0.0.0/0 to: 0.0.0.0/0 port = 3306 via: us-east-1-static-brooks.quotaguard.com port = 1080 | |
proxyprotocol: socks_v5 | |
method: username | |
command: connect | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overriding the socks.conf allows you to specify complex client pass rules in your sock configuration file. In this example we are routing only traffic destined for port 3306 to the SOCKS5 proxy