From 2436971b3ebe3386fe9a3db44423a5705f9f6e38 Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Thu, 4 Feb 2016 16:55:54 +0100 Subject: [PATCH] - made state, locality, organization and organization unit optional on ssl creation (Fixes #2811) --- interface/web/sites/form/web_vhost_domain.tform.php | 8 ++++---- interface/web/sites/web_vhost_domain_edit.php | 4 ---- server/plugins-available/apache2_plugin.inc.php | 8 ++++---- server/plugins-available/nginx_plugin.inc.php | 8 ++++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/interface/web/sites/form/web_vhost_domain.tform.php b/interface/web/sites/form/web_vhost_domain.tform.php index c447b1e851..894ea0c057 100644 --- a/interface/web/sites/form/web_vhost_domain.tform.php +++ b/interface/web/sites/form/web_vhost_domain.tform.php @@ -447,7 +447,7 @@ if($ssl_available) { 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_state_error_regex'), ), 'default' => '', @@ -459,7 +459,7 @@ if($ssl_available) { 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_locality_error_regex'), ), 'default' => '', @@ -471,7 +471,7 @@ if($ssl_available) { 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_organisation_error_regex'), ), 'default' => '', @@ -483,7 +483,7 @@ if($ssl_available) { 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/', + 'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/', 'errmsg'=> 'ssl_organistaion_unit_error_regex'), ), 'default' => '', diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 86cc522008..8bbc5e1fb0 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -1415,10 +1415,6 @@ class page_action extends tform_actions { //* Check that all fields for the SSL cert creation are filled if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'create') { - if($this->dataRecord['ssl_state'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_state_empty').'<br />'; - if($this->dataRecord['ssl_locality'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_locality_empty').'<br />'; - if($this->dataRecord['ssl_organisation'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_empty').'<br />'; - if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />'; if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />'; } diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 4a6437e924..76528c2328 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -275,10 +275,10 @@ class apache2_plugin { [ req_distinguished_name ] C = ".trim($data['new']['ssl_country'])." - ST = ".trim($data['new']['ssl_state'])." - L = ".trim($data['new']['ssl_locality'])." - O = ".trim($data['new']['ssl_organisation'])." - OU = ".trim($data['new']['ssl_organisation_unit'])." + " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " + " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." + " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." + " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." CN = $domain emailAddress = webmaster@".$data['new']['domain']." diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index f4c5f9d5ba..d351bb2730 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -156,10 +156,10 @@ class nginx_plugin { [ req_distinguished_name ] C = ".trim($data['new']['ssl_country'])." - ST = ".trim($data['new']['ssl_state'])." - L = ".trim($data['new']['ssl_locality'])." - O = ".trim($data['new']['ssl_organisation'])." - OU = ".trim($data['new']['ssl_organisation_unit'])." + " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " + " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." + " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." + " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." CN = $domain emailAddress = webmaster@".$data['new']['domain']." -- GitLab