Merge pull request #297 from nachtgeist/le

Le
This commit is contained in:
Florian Aders
2016-02-19 14:53:37 +01:00
2 changed files with 17 additions and 16 deletions

View File

@@ -59,10 +59,10 @@ class lescript
$keys = $this->generateKey(); $keys = $this->generateKey();
// Only store the accountkey in production, in staging always generate a new key // Only store the accountkey in production, in staging always generate a new key
if (Settings::Get('system.letsencryptca') == 'production') { if (Settings::Get('system.letsencryptca') == 'production') {
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `lepublickey` = :public, `leprivatekey` = :private WHERE `customerid` = :customerid; UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `lepublickey` = :public, `leprivatekey` = :private WHERE `customerid` = :customerid;
"); ");
Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid'])); Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid']));
} }
$this->accountKey = $keys['private']; $this->accountKey = $keys['private'];
$this->postNewReg(); $this->postNewReg();
@@ -145,6 +145,7 @@ class lescript
// simple self check // simple self check
if($payload !== trim(@file_get_contents($uri))) { if($payload !== trim(@file_get_contents($uri))) {
@unlink($tokenPath);
throw new \RuntimeException("Please check $uri - token not available"); throw new \RuntimeException("Please check $uri - token not available");
} }
@@ -166,7 +167,7 @@ class lescript
$count = 0; $count = 0;
do { do {
if(empty($result['status']) || $result['status'] == "invalid") { if(empty($result['status']) || $result['status'] == "invalid") {
@unlink($tokenPath); @unlink($tokenPath);
throw new \RuntimeException("Verification ended with error: ".json_encode($result)); throw new \RuntimeException("Verification ended with error: ".json_encode($result));
} }
$ended = !($result['status'] === "pending"); $ended = !($result['status'] === "pending");