openbsd-ports/security/vpnc/files/vpnc.sh
sturm 0ac32169da Initial import of vpnc 0.2-rm+zomb.1
A VPN client compatible with Cisco's EasyVPN equipment.

Supports IPSec (ESP) with Mode Configuration and Xauth.  Supports only
shared-secret IPSec authentication, 3DES, MD5, and IP tunneling.

It runs entirely in userspace.

WWW: http://www.unix-ag.uni-kl.de/~massar/vpnc/
2004-05-14 13:34:51 +00:00

30 lines
554 B
Bash

#! /bin/sh
TUN_IF=tun0
PREFIX=%%PREFIX%%
VPNGATEWAY=192.168.0.1
case "$1" in
start)
dhclient wi0
DEFAULTROUTER=`route -n show -inet | grep default | awk '{ print $2 }'`
${PREFIX}/sbin/vpnc || exit 1
TUN_IP=`ifconfig ${TUN_IF} | grep netmask | awk '{ print $2 }'`
route add -host ${VPNGATEWAY} ${DEFAULTROUTER}
route delete default
route add default -interface ${TUN_IP}
;;
stop)
route delete -host ${VPNGATEWAY}
pkill vpnc
pkill "dhclient wi0"
ifconfig wi0 down
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
exit 1
;;
esac
exit 0