-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (openvpn_clients): add pfsense agent plugin
- Loading branch information
1 parent
8d263fb
commit fd5d3c9
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/local/bin/bash | ||
|
||
# (c) 2022 Heinlein Support GmbH | ||
# Robert Sander <[email protected]> | ||
# | ||
# pfSense edition by | ||
# Gianluca Stella <gianluca (dot) stella (at) gmail . com> | ||
|
||
|
||
# This is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation in version 2. This file is distributed | ||
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- | ||
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
# PARTICULAR PURPOSE. See the GNU General Public License for more de- | ||
# ails. You should have received a copy of the GNU General Public | ||
# License along with GNU Make; see the file COPYING. If not, write | ||
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
# Boston, MA 02110-1301 USA. | ||
|
||
if ls /var/run/openvpn_*.pid 1> /dev/null 2>&1; then | ||
|
||
for f in /var/etc/openvpn/server*/sock | ||
do | ||
conffile="`echo $f | sed -n -e 's/sock/config.ovpn/p'`" | ||
insta="`cat $conffile | grep \"dev \" | sed -n -e \"s/dev //p\"`" | ||
|
||
status="`( echo \"status\" ; sleep 1 ; echo \"quit\" ) | nc -U $f`" | ||
|
||
echo '<<<openvpn_clients:sep(44)>>>' | ||
echo "[[$insta]]" | ||
echo "$status" | sed -n -e '/CLIENT LIST/,/ROUTING TABLE/p' | sed -e 1,3d -e '$d' | ||
done | ||
fi |