Browse Source

check if the domain IP correspond to the server IP

pull/63/head
Nicolas Roman 1 year ago
parent
commit
9c9ffe1b53
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      lib/letsencrypt.php

+ 2
- 1
lib/letsencrypt.php View File

@ -95,6 +95,7 @@ class LetsEncrypt
public function checkDNSValidity($domains)
{
$valid_dns_domains = array();
$serverIP = exec("ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\\1/p'");
foreach ($domains as $domain) {
//FQDN syntax
@ -102,7 +103,7 @@ class LetsEncrypt
$dns_record_ipv4 = dns_get_record($domain, DNS_A);
$dns_record_ipv6 = dns_get_record($domain, DNS_AAAA);
if ($dns_record_ipv4 || $dns_record_ipv6) {
if ($dns_record_ipv4[0]['ip'] === $serverIP || $dns_record_ipv6[0]['ip'] === $serverIP) {
// remove the last dot added for the FQDN syntax
$domain = rtrim($domain, '.');
array_push($valid_dns_domains, $domain);


Loading…
Cancel
Save