Skip to content

Commit b31bb1f

Browse files
committed
Fixed: FS#1619 - Add apache SNI / SAN support for SSL.
1 parent ba3e3e4 commit b31bb1f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,5 @@ $wb["seo_redirect_txt"] = 'SEO Redirect';
7878
$wb["non_www_to_www_txt"] = 'Non-www -> www';
7979
$wb["www_to_non_www_txt"] = 'www -> non-www';
8080
$wb["php_fpm_use_socket_txt"] = 'Use Socket For PHP-FPM';
81+
$wb["error_no_sni_txt"] = 'SNI for SSL is not activated on this server. You can enable only one SSL certificate on each IP address.';
8182
?>

interface/web/sites/web_domain_edit.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,9 @@ function onSubmit() {
397397
unset($tmp);
398398
// When the record is inserted
399399
} else {
400-
// set the server ID to the default mailserver of the client
400+
//* set the server ID to the default webserver of the client
401401
$this->dataRecord["server_id"] = $client["default_webserver"];
402402

403-
404403
// Check if the user may add another web_domain
405404
if($client["limit_web_domain"] >= 0) {
406405
$tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $client_group_id and type = 'vhost'");
@@ -410,15 +409,24 @@ function onSubmit() {
410409
}
411410

412411
}
413-
414412

415413
// Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
416414
if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
417415
}
418416

419417
//* make sure that the email domain is lowercase
420418
if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
421-
419+
420+
//* get the server config for this server
421+
$app->uses("getconf");
422+
$web_config = $app->getconf->get_server_config(intval($this->dataRecord["server_id"]),'web');
423+
//* Check for duplicate ssl certs per IP if SNI is disabled
424+
if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
425+
$sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
426+
$tmp = $app->db->queryOneRecord($sql);
427+
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
428+
}
429+
422430

423431
parent::onSubmit();
424432
}

0 commit comments

Comments
 (0)