initial commit of file from CVS for smeserver-openvpn-routed on Thu 6 Mar 14:40:52 GMT 2025
This commit is contained in:
30
root/sbin/e-smith/systemd/openvpn-routed
Normal file
30
root/sbin/e-smith/systemd/openvpn-routed
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ ! -f /etc/openvpn/routed/pub/cert.pem && -f /etc/openvpn/bridge/pub/cert.pem ]] && cp -a /etc/openvpn/bridge/pub/cert.pem /etc/openvpn/routed/pub/cert.pem
|
||||
[[ ! -f /etc/openvpn/routed/pub/cacert.pem && -f /etc/openvpn/bridge/pub/cacert.pem ]] && cp -a /etc/openvpn/bridge/pub/cacert.pem /etc/openvpn/routed/pub/cacert.pem
|
||||
[[ ! -f /etc/openvpn/routed/pub/dh.pem && -f /etc/openvpn/bridge/pub/dh.pem ]] && cp -a /etc/openvpn/bridge/pub/dh.pem /etc/openvpn/routed/pub/dh.pem
|
||||
[[ ! -f /etc/openvpn/routed/priv/key.pem && -f /etc/openvpn/bridge/priv/key.pem ]] && cp -a /etc/openvpn/bridge/priv/key.pem /etc/openvpn/routed/priv/key.pem
|
||||
[[ ! -f /etc/openvpn/routed/priv/takey.pem && -f /etc/openvpn/bridge/priv/takey.pem ]] && cp -a /etc/openvpn/bridge/priv/takey.pem /etc/openvpn/routed/priv/takey.pem
|
||||
if [[ ! -f /etc/openvpn/routed/pub/cacrl.pem && -f /etc/openvpn/bridge/pub/cacrl.pem ]] ; then
|
||||
cp -a /etc/openvpn/bridge/pub/cacrl.pem /etc/openvpn/routed/pub/cacrl.pem
|
||||
CrlUrl=`/sbin/e-smith/config getprop openvpn-bridge CrlUrl`
|
||||
/sbin/e-smith/config setprop openvpn-routed CrlUrl "$CrlUrl="
|
||||
|
||||
myport=`/sbin/e-smith/config getprop openvpn-routed UDPPort`
|
||||
oriport="$myiport"
|
||||
bridgeport=`/sbin/e-smith/config getprop openvpn-bridge UDPPort`
|
||||
s2sports=`/sbin/e-smith/db openvpn-s2s print |sed -re 's/.*Port\|([0-9]+).*/\1/'|sort|uniq`
|
||||
while [[ $s2sports =~ $myport || $myport == $bridgeport ]]
|
||||
do
|
||||
myport=$[$myport+1]
|
||||
done
|
||||
if [[ $myport != $oriport ]]; then
|
||||
echo "set UDPPort to $myport as $oriport was already taken"
|
||||
/sbin/e-smith/db configuration setprop openvpn-routed UDPPort $myport
|
||||
/sbin/e-smith/expand-template /etc/openvpn/routed/openvpn.conf
|
||||
fi
|
||||
fi
|
||||
chmod 0600 /etc/openvpn/routed/priv/*
|
||||
chmod 0644 /etc/openvpn/routed/pub/*
|
||||
chown root:admin /etc/openvpn/routed/priv/*
|
||||
chown root:admin /etc/openvpn/routed/pub/*
|
Reference in New Issue
Block a user