1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Retrieve key for OpenVPN when needed

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-07-16 16:01:54 +02:00
parent cf82f4e3fa
commit fdb2acf85e

View file

@ -95,11 +95,16 @@ _set_openvpn_vps() {
[ "$enabled" != "1" ] && echo "OpenVPN disabled" && return
port="$(uci -q get openvpn.omr.port)"
cipher="$(uci -q get openvpn.omr.cipher)"
local current_port current_cipher
key="$(base64 /etc/luci-uploads/client.key | tr -d "\n")"
local current_port current_cipher current_key
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
[ -z "$vps_config" ] && return
current_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_key')"
current_port="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.port')"
current_cipher="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.cipher')"
if [ "$curent_key" != "$key" ]; then
uci -q set openmptcprouter.${servername}.get_config="1"
fi
if [ "$current_port" != "$port" ] || [ "$current_cipher" != "$cipher" ]; then
local settings
settings='{"port": '$port', "cipher": "'$cipher'"}'