Added SSL

This commit is contained in:
Deon George
2014-10-08 23:17:00 +11:00
parent 62992c1a0e
commit c952738750
17 changed files with 1411 additions and 11 deletions

View File

@@ -119,6 +119,7 @@ Kohana::$config->attach(new Config_File);
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'ssl' => MODPATH.'ssl', // SSL Management Module
'tsm' => MODPATH.'tsm', // TSM Module
// 'lnauth' => MODPATH.'lnauth', // lnAuth Base Authentication Tools
'lnapp' => MODPATH.'lnapp', // lnApp Base Application Tools

View File

@@ -12,6 +12,10 @@
class Controller_User_Welcome extends Controller_Welcome {
protected $auth_required = TRUE;
protected $secure_actions = array(
'index'=>0,
);
public function action_index() {
$n = ORM::factory('ADMIN')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
if (! $n->count())
@@ -31,7 +35,29 @@ class Controller_User_Welcome extends Controller_Welcome {
));
Block::factory()
->title(sprintf('Your ADMINs in TSMs : %s',$this->ao->name()))
->title(sprintf('Your ADMINs in TSM : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);
$n = $this->ao->ssl->find_all();
if (! $n->count())
$output = 'You have no currently SSL Certificates, would you like to '.HTML::anchor(URL::link('user','ssl/add'),'add').' one?';
else
$output = Table::factory()
->data($n)
->columns(array(
'id'=>'ID',
'dn()'=>'Cert',
'valid_to(TRUE)'=>'Expires',
'issuer_cn()'=>'Issuer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','ssl/view/')),
));
Block::factory()
->title(sprintf('Your SSL Certificates for TSM : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);
@@ -54,7 +80,7 @@ class Controller_User_Welcome extends Controller_Welcome {
));
Block::factory()
->title(sprintf('Your NODES in TSMs : %s',$this->ao->name()))
->title(sprintf('Your NODES in TSM : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);

View File

@@ -0,0 +1,24 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Acconunt Model
*
* @package TSM Access Management
* @category Models
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Model_Account extends lnApp_Model_Account {
protected $_has_many = array(
'ssl'=>array('model'=>'SSL','far_key'=>'id','foreign_key'=>'account_id'),
);
public function id() {
if (! $this->prefix)
throw HTTP_Exception::factory(501,'Your prefix is missing, please contact an admin');
return strlen($this->prefix) > 1 ? $this->prefix : sprintf('%s%06d',$this->prefix,$this->id);
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's ORM
*
* This file contains enhancements for Kohana, that should be considered upstream and maybe havent been yet.
* It also contains some functionality for OSB, which cannot be covered in ORM_OSB.
*
* @package TSM Access Management
* @category Modifications
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
abstract class ORM extends lnApp_ORM {
/**
* Function help to find records that are active
*/
protected function _where_active() {
return $this->where('status','=',TRUE);
}
/**
* Function help to find records that are active
*/
public function list_active() {
return $this->_where_active()->find_all();
}
public function where_active() {
return $this->_where_active();
}
}
?>

View File

@@ -1,9 +1,9 @@
<fieldset>
<legend>Account Details</legend>
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'col-md-3','placeholder'=>'Email Address','type'=>'email','required','data-error'=>'Invalid EMAIL address')); ?>
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','divclass'=>'col-md-3','placeholder'=>'Email Address','type'=>'email','required','data-error'=>'Invalid EMAIL address')); ?>
<?php echo Form::input('company',$o->display('company'),array('label'=>'Company','class'=>'col-md-3','placeholder'=>'Company Name','required')); ?>
<?php echo Form::input('company',$o->display('company'),array('label'=>'Company','divclass'=>'col-md-3','placeholder'=>'Company Name','required')); ?>
<div class="form-group">
<label class="col-md-2 control-label" for="Title">Name</label>
@@ -12,33 +12,33 @@
<?php echo Form::select('title',StaticList_Title::table(),$o->display('title'),array('class'=>'form-control','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-2">
<?php echo Form::input('first_name',$o->display('first_name'),array('class'=>'form-control col-md-2','placeholder'=>'First Name','required','nocg'=>TRUE)); ?>
<?php echo Form::input('first_name',$o->display('first_name'),array('class'=>'form-control','placeholder'=>'First Name','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-3">
<?php echo Form::input('last_name',$o->display('last_name'),array('class'=>'form-control col-md-2','placeholder'=>'Last Name','required','nocg'=>TRUE)); ?>
<?php echo Form::input('last_name',$o->display('last_name'),array('class'=>'form-control','placeholder'=>'Last Name','required','nocg'=>TRUE)); ?>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="address1">Address</label>
<?php echo Form::input('address1',$o->display('address1'),array('class'=>'col-md-6','placeholder'=>'Address Line 1','required')); ?>
<?php echo Form::input('address1',$o->display('address1'),array('divclass'=>'col-md-6','placeholder'=>'Address Line 1','required')); ?>
<label class="col-md-2 control-label" for="address2"></label>
<?php echo Form::input('address2',$o->display('address2'),array('class'=>'col-md-6','placeholder'=>'Address Line 2')); ?>
<?php echo Form::input('address2',$o->display('address2'),array('divclass'=>'col-md-6','placeholder'=>'Address Line 2')); ?>
<label class="col-md-2 control-label" for="city"></label>
<div class="row">
<div class="col-md-3">
<?php echo Form::input('city',$o->display('city'),array('label'=>'City','placeholder'=>'City','required','nocg'=>TRUE)); ?>
<?php echo Form::input('city',$o->display('city'),array('class'=>'form-control','label'=>'City','placeholder'=>'City','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-1">
<?php echo Form::input('state',$o->display('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required','nocg'=>TRUE)); ?>
<?php echo Form::input('state',$o->display('state'),array('class'=>'form-control','label'=>'','class'=>'input-mini','placeholder'=>'State','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-1">
<?php echo Form::input('zip',$o->display('zip'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required','nocg'=>TRUE)); ?>
<?php echo Form::input('zip',$o->display('zip'),array('class'=>'form-control','label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required','nocg'=>TRUE)); ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,35 @@
<fieldset>
<legend>SSL Certificate Details</legend>
<p>To use SSL with a Tivoli Storage Manager Client, you need to receive a certificate from this service.<p>
<p>Please do the following:<p>
<ol>
<li>Open up a command prompt, and depending on your operating system, change to your BA Client <strong>BIN</strong> directory. For example:<br/>
<dl class="dl-horizontal">
<dt>Linux</dt>
<dd>cd /opt/tivoli/tsm/client/ba/bin</dd>
<dt>Windows</dt>
<dd>cd "C:\Program Files\Tivoli\TSM\baclient"</dd>
</dl>
</li>
<li>Create your SSL Certificate Store <strong>dsmsert.kdb</strong> with the following command:<br/>
<code>gsk8capicmd_64 -keydb -create -db dsmcert.kdb -type kdb -stash</code><br/><br/>
</li>
<li>Create a Certificate Signing Request using the following command:<br/>
<code>gsk8capicmd_64 -certreq -create -db dsmcert.kdb -stashed -label 'TSM-SL01' -dn 'O=IBM,cn=<?php echo $o->id(); ?>' -size 2048 -file <?php echo $o->id(); ?>.CSR</code><br/><br/>
</li>
<li>Paste the contents of your CSR file here:<br/>
<?php echo Form::textarea('csr','',array('class'=>'col-md-6','label'=>'CSR','placeholder'=>'Certificate Sign Request','style'=>'font-family: monospace;','cols'=>61,'rows'=>15)); ?>
</li>
<li>Submit your CSR to be signed, you'll receive a certificate once approved</li>
</ol>
</fieldset>
<div class="row">
<div class="col-md-offset-1">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-default">Cancel</button>
</div>
</div>