Skip to content

Commit 0d20aff

Browse files
committed
- Added the possibility to set and update the ssl key in the interface.
1 parent 1f187eb commit 0d20aff

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

interface/web/sites/form/web_domain.tform.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@
384384
'width' => '30',
385385
'maxlength' => '255'
386386
),
387+
'ssl_key' => array (
388+
'datatype' => 'TEXT',
389+
'formtype' => 'TEXTAREA',
390+
'default' => '',
391+
'value' => '',
392+
'cols' => '30',
393+
'rows' => '10'
394+
),
387395
'ssl_request' => array (
388396
'datatype' => 'TEXT',
389397
'formtype' => 'TEXTAREA',

interface/web/sites/lib/lang/en_web_domain.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ $wb["ssl_locality_txt"] = 'Locality';
66
$wb["ssl_organisation_txt"] = 'Organisation';
77
$wb["ssl_organisation_unit_txt"] = 'Organisation Unit';
88
$wb["ssl_country_txt"] = 'Country';
9+
$wb["ssl_key_txt"] = 'SSL Key';
910
$wb["ssl_request_txt"] = 'SSL Request';
1011
$wb["ssl_cert_txt"] = 'SSL Certificate';
1112
$wb["ssl_bundle_txt"] = 'SSL Bundle';

interface/web/sites/templates/web_domain_ssl.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ <h2><tmpl_var name="list_head_txt"></h2>
3232
<select name="ssl_domain" id="ssl_domain" class="selectInput">
3333
{tmpl_var name='ssl_domain'}
3434
</select>
35+
</div>
36+
<div class="ctrlHolder">
37+
<label for="ssl_request">{tmpl_var name='ssl_key_txt'}</label>
38+
<textarea name="ssl_key" id="ssl_key" rows='10' cols='30'>{tmpl_var name='ssl_key'}</textarea>
3539
</div>
3640
<div class="ctrlHolder">
3741
<label for="ssl_request">{tmpl_var name='ssl_request_txt'}</label>

server/plugins-available/apache2_plugin.inc.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,12 @@ function ssl($event_name,$data) {
195195
@$app->system->unlink($rand_file);
196196
$ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
197197
$ssl_cert = $app->db->quote($app->system->file_get_contents($crt_file));
198+
$ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
198199
/* Update the DB of the (local) Server */
199-
$app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data['new']['domain']."'");
200+
$app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
200201
$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
201202
/* Update also the master-DB of the Server-Farm */
202-
$app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data['new']['domain']."'");
203+
$app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
203204
$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
204205
}
205206

@@ -209,7 +210,7 @@ function ssl($event_name,$data) {
209210
$ssl_dir = $data["new"]["document_root"]."/ssl";
210211
$domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"];
211212
$key_file = $ssl_dir.'/'.$domain.'.key.org';
212-
$key_file2 = $ssl_dir.'/'.$domain.'.key';
213+
$key_file2 = $ssl_dir.'/'.$domain.'.key';
213214
$csr_file = $ssl_dir.'/'.$domain.".csr";
214215
$crt_file = $ssl_dir.'/'.$domain.".crt";
215216
$bundle_file = $ssl_dir.'/'.$domain.".bundle";
@@ -225,6 +226,7 @@ function ssl($event_name,$data) {
225226
if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]);
226227
if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]);
227228
if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
229+
if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]);
228230

229231
/* Update the DB of the (local) Server */
230232
$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");

0 commit comments

Comments
 (0)