mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
Retrieve key for OpenVPN when needed
This commit is contained in:
parent
cf82f4e3fa
commit
fdb2acf85e
1 changed files with 6 additions and 1 deletions
|
@ -95,11 +95,16 @@ _set_openvpn_vps() {
|
||||||
[ "$enabled" != "1" ] && echo "OpenVPN disabled" && return
|
[ "$enabled" != "1" ] && echo "OpenVPN disabled" && return
|
||||||
port="$(uci -q get openvpn.omr.port)"
|
port="$(uci -q get openvpn.omr.port)"
|
||||||
cipher="$(uci -q get openvpn.omr.cipher)"
|
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" ] && vps_config=$(_get_json "config")
|
||||||
[ -z "$vps_config" ] && return
|
[ -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_port="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.port')"
|
||||||
current_cipher="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.cipher')"
|
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
|
if [ "$current_port" != "$port" ] || [ "$current_cipher" != "$cipher" ]; then
|
||||||
local settings
|
local settings
|
||||||
settings='{"port": '$port', "cipher": "'$cipher'"}'
|
settings='{"port": '$port', "cipher": "'$cipher'"}'
|
||||||
|
|
Loading…
Reference in a new issue