Fixed a few obvious bugs

Signed-off-by: Florian Aders <eleras@froxlor.org>
This commit is contained in:
Florian Aders
2016-01-29 16:52:58 +01:00
parent 4f0c1894a3
commit d45e9e63e6
2 changed files with 10 additions and 12 deletions

View File

@@ -34,16 +34,14 @@ class lescript
public $countryCode = 'DE'; public $countryCode = 'DE';
public $state = "Germany"; public $state = "Germany";
private $certificatesDir;
private $webRootDir; private $webRootDir;
private $debugHandler; private $debugHandler;
private $client; private $client;
private $accountKeyPath; private $accountKeyPath;
public function __construct($certificatesDir, $webRootDir, $debugHandler) public function __construct($webRootDir, $debugHandler)
{ {
$this->certificatesDir = $certificatesDir;
$this->webRootDir = $webRootDir; $this->webRootDir = $webRootDir;
$this->debugHandler = $debugHandler; $this->debugHandler = $debugHandler;
$this->client = new Client($this->ca); $this->client = new Client($this->ca);
@@ -59,9 +57,9 @@ class lescript
// --------------------------------------------- // ---------------------------------------------
$this->log('Starting new account registration'); $this->log('Starting new account registration');
list($private, $public) = $this->generateKey(); $keys = $this->generateKey();
Settings::Set('system.leprivatekey', $private); Settings::Set('system.leprivatekey', $keys['private']);
Settings::Set('system.lepublickey', $public); Settings::Set('system.lepublickey', $keys['public']);
$this->postNewReg(); $this->postNewReg();
$this->log('New account certificate registered'); $this->log('New account certificate registered');
@@ -174,7 +172,8 @@ class lescript
// generate private key for domain if not exist // generate private key for domain if not exist
if(!is_null($domainkey)) { if(!is_null($domainkey)) {
list($domainkey, $public) = $this->generateKey(); $keys = $this->generateKey();
$domainkey = $keys['private'];
} }
// load domain key // load domain key
@@ -245,11 +244,6 @@ class lescript
return "-----BEGIN CERTIFICATE-----\n" . $pem . "-----END CERTIFICATE-----\n"; return "-----BEGIN CERTIFICATE-----\n" . $pem . "-----END CERTIFICATE-----\n";
} }
private function getDomainPath($domain)
{
return $this->certificatesDir.'/'.$domain.'/';
}
private function postNewReg() private function postNewReg()
{ {
$this->log('Sending registration to letsencrypt server'); $this->log('Sending registration to letsencrypt server');

View File

@@ -50,6 +50,10 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
try { try {
# Initialize Lescript with documentroot # Initialize Lescript with documentroot
$le = new lescript($certrow['documentroot'], $debugHandler); $le = new lescript($certrow['documentroot'], $debugHandler);
# Initialize Lescript
$le->initAccount();
# Request the new certificate (old key may be used) # Request the new certificate (old key may be used)
$return = $le->signDomains($domains, $certrow['ssl_key_file']); $return = $le->signDomains($domains, $certrow['ssl_key_file']);