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 $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');

View File

@@ -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']);