added isDomainReal function to test beforehand if the domain has an A or AAAA record
This commit is contained in:
parent
ea352a045a
commit
b60bd7a115
|
@ -134,6 +134,16 @@ if (isset($_POST['submit'])) {
|
||||||
// Check existing SSL certificate
|
// Check existing SSL certificate
|
||||||
$domainsIncluded = array();
|
$domainsIncluded = array();
|
||||||
foreach ($_SESSION['letsencrypt-domains'] as $domain) {
|
foreach ($_SESSION['letsencrypt-domains'] as $domain) {
|
||||||
|
|
||||||
|
$isDomainReal = $letsencrypt->isDomainReal($domain);
|
||||||
|
|
||||||
|
if ($isDomainReal === false) {
|
||||||
|
$errorMessage = "Erreur : le domaine " . $domain . " n'existe pas. Veuillez vérifier les enregistrements DNS.";
|
||||||
|
|
||||||
|
array_push($messages, ["type" => "error", "content" => $errorMessage]);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
|
||||||
$existingSSLCertificate = $letsencrypt->getCertificate($domain);
|
$existingSSLCertificate = $letsencrypt->getCertificate($domain);
|
||||||
// if no certificate is present (false returned) for this domain, go to the next domain
|
// if no certificate is present (false returned) for this domain, go to the next domain
|
||||||
if (is_bool($existingSSLCertificate)) {
|
if (is_bool($existingSSLCertificate)) {
|
||||||
|
|
|
@ -27,6 +27,20 @@ class LetsEncrypt
|
||||||
sudoexec($cmd, $data_output, $exec_return);
|
sudoexec($cmd, $data_output, $exec_return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* verify if the domain exists
|
||||||
|
* @param string $domain
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isDomainReal($domain)
|
||||||
|
{
|
||||||
|
if (checkdnsrr($domain, 'A') || checkdnsrr($domain, 'AAAA')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate a CSR
|
* generate a CSR
|
||||||
* @param string $vhost
|
* @param string $vhost
|
||||||
|
|
Loading…
Reference in a new issue