aboutsummaryrefslogtreecommitdiff
path: root/vpn/svpnsh
diff options
context:
space:
mode:
Diffstat (limited to 'vpn/svpnsh')
-rwxr-xr-xvpn/svpnsh10
1 files changed, 5 insertions, 5 deletions
diff --git a/vpn/svpnsh b/vpn/svpnsh
index 0185fc2..35f4eb1 100755
--- a/vpn/svpnsh
+++ b/vpn/svpnsh
@@ -1,9 +1,9 @@
1#! /bin/sh 1#! /bin/sh
2# svpnsh -- a simple vpn-only shell 2# svpnsh -- a simple vpn-only shell
3# Copyright (C) 2007 Sergey Poznyakoff 3# Copyright (C) 2007, 2009 Sergey Poznyakoff
4# 4#
5# This program is free software; you can redistribute it and/or modify 5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or 7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version. 8# (at your option) any later version.
9# 9#
@@ -17,25 +17,25 @@
17 17
18PAIR=`sed -n "s/^${USER%%+vpn}=\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}:[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/p" /usr/local/etc/vpn.conf` 18PAIR=`sed -n "s/^${USER%%+vpn}=\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}:[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/p" /usr/local/etc/vpn.conf`
19 19
20logmsg() { 20logmsg() {
21 prio=$1 21 prio=$1
22 shift 22 shift
23 /usr/bin/logger -t vpnsh -p auth.$prio $* 23 /usr/bin/logger -t svpnsh -p auth.$prio $*
24} 24}
25 25
26logmsg debug "USER=$USER, PAIR=$PAIR" 26logmsg debug "USER=$USER, PAIR=$PAIR"
27 27
28if [ -z "$PAIR" ]; then 28if [ -z "$PAIR" ]; then
29 logmsg notice "$USER: access denied" 29 logmsg notice "$USER: access denied"
30 exit 1 30 exit 1
31fi 31fi
32 32
33NLOGINS=`who -q | sed '2,$d' | tr ' ' '\n' | sort | sed '1d' | uniq -c | 33sdup=`who -q | sed '/^#/d' | tr -s ' ' '\n' | sort | uniq -d | grep "$USER"`
34 awk "\\$2==\"$USER\" { print \\$1 }"` 34
35if [ ${NLOGINS:-0} -gt 1 ] 35if [ -n "$sdup" ]
36then 36then
37 logmsg notice "$USER: too many concurrent logins" 37 logmsg notice "$USER: too many concurrent logins"
38 exit 1 38 exit 1
39fi 39fi
40 40
41logmsg notice "$USER: starting ppp" 41logmsg notice "$USER: starting ppp"

Return to:

Send suggestions and report system problems to the System administrator.