From 1dd5fcb352b00446c04b59a0fe33e8d374eddd4b Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 27 Apr 2022 23:56:23 +0200 Subject: [PATCH] Wireguard: fix import function to accept all keys --- plugins/dynamix/include/update.wireguard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dynamix/include/update.wireguard.php b/plugins/dynamix/include/update.wireguard.php index 44ea306be..d9cf7004e 100644 --- a/plugins/dynamix/include/update.wireguard.php +++ b/plugins/dynamix/include/update.wireguard.php @@ -23,7 +23,7 @@ $dockerd = is_file('/var/run/dockerd.pid') && is_dir('/proc/'.file_get_content $etc = '/etc/wireguard'; $validIP4 = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}"; $validIP6 = "(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(:|([0-9a-fA-F]{1,4}:)+):(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?)"; -$normalize = ['address'=>'Address', 'dns'=>'DNS', 'privatekey'=>'PrivateKey', 'publickey'=>'PublicKey', 'allowedips'=>'AllowedIPs', 'endpoint'=>'Endpoint']; +$normalize = ['address'=>'Address', 'dns'=>'DNS', 'privatekey'=>'PrivateKey', 'publickey'=>'PublicKey', 'allowedips'=>'AllowedIPs', 'endpoint'=>'Endpoint','listenport'=>'ListenPort','mtu'=>'MTU','persistentkeepalive'=>'PersistentKeepalive']; $dockernet = "172.31"; $t1 = '10'; // 10 sec timeout @@ -91,7 +91,7 @@ function vtun() { function normalize(&$id) { // ensure correct capitalization of keywords, some VPN providers use the wrong case global $normalize; - $id = $normalize[strtolower($id)]; + $id = $normalize[strtolower($id)] ?? $id; } function dockerNet($vtun) { return empty(exec("docker network ls --filter name='$vtun' --format='{{.Name}}'"));