Commit 0d20afff authored by tbrehm's avatar tbrehm

- Added the possibility to set and update the ssl key in the interface.

parent 1f187eb0
......@@ -384,6 +384,14 @@ $form["tabs"]['ssl'] = array (
'width' => '30',
'maxlength' => '255'
),
'ssl_key' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'default' => '',
'value' => '',
'cols' => '30',
'rows' => '10'
),
'ssl_request' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
......
......@@ -6,6 +6,7 @@ $wb["ssl_locality_txt"] = 'Locality';
$wb["ssl_organisation_txt"] = 'Organisation';
$wb["ssl_organisation_unit_txt"] = 'Organisation Unit';
$wb["ssl_country_txt"] = 'Country';
$wb["ssl_key_txt"] = 'SSL Key';
$wb["ssl_request_txt"] = 'SSL Request';
$wb["ssl_cert_txt"] = 'SSL Certificate';
$wb["ssl_bundle_txt"] = 'SSL Bundle';
......
......@@ -32,6 +32,10 @@
<select name="ssl_domain" id="ssl_domain" class="selectInput">
{tmpl_var name='ssl_domain'}
</select>
</div>
<div class="ctrlHolder">
<label for="ssl_request">{tmpl_var name='ssl_key_txt'}</label>
<textarea name="ssl_key" id="ssl_key" rows='10' cols='30'>{tmpl_var name='ssl_key'}</textarea>
</div>
<div class="ctrlHolder">
<label for="ssl_request">{tmpl_var name='ssl_request_txt'}</label>
......
......@@ -195,11 +195,12 @@ class apache2_plugin {
@$app->system->unlink($rand_file);
$ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
$ssl_cert = $app->db->quote($app->system->file_get_contents($crt_file));
$ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
/* Update the DB of the (local) Server */
$app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data['new']['domain']."'");
$app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
/* Update also the master-DB of the Server-Farm */
$app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data['new']['domain']."'");
$app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
}
......@@ -209,7 +210,7 @@ class apache2_plugin {
$ssl_dir = $data["new"]["document_root"]."/ssl";
$domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"];
$key_file = $ssl_dir.'/'.$domain.'.key.org';
$key_file2 = $ssl_dir.'/'.$domain.'.key';
$key_file2 = $ssl_dir.'/'.$domain.'.key';
$csr_file = $ssl_dir.'/'.$domain.".csr";
$crt_file = $ssl_dir.'/'.$domain.".crt";
$bundle_file = $ssl_dir.'/'.$domain.".bundle";
......@@ -225,6 +226,7 @@ class apache2_plugin {
if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]);
if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]);
if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]);
/* Update the DB of the (local) Server */
$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment