Inheritance: use trait DirectAdmin\LetsEncrypt\Lib\Utility\ConfigurableTrait
 /**
  * Solve a challenge
  *
  * @throws \Exception
  */
 public function solveChallenge()
 {
     if (empty($this->solvableChallenges)) {
         $this->solvableChallenges();
     }
     $domains = array_merge((array) $this->domain->getDomain(), $this->subdomains);
     foreach ($domains as $domain) {
         $challenge = $this->challenges[$domain][reset($this->solvableChallenges[$domain])];
         if ($challenge->solvable()) {
             $challenge->solve();
         } else {
             throw new \Exception('Defined unsolvable challenge for ' . $domain);
         }
     }
 }
 /**
  * Solve a challenge
  *
  * @throws \Exception
  */
 public function solveChallenge()
 {
     if (empty($this->solvableChallenges)) {
         $this->solvableChallenges();
     }
     $domains = array_merge((array) $this->domain->getDomain(), $this->subdomains);
     foreach ($domains as $domain) {
         $challenge = $this->challenges[$domain][reset($this->solvableChallenges[$domain])];
         if ($challenge->solvable()) {
             try {
                 $challenge->solve();
             } catch (\Exception $e) {
                 throw new \Exception('Exception while solving challenge for ' . $domain . ': ' . $e->getMessage(), $e->getCode(), $e);
             }
         } else {
             throw new \Exception('Defined unsolvable challenge for ' . $domain);
         }
     }
 }
Example #3
0
 }
 $log->log('Processing user ' . $account->getUsername());
 if (!$account->loadKeys()) {
     $log->log('No keys present at user ' . $account->getUsername());
     continue;
 }
 $account->setEmail($account->config('email'));
 // Get all domains of the user
 $domains = file_get_contents($usersPath . DIRECTORY_SEPARATOR . $account->getUsername() . DIRECTORY_SEPARATOR . 'domains.list');
 // Loop through all domains of the user
 foreach (explode("\n", $domains) as $domain) {
     if (empty($domain)) {
         continue;
     }
     // Replace the $domain with our Domain object,
     $domain = new Domain($domain, $account);
     if (!$domain->existsInStorage('config.json')) {
         $log->log('Skipped domain ' . $domain->getDomain());
         continue;
     }
     $log->log('Processing domain ' . $domain->getDomain());
     // Check if a renew is required, if everything needs to be checked within 10 days or in the past
     if (strtotime($domain->config('expire')) - time() >= 10 * 86400) {
         $log->log('Domain ' . $domain->getDomain() . ' doesn\'t need a reissue');
         continue;
     }
     try {
         $challenges = new Challenges($domain);
         $challenges->solveChallenge();
         $log->log('Successfully completed challenge for ' . $domain->getDomain());
         $domain->createKeys();