mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-08-09 09:51:49 +08:00
Added the STATS_DURATION script environment variable.
This variable reports the duration of the session in seconds.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
* Version 0.3.5 (unreleased)
|
* Version 0.3.5 (unreleased)
|
||||||
|
|
||||||
- Corrected issue in the stats reporting for resumed processes.
|
- Corrected issue in the stats reporting for resumed processes.
|
||||||
|
- Added the STATS_DURATION script environment variable which reports
|
||||||
|
the duration of the session in seconds.
|
||||||
|
|
||||||
|
|
||||||
* Version 0.3.4 (released 2014-05-01)
|
* Version 0.3.4 (released 2014-05-01)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ if [ "$REASON" = "connect" ];then
|
|||||||
else
|
else
|
||||||
iptables -D INPUT -i $DEVICE -j ACCEPT
|
iptables -D INPUT -i $DEVICE -j ACCEPT
|
||||||
|
|
||||||
echo "User '$USERNAME' from '$IP_REAL' disconnected (in: $STATS_BYTES_IN, out: $STATS_BYTES_OUT)."
|
echo "User '$USERNAME' from '$IP_REAL' disconnected (in: $STATS_BYTES_IN, out: $STATS_BYTES_OUT, time: $STATS_DURATION)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -129,6 +129,10 @@ const char* script;
|
|||||||
setenv("STATS_BYTES_IN", remote, 1);
|
setenv("STATS_BYTES_IN", remote, 1);
|
||||||
snprintf(remote, sizeof(remote), "%lu", (unsigned long)proc->bytes_out);
|
snprintf(remote, sizeof(remote), "%lu", (unsigned long)proc->bytes_out);
|
||||||
setenv("STATS_BYTES_OUT", remote, 1);
|
setenv("STATS_BYTES_OUT", remote, 1);
|
||||||
|
if (proc->conn_time > 0) {
|
||||||
|
snprintf(remote, sizeof(remote), "%lu", (unsigned long)(time(0)-proc->conn_time));
|
||||||
|
setenv("STATS_DURATION", remote, 1);
|
||||||
|
}
|
||||||
setenv("REASON", "disconnect", 1);
|
setenv("REASON", "disconnect", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -234,8 +234,8 @@ rekey-method = ssl
|
|||||||
# ID (a unique numeric ID); REASON may be "connect" or "disconnect".
|
# ID (a unique numeric ID); REASON may be "connect" or "disconnect".
|
||||||
|
|
||||||
# The disconnect script will received the additional values: STATS_BYTES_IN,
|
# The disconnect script will received the additional values: STATS_BYTES_IN,
|
||||||
# STATS_BYTES_OUT, that contain a 64-bit counter of the bytes output from the
|
# STATS_BYTES_OUT, STATS_DURATION that contain a 64-bit counter of the bytes
|
||||||
# tun device.
|
# output from the tun device, and the duration of the session in seconds.
|
||||||
|
|
||||||
#connect-script = /usr/bin/myscript
|
#connect-script = /usr/bin/myscript
|
||||||
#disconnect-script = /usr/bin/myscript
|
#disconnect-script = /usr/bin/myscript
|
||||||
|
|||||||
Reference in New Issue
Block a user