Updated sample script.

This commit is contained in:
Nikos Mavrogiannopoulos
2013-03-13 19:19:45 +01:00
parent b552f27ddb
commit 9224a02b77
5 changed files with 22 additions and 19 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
EXTRA_DIST = design.dia sample.config scripts/ocserv-up scripts/ocserv-down EXTRA_DIST = design.dia sample.config scripts/ocserv-script
dist_man_MANS = ocserv.8 dist_man_MANS = ocserv.8
+2 -2
View File
@@ -2,7 +2,7 @@
# all should succeed. # all should succeed.
# Options: certificate, pam. # Options: certificate, pam.
#auth = "certificate" #auth = "certificate"
auth = "plain[/tmp/passwd]" auth = "plain[./passwd]"
#auth = "pam" #auth = "pam"
# A banner to be displayed on clients # A banner to be displayed on clients
@@ -102,7 +102,7 @@ cookie-validity = 172800
# Script to call when a client connects and obtains an IP # Script to call when a client connects and obtains an IP
# Parameters are passed on the environment. # Parameters are passed on the environment.
# USERNAME, GROUPNAME, HOSTNAME (the hostname selected by client), # REASON, USERNAME, GROUPNAME, HOSTNAME (the hostname selected by client),
# DEVICE, IP_REAL (the real IP of the client), IP_LOCAL (the local IP # DEVICE, IP_REAL (the real IP of the client), IP_LOCAL (the local IP
# in the P-t-P connect), IP_REMOTE (the VPN IP of the client). # in the P-t-P connect), IP_REMOTE (the VPN IP of the client).
#connect-script = /usr/bin/myscript #connect-script = /usr/bin/myscript
-5
View File
@@ -1,5 +0,0 @@
#!/bin/sh
iptables -D INPUT -i $DEVICE -j ACCEPT
echo "User '$USERNAME' from '$IP_REAL' disconnected."
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
if [ "$REASON" = "connect" ];then
# Disable the firewall for the user's device
iptables -A INPUT -i $DEVICE -j ACCEPT
if [ "$GROUPNAME" != "admins" ];then
#rate limit the tun device to 64kbyte
wondershaper $DEVICE 524288 524288
fi
echo "User '$USERNAME' from '$IP_REAL' connected. Local IP is '$IP_REMOTE'"
else
iptables -D INPUT -i $DEVICE -j ACCEPT
echo "User '$USERNAME' from '$IP_REAL' disconnected."
fi
exit 0
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
# Disable the firewall for the user's device
iptables -A INPUT -i $DEVICE -j ACCEPT
if [ "$GROUPNAME" != "admins" ];then
#rate limit the tun device to 64kbyte
wondershaper $DEVICE 524288 524288
fi
echo "User '$USERNAME' from '$IP_REAL' connected. Local IP is '$IP_REMOTE'"