First version; still has debugging

This commit is contained in:
Jim Wyllie 2013-01-19 20:11:11 -05:00 committed by Brian May
parent 3956a5df94
commit d8754dc3a0

75
packaging/sshuttle.conf Normal file
View File

@ -0,0 +1,75 @@
description "Create a tunnel over SSH proxy"
author "Jim Wyllie <jwyllie83@gmail.com>"
manual
nice -5
# Edit this file with network prefixes that should be loaded through the SSH
# tunnel.
env PREFIX_LOCATION=/etc/sshuttle/prefixes.conf
# Try all the keys in a given key directory
env KEY_LOCATION=/etc/sshuttle/keys
# Routing table; defaults to 100
env ROUTE_TABLE=100
# fwmark; defaults to 1
env FWMARK=1
start on (local-filesystems and net-device-up IFACE!=lo)
stop on stopping network-services
#respawn
pre-start script
# Make sure we have created the routes
sudo ip rule add fwmark ${FWMARK} lookup ${ROUTE_TABLE}
logger "Starting sshuttle..."
if [ -f "${PREFIX_LOCATION}" ]; then
cat "${PREFIX_LOCATION}" | while read ROUTE; do
logger "Working on route: ${ROUTE}"
# Skip comments
if [ -n "$(echo ${ROUTE} | egrep "^[ ]*#")" ]; then
continue
fi
# Skip empty lines
if [ -z "${ROUTE}" ]; then
continue
fi
logger "Adding route command: ip route add local ${ROUTE} dev lo table ${ROUTE_TABLE}"
ip route add local ${ROUTE} dev lo table ${ROUTE_TABLE}
done
fi
end script
post-stop script
if [ -f "${PREFIX_LOCATION}" ]; then
cat "${PREFIX_LOCATION}" | while read ROUTE; do
logger "Working on route: ${ROUTE}"
# Skip comments
if [ -n "$(echo ${ROUTE} | egrep "^[ ]*#")" ]; then
continue
fi
# Skip empty lines
if [ -z "${ROUTE}" ]; then
continue
fi
logger "Deleting route command: ip route del local ${ROUTE} dev lo table ${ROUTE_TABLE}"
ip route del local ${ROUTE} dev lo table ${ROUTE_TABLE}
done
fi
ip rule del fwmark ${FWMARK}
end script
exec sleep 60