X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fgrml-pptp-xdsl-students;fp=sbin%2Fgrml-pptp-xdsl-students;h=0000000000000000000000000000000000000000;hb=db4b339f8ff059e2a545a267478f8165dbc1f517;hp=e13552864debbd821d8aa6e29df28b6cd3ef6bf9;hpb=31498de4acd8c9fc4756baaec0d4077508c7d923;p=grml-network.git diff --git a/sbin/grml-pptp-xdsl-students b/sbin/grml-pptp-xdsl-students deleted file mode 100755 index e135528..0000000 --- a/sbin/grml-pptp-xdsl-students +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/sh -# Filename: grml-pptp-xdsl-students -# Purpose: connect via pptp to inode ["students-setup"] (www.inode.at) -# Authors: grml-team (grml.org), (c) Martin Hecher -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. -################################################################################ - -################################################################################ -# Notes: -# This script is based on 'knoppix-pptp' (version 0.3.1) -# by Wolfgang Scheicher -# and based on grml-pptp-inode -# by Andreas 'Jimmy' Gredler -################################################################################ - -export LANG=C -DIALOG="dialog" - -if [ $(id -ru) -ne 0 ] ; then - sudo $0 - exit -fi - -setroute() -{ -set $(grep "option routers" /var/lib/dhcp3/dhclient.leases | tail -1 | cut -f5 -d' ' | tr -d ";") - -ROUTER="$1" -ANT="10.0.0.138" - -if route -n | grep $ANT >>/dev/null - then - /sbin/route del $ANT - fi - -/sbin/route add $ANT gw $ROUTER - -if ifconfig | grep ppp0 >>/dev/null - then - set $(ifconfig ppp0 | grep P-t-P | tr -s [:blank:] | cut -f4 -d' ' | cut -b7-) - GATEWAY="$1" - /sbin/route del default - /sbin/route add default gw $GATEWAY - exit 0 - fi -} - -runit(){ - -/sbin/dhclient ${NET_DEVICE} - -echo "name ${VPNUSERNAME}" > /etc/ppp/peers/inode -cat >> /etc/ppp/peers/inode << "EOF" -remotename XDSL -defaultroute -noipdefault -noauth -persist -logfile /var/log/pptp.log - -EOF - -echo "${VPNUSERNAME} XDSL ${VPNPASSWORD} *" >> /etc/ppp/pap-secrets -chmod 0600 /etc/ppp/pap-secrets - -printf "#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\n" > /etc/init.d/pptp - -cat >> /etc/init.d/pptp << "EOF" - -PPTP="/usr/sbin/pptp $VPNSERVER call inode" - -case "$1" in - start) - echo "Starting up XDSL: pptp" - start-stop-daemon --start --exec $PPTP - if [ $? == 0 ]; then - echo "." - fi - ;; - stop) - echo "Shutting down XDSL: pptp" - start-stop-daemon --stop --exec $PPTP - if [ $? == 0 ]; then - /sbin/route del -host $VPNSERVER - /sbin/route add default gw $GATEWAY - echo "." - fi - ;; - reconnect) - echo -n "Reconnecting XDSL: pptd" - start-stop-daemon --start --exec $PPTP - echo "." - ;; - *) - echo "Usage: /etc/init.d/pptp {start|stop|reconnect}" - exit 1 - ;; -esac - -exit 0 -EOF - -chmod +x /etc/init.d/pptp -touch /var/log/pptp.log -/etc/init.d/pptp start -$DIALOG --title "Information" --no-cancel --msgbox "Please click OK and wait until remote IP is assigned." 0 0 -$DIALOG --title "PPTP Log" --no-cancel --tailbox /var/log/pptp.log 0 0 -} - -[ -n "$VPNSERVER" ] || VPNSERVER="10.0.0.138" -[ -n "$VPNUSERNAME" ] || VPNUSERNAME="$(cat /etc/ppp/pap-secrets | grep XDSL | cut -d " " -f1)" -[ -n "$VPNPASSWORD" ] || VPNPASSWORD="$(cat /etc/ppp/pap-secrets | grep XDSL | cut -d " " -f3)" - -if [ -z "$VPNUSERNAME" ] || [ -z "$VPNPASSWORD" ] ; then - - COMMAND1=$($DIALOG --stdout --title "Inode XDSL Graz" --inputbox \ - "Account name (e.g. grml@tug):" 0 35) || exit 0 - COMMAND2=$($DIALOG --stdout --title "Inode XDSL Graz" --passwordbox "Account password (hidden typing):" 0 40) || exit 0 - - TMP=$(mktemp) - - bailout(){ - rm -f "$TMP" - exit $1 - } - - NETDEVICES="$(grep -ve 'lo:' -ve 'Inter-|' -ve 'face |bytes' /proc/net/dev | awk -F: '{print $1}')" - - wireless(){ - [ -d "/sys/class/net/${1}/wireless" ] && return 0 - # Card exists but is not configured yet - [ -n "$(iwconfig $1 2>/dev/null | head -1)" ] && return 0 - return 1 - } - - if [ -z "$NETDEVICES" ]; then - $DIALOG --msgbox "No network devices found." 15 45 - bailout - fi - - count="$(echo "$NETDEVICES" | wc -w)" - - if [ "$count" -gt 1 ]; then - DEVICELIST="" - for DEVICE in $NETDEVICES; do - wireless "$DEVICE" && DEVICELIST="$DEVICELIST ${DEVICE} Wireless" || DEVICELIST="$DEVICELIST ${DEVICE} LAN" - done - rm -f "$TMP" - $DIALOG --menu "Network device to connect from:" 18 45 12 $DEVICELIST 2>"$TMP" || bailout - read NET_DEVICE <"$TMP" ; rm -f "$TMP" - else - # Remove additional spaces - NET_DEVICE="$(echo $NETDEVICES)" - fi - - VPNUSERNAME=${COMMAND1%/*} - VPNPASSWORD=${COMMAND2#*/} - [ ! -z "$VPNUSERNAME" ] || exit 1 - [ ! -z "$VPNPASSWORD" ] || exit 1 - [ ! -z "$NET_DEVICE" ] || exit 1 - runit - setroute -else - $DIALOG --title "Inode XDSL Graz" --msgbox "Found already configured - account.\nIf the settings are wrong, delete the entries in - /etc/ppp/pap-secrets" 10 45 - runit -fi - -## END OF FILE #################################################################