Misc fixes from live
This commit is contained in:
@@ -56,8 +56,12 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
||||
public function __call($name,$args) {
|
||||
$m = 'get_'.$name;
|
||||
|
||||
if (method_exists($this->_so,$m))
|
||||
if ($this->isCSR() AND method_exists($this,$m))
|
||||
return $this->{$m}($args);
|
||||
|
||||
elseif (method_exists($this->_so,$m))
|
||||
return $this->_so->{$m}($args);
|
||||
|
||||
else
|
||||
throw new Kohana_Exception('Unknown method :method',array(':method'=>$name));
|
||||
}
|
||||
@@ -72,6 +76,13 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this just a CSR?
|
||||
*/
|
||||
public function isCSR() {
|
||||
return ! $this->cert AND $this->csr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all our CA Certs for this certificate
|
||||
*/
|
||||
@@ -103,16 +114,32 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function get_dn() {
|
||||
return SSL::csrsubject($this->csr);
|
||||
}
|
||||
|
||||
public function get_valid_to() {
|
||||
// @todo
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
/**
|
||||
* Renew an SSL Certificate
|
||||
*/
|
||||
// @todo: Renew renews the expiry date as 1 day too early.
|
||||
public function renew($force=FALSE) {
|
||||
$sslo = SSL::instance($this->cert);
|
||||
$ssl_conf = Kohana::$config->load('ssl');
|
||||
|
||||
// If our certificate is not old enough skip
|
||||
if ($sslo->get_valid_to() > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
|
||||
return FALSE;
|
||||
if ($this->cert) {
|
||||
$sslo = SSL::instance($this->cert);
|
||||
|
||||
// If our certificate is not old enough skip
|
||||
if ($sslo->get_valid_to() > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
|
||||
return FALSE;
|
||||
|
||||
} elseif (! $this->csr) {
|
||||
throw new Kohana_Exception('Unable to renew, no CERT or CSR');
|
||||
}
|
||||
|
||||
$today = mktime(0,0,0,date('n'),date('j'),date('Y'));
|
||||
$days = (int)(($this->service->invoiced_to()-$today)/86400);
|
||||
|
Reference in New Issue
Block a user