diff --git a/src/Commands/Auto.php b/src/Commands/Auto.php index e71bd0a..7a9c29c 100644 --- a/src/Commands/Auto.php +++ b/src/Commands/Auto.php @@ -185,6 +185,8 @@ class Auto implements Command { $storage, "--name", $commonName, + "--names", + implode(",", $domains), ]; $command = implode(" ", array_map("escapeshellarg", $args)); diff --git a/src/Commands/Check.php b/src/Commands/Check.php index ef5c794..82b1b3b 100644 --- a/src/Commands/Check.php +++ b/src/Commands/Check.php @@ -45,6 +45,18 @@ class Check implements Command { $this->climate->br(); $this->climate->whisper(" Certificate is valid until " . date("d.m.Y", $cert->getValidTo()))->br(); + if ($args->exists("names")) { + $names = array_map("trim", explode(",", $args->get("names"))); + $missingNames = array_diff($names, $cert->getNames()); + + if ($missingNames) { + $this->climate->comment(" The following names are not covered: " . implode(", ", $missingNames))->br(); + + yield new CoroutineResult(1); + return; + } + } + if ($cert->getValidTo() > time() + $args->get("ttl") * 24 * 60 * 60) { yield new CoroutineResult(0); return; @@ -70,6 +82,11 @@ class Check implements Command { "defaultValue" => 30, "castTo" => "int", ], + "names" => [ + "longPrefix" => "names", + "description" => "Names that must be covered by the certificate identified based on the common name. Names have to be separated by commas.", + "required" => false, + ], ]; } } \ No newline at end of file