Browse Source

Moar semantics + improved debugging?

Alexandre Aubin 3 years ago
parent
commit
5e452f56b1
3 changed files with 19 additions and 4 deletions
  1. 15 1
      conf/ynh-vpnclient
  2. 3 2
      config_panel.toml
  3. 1 1
      scripts/config

+ 15 - 1
conf/ynh-vpnclient

@@ -446,7 +446,21 @@ case "${1}" in
       ynh-hotspot start
     fi
 
-    success "YunoHost VPN client started!"
+    ping -c1 -w5 debian.org >/dev/null
+
+    ipv4=$(ping -w3 -c1 ip.yunohost.org  >/dev/null 2>&1 && curl --max-time 5 https://ip.yunohost.org --silent)
+    ipv6=$(ping -w3 -c1 ip6.yunohost.org >/dev/null 2>&1 && curl --max-time 5 https://ip6.yunohost.org --silent)
+
+    info "Validating that VPN is up and the server is connected to internet..."
+    if ip route get 1.2.3.4 | grep -q tun0; then
+        if ping -c1 -w5 debian.org >/dev/null; then
+            success "YunoHost VPN client started!"
+        else
+            critical "The VPN is up but debian.org cannot be reached, indicating that something is probably misconfigured/blocked."
+        fi
+    else
+        critical "IPv4 routes are misconfigured !?"
+    fi
   ;;
 
   # ########## #

+ 3 - 2
config_panel.toml

@@ -18,9 +18,10 @@ name = "Auto-configuration"
         help = "If disabled, the VPN service will not automatically be started at boot."
         
         [main.vpn.doc]
-        ask = "Only VPN with a dedicated public ip that accept inbound traffic are compatible. See the [compatible providers list](https://yunohost.org/providers/vpn)."
+        ask.en = "VPNclient only interfaces with *dedicated, public IP VPNs accepting inbound traffic*, preferably with an associated `.cube` (or `.ovpn/.conf`) configuration file. Checkout the [list of known compatible providers](https://yunohost.org/providers/vpn) for more info."
+        ask.fr = "VPNclient est prévu pour fonctionner avec des *VPN dédiés et à IP publique qui acceptent le traffic entrant*, et de préférence avec un fichier de configuration `.cube` (ou `.ovpn/.conf`) associé. Consultez [la liste des fournisseurs connus et compatibles](https://yunohost.org/providers/vpn) pour plus d'infos."
         type = "alert"
-        style = "warning"
+        style = "info"
 
         [main.vpn.config_file]
         ask = "Configuration file"

+ 1 - 1
scripts/config

@@ -42,7 +42,7 @@ get__status() {
     ipv4=$(ping -w3 -c1 ip.yunohost.org  >/dev/null 2>&1 && curl --max-time 5 https://ip.yunohost.org --silent)
     ipv6=$(ping -w3 -c1 ip6.yunohost.org >/dev/null 2>&1 && curl --max-time 5 https://ip6.yunohost.org --silent)
 
-    if ip route get 1.2.3.4 | grep -q tun0 && [[ -n "$ipv4" -o -n "$ipv6" ]]
+    if ip route get 1.2.3.4 | grep -q tun0 && [[ -n "$ipv4" ]]
     then
         if [ $service_enabled -eq 1 ]
         then