]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7008 @0:30
authorsoufiane <soufiane@cubedesigners.com>
Tue, 30 Jul 2024 13:24:29 +0000 (15:24 +0200)
committersoufiane <soufiane@cubedesigners.com>
Tue, 30 Jul 2024 13:24:29 +0000 (15:24 +0200)
app/Models/FluidbookExternalInstallServer.php

index 458ebc9fe0b57ccd18893bc46ad4017b3d9168bb..310ab49e1e079284741a37baa676ca7c962fd763 100644 (file)
@@ -171,6 +171,27 @@ class FluidbookExternalInstallServer extends ExternalServer
 
         $res = [];
 
+        if($isHosting) {
+            $hosting = $data['protocol'] === 'hosting' ? 'hosting.fluidbook.com' : ($data['protocol'] === 'hosting2' ? 'hosting2.fluidbook.com' : 'us.hosting.fluidbook.com');
+            $ipHosting = dns_get_record($hosting, DNS_A)[0]['ip'];
+
+            $subdomains = explode("\r\n", $data['subdomains']);
+            $subdomainsIntruder = [];
+
+            if ($subdomains) {
+                foreach ($subdomains as $subdomain) {
+                    $ipSubdomain = trim(str_replace('\n', '', shell_exec('dig +short @1.1.1.1 ' . $subdomain . ' | tail -1')));
+                    if ($ipSubdomain !== $ipHosting) {
+                        $subdomainsIntruder[] = $subdomain;
+                    }
+                }
+            }
+            if ($subdomainsIntruder) {
+                $subdomainsList = implode(", ", $subdomainsIntruder);
+                $check = ['subdomains' => $subdomainsList, 'host' => $hosting];
+            }
+        }
+
         if ($check === true) {
             $res['success'] = true;
             $res['message'] = __("La connexion a été établie avec succès");