diff --git a/lib/classes/ssl/class.lescript.php b/lib/classes/ssl/class.lescript.php index d7252cbe..0d1de798 100644 --- a/lib/classes/ssl/class.lescript.php +++ b/lib/classes/ssl/class.lescript.php @@ -34,16 +34,14 @@ class lescript public $countryCode = 'DE'; public $state = "Germany"; - private $certificatesDir; private $webRootDir; private $debugHandler; private $client; private $accountKeyPath; - public function __construct($certificatesDir, $webRootDir, $debugHandler) + public function __construct($webRootDir, $debugHandler) { - $this->certificatesDir = $certificatesDir; $this->webRootDir = $webRootDir; $this->debugHandler = $debugHandler; $this->client = new Client($this->ca); @@ -59,9 +57,9 @@ class lescript // --------------------------------------------- $this->log('Starting new account registration'); - list($private, $public) = $this->generateKey(); - Settings::Set('system.leprivatekey', $private); - Settings::Set('system.lepublickey', $public); + $keys = $this->generateKey(); + Settings::Set('system.leprivatekey', $keys['private']); + Settings::Set('system.lepublickey', $keys['public']); $this->postNewReg(); $this->log('New account certificate registered'); @@ -174,7 +172,8 @@ class lescript // generate private key for domain if not exist if(!is_null($domainkey)) { - list($domainkey, $public) = $this->generateKey(); + $keys = $this->generateKey(); + $domainkey = $keys['private']; } // load domain key @@ -245,11 +244,6 @@ class lescript return "-----BEGIN CERTIFICATE-----\n" . $pem . "-----END CERTIFICATE-----\n"; } - private function getDomainPath($domain) - { - return $this->certificatesDir.'/'.$domain.'/'; - } - private function postNewReg() { $this->log('Sending registration to letsencrypt server'); diff --git a/scripts/jobs/cron_letsencrypt.php b/scripts/jobs/cron_letsencrypt.php index c92d04be..e6863cdf 100644 --- a/scripts/jobs/cron_letsencrypt.php +++ b/scripts/jobs/cron_letsencrypt.php @@ -50,6 +50,10 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) { try { # Initialize Lescript with documentroot $le = new lescript($certrow['documentroot'], $debugHandler); + + # Initialize Lescript + $le->initAccount(); + # Request the new certificate (old key may be used) $return = $le->signDomains($domains, $certrow['ssl_key_file']);