set version specific user-agent in lescript like we do in ajax stuff
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -38,9 +38,12 @@ class lescript
|
|||||||
|
|
||||||
private $accountKey;
|
private $accountKey;
|
||||||
|
|
||||||
public function __construct($logger)
|
private $version;
|
||||||
|
|
||||||
|
public function __construct($logger, $version = '1')
|
||||||
{
|
{
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
$this->version = $version;
|
||||||
if (Settings::Get('system.letsencryptca') == 'production') {
|
if (Settings::Get('system.letsencryptca') == 'production') {
|
||||||
$ca = 'https://acme-v01.api.letsencrypt.org';
|
$ca = 'https://acme-v01.api.letsencrypt.org';
|
||||||
} else {
|
} else {
|
||||||
@@ -176,7 +179,7 @@ class lescript
|
|||||||
$this->log("Token for $domain saved at $tokenPath and should be available at $uri");
|
$this->log("Token for $domain saved at $tokenPath and should be available at $uri");
|
||||||
|
|
||||||
// simple self check
|
// simple self check
|
||||||
$selfcheckContextOptions = array('http' => array('header' => "User Agent: Froxlor"));
|
$selfcheckContextOptions = array('http' => array('header' => "User Agent: Froxlor/".$this->version));
|
||||||
$selfcheckContext = stream_context_create($selfcheckContextOptions);
|
$selfcheckContext = stream_context_create($selfcheckContextOptions);
|
||||||
if ($payload !== trim(@file_get_contents($uri, false, $selfcheckContext))) {
|
if ($payload !== trim(@file_get_contents($uri, false, $selfcheckContext))) {
|
||||||
$errmsg = json_encode(error_get_last());
|
$errmsg = json_encode(error_get_last());
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ foreach ($certrows as $certrow) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Initialize Lescript with documentroot
|
// Initialize Lescript with documentroot
|
||||||
$le = new lescript($cronlog);
|
$le = new lescript($cronlog, $version);
|
||||||
|
|
||||||
// Initialize Lescript
|
// Initialize Lescript
|
||||||
$le->initAccount($certrow);
|
$le->initAccount($certrow);
|
||||||
|
|||||||
Reference in New Issue
Block a user