added new files
This commit is contained in:
19
70-vpn-active
Executable file
19
70-vpn-active
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
export LANG='en_US.UTF-8'
|
||||
|
||||
echo ""
|
||||
echo "Active OVPN clienst:"
|
||||
mapfile -t common < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $2}')
|
||||
mapfile -t virtual < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $4}')
|
||||
mapfile -t sent < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $6}')
|
||||
mapfile -t received < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g' | grep ^CLIENT_LIST| sort | awk '{print $5}')
|
||||
mapfile -t connected < <(sudo tail -n +4 /var/log/openvpn/openvpn-status.log | ssed -R 's/\s+/_/g ; s/,/ /g; s/(Mon_|Tue_|Wed_|Sat_|Thu_|Sat_|Sun_)//g ; s/:[0-9][0-9]_/_/g' | grep ^CLIENT_LIST| sort | awk '{print $7}')
|
||||
out2="Common Name,Virtual Address,Connected Since,▼,▲\n"
|
||||
for k in "${!common[@]}"; do
|
||||
if [ "${common[k]}" != "UNDEF" ]; then
|
||||
rec=$((${received[k]}/1024/1024))Mb
|
||||
sen=$((${sent[k]}/1024/1024))Mb
|
||||
out2+=${common[k]},${virtual[k]},${connected[k]},${rec},${sen}"\n"
|
||||
fi
|
||||
done
|
||||
printf "$out2" | column -ts ',' | sed 's/_/ /g'
|
||||
15
70-vpn-keys
Executable file
15
70-vpn-keys
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
CONFIG_DIR=/etc/openvpn/ca
|
||||
echo ""
|
||||
echo "List of OVPN keys:"
|
||||
mapfile -t keys < <(sudo cat ${CONFIG_DIR}/pki/index.txt |grep ^V | grep -v server | grep -oh /CN=[[:alnum:]]* | sed -e 's/\/CN=//g')
|
||||
out="Name, Expires\n"
|
||||
for i in "${!keys[@]}"; do
|
||||
IFS=" " read name <<< ${keys[i]}
|
||||
out+="${name},"
|
||||
out+=$(sudo cat ${CONFIG_DIR}/pki/issued/${name}.crt | grep ^' Not After :' | sed -e 's/ Not After :// ; s/ GMT//g ; s/:[0-9][0-9] / /')
|
||||
out+="\n"
|
||||
done
|
||||
printf "$out" | column -ts $','
|
||||
echo ""
|
||||
@@ -15,6 +15,9 @@ It just Messange Of The Day for linux ssh and terminal.
|
||||
- Needed for working module 60-docker
|
||||
* lxd
|
||||
- Needed for working module 60-lxd
|
||||
* ssed
|
||||
- Needed for working module 70-vpn-active
|
||||
|
||||
|
||||
# Screenshot
|
||||

|
||||
@@ -30,3 +33,9 @@ sudo chown root:root *
|
||||
sudo cp * /etc/update-motd.d/
|
||||
sudo update-motd
|
||||
```
|
||||
|
||||
# Update 08.09.2021
|
||||
* Added module for track Openvpn keys (i use easyrsa for generating keys) and active connections
|
||||
|
||||
#P.S.
|
||||
*In folder with openvpn config (`/etc/openvpn/`) locating directory with Certifiration Autority. Some files reading directly from CA (`/etc/openvpn/ca/pki/`)
|
||||
BIN
screenshot/screen.png
Executable file → Normal file
BIN
screenshot/screen.png
Executable file → Normal file
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 69 KiB |
Reference in New Issue
Block a user