Fixes to OSB to work with KH 3.3
This commit is contained in:
@@ -21,7 +21,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
Block::add(array(
|
||||
'title'=>_('SSL CA Certificates'),
|
||||
'body'=>Table::display(
|
||||
ORM::factory('ssl_ca')->find_all(),
|
||||
ORM::factory('SSL_CA')->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'admin/ssl/view/'),
|
||||
@@ -38,7 +38,7 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
private function add_view($id=NULL,$output='') {
|
||||
$so = ORM::factory('ssl_ca',$id);
|
||||
$so = ORM::factory('SSL_CA',$id);
|
||||
|
||||
if ($_POST) {
|
||||
if ($so->values($_POST)->changed()) {
|
||||
@@ -84,14 +84,14 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
list($id,$output) = Table::page(__METHOD__);
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('ssl_ca',$id)->display('sign_cert')),
|
||||
'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('SSL_CA',$id)->display('sign_cert')),
|
||||
'body'=>$this->add_view($id,$output),
|
||||
));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Services using this Certificate'),
|
||||
'body'=>Table::display(
|
||||
ORM::factory('ssl_ca',$id)->list_issued(),
|
||||
ORM::factory('SSL_CA',$id)->list_issued(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'admin/service/view/'),
|
@@ -17,20 +17,20 @@ class Controller_User_SSL extends Controller_TemplateDefault_User {
|
||||
|
||||
public function action_download() {
|
||||
$id = $_POST['sid'];
|
||||
$so = ORM::factory('service',$id);
|
||||
$so = ORM::factory('Service',$id);
|
||||
|
||||
if (! $so->loaded())
|
||||
Request::current()->redirect('welcome/index');
|
||||
HTTP::redirect('welcome/index');
|
||||
|
||||
$passwd = $_POST['passwd'];
|
||||
if (strlen($passwd) < Kohana::config('ssl.minpass_length')) {
|
||||
if (strlen($passwd) < Kohana::$config->load('ssl')->minpass_length) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Validation failed'),
|
||||
'type'=>'error',
|
||||
'body'=>_('Your requested password is too short.'),
|
||||
));
|
||||
|
||||
Request::current()->redirect('user/service/view/'.$so->id);
|
||||
HTTP::redirect('user/service/view/'.$so->id);
|
||||
}
|
||||
|
||||
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account_id,$so->affiliate_id)) {
|
||||
@@ -38,7 +38,7 @@ class Controller_User_SSL extends Controller_TemplateDefault_User {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$file = Kohana::config('config.tmpdir').'/'.$so->name().'.pkcs12';
|
||||
$file = sprintf('%s/%s.pkcs12',Kohana::$config->load('config')->tmpdir,$so->name());
|
||||
openssl_pkcs12_export_to_file($so->plugin()->cert,$file,$so->plugin()->pk,$passwd,array('extracerts'=>$so->plugin()->cacerts()));
|
||||
$x = file_get_contents($file);
|
||||
unlink($file);
|
@@ -19,7 +19,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
'service'=>array(),
|
||||
);
|
||||
protected $_has_one = array(
|
||||
'ssl_ca'=>array('far_key'=>'ssl_ca_id','foreign_key'=>'id'),
|
||||
'SSL_CA'=>array('far_key'=>'ssl_ca_id','foreign_key'=>'id'),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
@@ -74,7 +74,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
}
|
||||
|
||||
public function name() {
|
||||
return ($this->cert) ? sprintf('%s:%s',$this->ssl_ca->subject(),$this->display('cert')) : $this->display('csr');
|
||||
return ($this->cert AND $this->SSL_CA->loaded()) ? sprintf('%s:%s',$this->SSL_CA->subject(),$this->display('cert')) : $this->display('csr');
|
||||
}
|
||||
|
||||
public function service_view() {
|
||||
@@ -124,7 +124,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
|
||||
$x = $this->ssl_ca_id;
|
||||
while ($x) {
|
||||
$sco = ORM::factory('ssl_ca',$x);
|
||||
$sco = ORM::factory('SSL_CA',$x);
|
||||
array_push($return,$sco->sign_cert);
|
||||
$x = $sco->parent_ssl_ca_id;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
|
||||
public function renew() {
|
||||
$d = SSL::details($this->cert);
|
||||
$ssl_conf = Kohana::config('ssl');
|
||||
$ssl_conf = Kohana::$config->load('ssl');
|
||||
// @todo change this so an admin can force this.
|
||||
$force = TRUE;
|
||||
|
||||
@@ -142,7 +142,7 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
if ($d['validTo_time_t'] > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
|
||||
return FALSE;
|
||||
|
||||
$res = openssl_csr_sign($this->csr,$this->ssl_ca->sign_cert,$this->ssl_ca->sign_pk,$this->service->product->plugin()->days,array(
|
||||
$res = openssl_csr_sign($this->csr,$this->SSL_CA->sign_cert,$this->SSL_CA->sign_pk,$this->service->product->plugin()->days,array(
|
||||
'config'=>$ssl_conf['config'],
|
||||
'x509_extensions'=>$this->service->product->plugin()->extensions,
|
||||
'digest_alg'=>'sha1',
|
||||
@@ -156,8 +156,8 @@ class Model_Service_Plugin_SSL extends Model_Service_Plugin {
|
||||
} else {
|
||||
print_r(array(
|
||||
'csr'=>$this->csr,
|
||||
'ca'=>$this->ssl_ca->sign_cert,
|
||||
'capk'=>$this->ssl_ca->sign_pk,
|
||||
'ca'=>$this->SSL_CA->sign_cert,
|
||||
'capk'=>$this->SSL_CA->sign_pk,
|
||||
'days'=>$this->service->product->plugin()->days,
|
||||
'ssl'=>$ssl_conf,
|
||||
'x509e'=>$this->service->product->plugin()->extensions
|
@@ -202,10 +202,6 @@ class SSL {
|
||||
return $this->_details('version');
|
||||
}
|
||||
|
||||
public static function xdn($cert) {
|
||||
return static::instance($cert)->get_dn();
|
||||
}
|
||||
|
||||
public static function xexpire($cert,$format=FALSE) {
|
||||
return static::instance($cert)->get_expire($format);
|
||||
}
|
@@ -1,25 +1,22 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides OSB SSL task capabilities.
|
||||
* Renew an SSL Certificate
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage SSL
|
||||
* @category Controllers/Task
|
||||
* @category SSL/Task
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Task_SSL extends Controller_Task {
|
||||
class Task_SSL_Renew extends Task {
|
||||
/**
|
||||
* Renew a certificate
|
||||
*/
|
||||
public function action_renew() {
|
||||
protected function _execute(array $params) {
|
||||
// @todo, Change this to be a SSL id, maybe list all the certs expiring
|
||||
$id = $this->request->param('id');
|
||||
$so = ORM::factory('service',$id);
|
||||
|
||||
$so->plugin()->renew();
|
||||
ORM::factory('Service',$params['id'])->plugin()->renew();
|
||||
}
|
||||
}
|
||||
?>
|
@@ -19,7 +19,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CA</td>
|
||||
<td class="data"><?php echo $so->ssl_ca->subject(); ?></td>
|
||||
<td class="data"><?php echo $so->SSL_CA->loaded() ? $so->SSL_CA->subject() : $so->issuer(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid From</td>
|
||||
|
Reference in New Issue
Block a user