diff --git a/modules/servers/openprovider_ssl/classes/HandleCSRCreation.php b/modules/servers/openprovider_ssl/classes/HandleCSRCreation.php index 40c7e8d..328722c 100644 --- a/modules/servers/openprovider_ssl/classes/HandleCSRCreation.php +++ b/modules/servers/openprovider_ssl/classes/HandleCSRCreation.php @@ -33,9 +33,13 @@ public function handleCSRCreation($vars) $data = html_entity_decode($whmcs->get_req_var("data")); parse_str($data, $dataArray); + $commonName = !empty($dataArray['common_name']) + ? trim($dataArray['common_name']) + : $vars['domain']; + $postData = [ - "bits" => (int) 4098, - "common_name" => $vars['domain'], + "bits" => (int) 4096, + "common_name" => $commonName, "country" => $dataArray['country'], "email" => $dataArray['email'], "locality" => $dataArray['locality'], @@ -43,9 +47,9 @@ public function handleCSRCreation($vars) "signature_hash_algorithm" => $dataArray['signature_hash_algorithm'], "state" => $dataArray['state'], "unit" => $dataArray['unit'], - "with_config" => (bool)$dataArray['with_config'], + "with_config" => filter_var($dataArray['with_config'], FILTER_VALIDATE_BOOLEAN), "subject_alternative_name" => [ - "www.".$vars['domain'], + str_starts_with($commonName, '*.') ? $commonName : 'www.' . $commonName, ], ]; $baseUrl = $this->helper->getBaseUrl(); @@ -63,10 +67,10 @@ public function handleCSRCreation($vars) exit; } - return $this->generateHTML($csrCustomFieldId); + return $this->generateHTML($csrCustomFieldId, false, $vars['domain']); } - private function generateHTML($csrCustomFieldId, $isAdmin = false) + private function generateHTML($csrCustomFieldId, $isAdmin = false, $domain = '') { global $CONFIG, $LANG; @@ -120,7 +124,7 @@ function copyTexts() { }); '; } - $html .= $this->helper->createCsrTokenHtml($countries, $LANG); + $html .= $this->helper->createCsrTokenHtml($countries, $LANG, '', $domain); return $html; } diff --git a/modules/servers/openprovider_ssl/hooks.php b/modules/servers/openprovider_ssl/hooks.php index 9611d68..1257d01 100644 --- a/modules/servers/openprovider_ssl/hooks.php +++ b/modules/servers/openprovider_ssl/hooks.php @@ -152,7 +152,7 @@ parse_str($data, $dataArray); $postData = [ - "bits" => (int) 4098, + "bits" => (int) 4096, "common_name" => $dataArray['common_name'], "country" => $dataArray['country'], "email" => $dataArray['email'], @@ -161,9 +161,9 @@ "signature_hash_algorithm" => $dataArray['signature_hash_algorithm'], "state" => $dataArray['state'], "unit" => $dataArray['unit'], - "with_config" => (bool)$dataArray['with_config'], + "with_config" => filter_var($dataArray['with_config'], FILTER_VALIDATE_BOOLEAN), "subject_alternative_name" => [ - "www.".$dataArray['common_name'], + str_starts_with($dataArray['common_name'], '*.') ? $dataArray['common_name'] : 'www.' . $dataArray['common_name'], ], ]; $baseUrl = $helper->getBaseUrl(); diff --git a/modules/servers/openprovider_ssl/lang/english.php b/modules/servers/openprovider_ssl/lang/english.php index 672fa14..7de17fb 100644 --- a/modules/servers/openprovider_ssl/lang/english.php +++ b/modules/servers/openprovider_ssl/lang/english.php @@ -14,6 +14,7 @@ $_ADDONLANG["country"] = "Country"; $_ADDONLANG["select_country"] = "Select Country"; $_ADDONLANG["common_name"] = "Common Name (Domain)"; +$_ADDONLANG["common_name_text"] = "example.com or *.example.com"; $_ADDONLANG["email"] = "Email Address"; $_ADDONLANG["sha2"] = "SHA-2"; $_ADDONLANG["sha1"] = "SHA-1"; diff --git a/modules/servers/openprovider_ssl/lib/Helper.php b/modules/servers/openprovider_ssl/lib/Helper.php index ef5cdd0..537c5eb 100644 --- a/modules/servers/openprovider_ssl/lib/Helper.php +++ b/modules/servers/openprovider_ssl/lib/Helper.php @@ -276,7 +276,7 @@ public function adminButton($LANG) return $html; } - public function createCsrTokenHtml($clientcountries, $LANG, $action = '') + public function createCsrTokenHtml($clientcountries, $LANG, $action = '', $domain = '') { try { $html = ''; @@ -319,16 +319,14 @@ public function createCsrTokenHtml($clientcountries, $LANG, $action = '') '; - if ($action == 'yes') { - $html .= '
-
- -
-
- -
-
'; - } + $html .= '
+
+ +
+
+ +
+
'; $html .= '