diff --git a/includes/openvpn.php b/includes/openvpn.php index eae9c42d..a89c3e18 100755 --- a/includes/openvpn.php +++ b/includes/openvpn.php @@ -42,11 +42,9 @@ function DisplayOpenVPNConfig() } exec('pidof openvpn | wc -l', $openvpnstatus); - exec('wget https://ipinfo.io/ip -qO -', $return); - $serviceStatus = $openvpnstatus[0] == 0 ? "down" : "up"; $auth = file(RASPI_OPENVPN_CLIENT_LOGIN, FILE_IGNORE_NEW_LINES); - $public_ip = $return[0]; + $public_ip = get_public_ip(); // parse client auth credentials if (!empty($auth)) { diff --git a/includes/wireguard.php b/includes/wireguard.php index af81a618..162e3eef 100644 --- a/includes/wireguard.php +++ b/includes/wireguard.php @@ -58,12 +58,14 @@ function DisplayWireGuardConfig() exec('pidof wg-crypt-wg0 | wc -l', $wgstatus); $serviceStatus = $wgstatus[0] == 0 ? "down" : "up"; $wg_state = ($wgstatus[0] > 0); + $public_ip = get_public_ip(); echo renderTemplate( "wireguard", compact( "status", "wg_state", "serviceStatus", + "public_ip", "optRules", "wg_log", "peer_id", @@ -132,7 +134,7 @@ function SaveWireGuardUpload($status, $file, $optRules) file_put_contents($tmp_wgconfig, $tmp_contents); } - // Move uploaded file from to destination + // Move processed file from tmp to destination system("sudo mv $tmp_wgconfig ". RASPI_WIREGUARD_CONFIG, $return); if ($return ==0) { diff --git a/templates/wg/general.php b/templates/wg/general.php index 00d840ac..c9b63071 100644 --- a/templates/wg/general.php +++ b/templates/wg/general.php @@ -3,6 +3,12 @@