Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
First version; still has debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jwyllie83 committed Jan 20, 2013
1 parent 32ea23e commit e4aa4ef
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions packaging/sshuttle.conf
@@ -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

0 comments on commit e4aa4ef

Please sign in to comment.