-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add client connection status information on stdout.
OpenVPN daemon logs are redirected to stderr from now on.
- Loading branch information
1 parent
0c1956e
commit 6534a21
Showing
4 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
statusfile=$1 | ||
|
||
while true; do | ||
sleep 60 | ||
if [ ! -r $statusfile ]; then | ||
echo "Cannot read statusfile at $statusfile" | ||
break | ||
fi | ||
while read line; do | ||
IFS=',' read -r -a client <<< $line | ||
|
||
# Opportunistic filtering, only the client section has 5 fields | ||
if [ ! -z "${client[4]}" -a "${client[0]}" != "Common Name" ]; then | ||
echo -e "{ \"common_name\": \"${client[0]}\", \"bytes_received\": ${client[2]}, \"bytes_sent\": ${client[3]}, \"connected_since\": \"${client[4]}\" }" | ||
fi | ||
done < $statusfile | ||
done |