mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-14 02:22:03 +08:00
Updated sample script.
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
# all should succeed.
|
||||
# Options: certificate, pam.
|
||||
#auth = "certificate"
|
||||
auth = "plain[/tmp/passwd]"
|
||||
auth = "plain[./passwd]"
|
||||
#auth = "pam"
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# in the P-t-P connect), IP_REMOTE (the VPN IP of the client).
|
||||
#connect-script = /usr/bin/myscript
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
iptables -D INPUT -i $DEVICE -j ACCEPT
|
||||
|
||||
echo "User '$USERNAME' from '$IP_REAL' disconnected."
|
||||
Executable
+19
@@ -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
|
||||
@@ -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'"
|
||||
Reference in New Issue
Block a user