~fkooman/vpn-maint-scripts

ref: 1.2.0 vpn-maint-scripts/bin/vpn-maint-apply-changes -rwxr-xr-x 593 bytes
ed277a5eFrançois Kooman update CHANGES 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

if ! [ "root" = "$(id -u -n)" ]; then
    echo "ERROR: ${0} must be run as root!"; exit 1
fi

# Disable & Stop OpenVPN
for CONFIG_NAME in $(systemctl list-units "openvpn-server@*" --no-legend | cut -d ' ' -f 1)
do
    systemctl disable --now "${CONFIG_NAME}"
done

# Delete OpenVPN Configuration
rm -rf /etc/openvpn/server/*

# Regenerate OpenVPN Configuration 
vpn-server-node-server-config

# Enable & Start OpenVPN
for CONFIG_NAME in /etc/openvpn/server/*.conf
do
    CONFIG_NAME=$(basename "${CONFIG_NAME}" .conf)
    systemctl enable --now "openvpn-server@${CONFIG_NAME}"
done