Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Helmo
ISPConfig 3
Commits
7889e5d0
Commit
7889e5d0
authored
Feb 20, 2021
by
Thom
🛠
Browse files
Enable SSL if a cert is present for the Apps vhost when installing/updating (
#6007
)
parent
d0d54151
Changes
4
Hide whitespace changes
Inline
Side-by-side
install/lib/installer_base.lib.php
View file @
7889e5d0
...
...
@@ -2553,7 +2553,7 @@ class installer_base {
$tpl
->
setVar
(
'apps_vhost_dir'
,
$conf
[
'web'
][
'website_basedir'
]
.
'/apps'
);
$tpl
->
setVar
(
'apps_vhost_basedir'
,
$conf
[
'web'
][
'website_basedir'
]);
$tpl
->
setVar
(
'apps_vhost_servername'
,
$apps_vhost_servername
);
if
(
is_file
(
$install_dir
.
'/interface/ssl/ispserver.crt'
)
&&
is_file
(
$install_dir
.
'/interface/ssl/ispserver.key'
))
{
if
(
is_file
(
$
conf
[
'ispconfig_
install_dir
'
]
.
'/interface/ssl/ispserver.crt'
)
&&
is_file
(
$
conf
[
'ispconfig_
install_dir
'
]
.
'/interface/ssl/ispserver.key'
))
{
$tpl
->
setVar
(
'ssl_comment'
,
''
);
}
else
{
$tpl
->
setVar
(
'ssl_comment'
,
'#'
);
...
...
@@ -2636,6 +2636,15 @@ class installer_base {
// Dont just copy over the virtualhost template but add some custom settings
$content
=
rfsel
(
$conf
[
'ispconfig_install_dir'
]
.
'/server/conf-custom/install/nginx_apps.vhost.master'
,
'tpl/nginx_apps.vhost.master'
);
// Enable SSL if a cert is in place.
if
(
is_file
(
$conf
[
'ispconfig_install_dir'
]
.
'/interface/ssl/ispserver.crt'
)
&&
is_file
(
$install_dir
.
'/interface/ssl/ispserver.key'
))
{
$content
=
str_replace
(
'{ssl_on}'
,
'ssl'
,
$content
);
$content
=
str_replace
(
'{ssl_comment}'
,
''
,
$content
);
}
else
{
$content
=
str_replace
(
'{ssl_on}'
,
''
,
$content
);
$content
=
str_replace
(
'{ssl_comment}'
,
'#'
,
$content
);
}
if
(
$conf
[
'web'
][
'apps_vhost_ip'
]
==
'_default_'
){
$apps_vhost_ip
=
''
;
}
else
{
...
...
install/tpl/nginx_apps.vhost.master
View file @
7889e5d0
...
...
@@ -7,7 +7,7 @@ server {
{ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
# redirect to https if accessed with http
{ssl_comment}error_page 497 https://$host:{vhost_port}$request_uri;
{ssl_comment}error_page 497 https://$host:{
apps_
vhost_port}$request_uri;
server_name {apps_vhost_servername};
...
...
server/conf/nginx_apps.vhost.master
View file @
7889e5d0
...
...
@@ -7,7 +7,7 @@ server {
{ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
# redirect to https if accessed with http
{ssl_comment}error_page 497 https://$host:{vhost_port}$request_uri;
{ssl_comment}error_page 497 https://$host:{
apps_
vhost_port}$request_uri;
server_name {apps_vhost_servername};
...
...
server/plugins-available/apps_vhost_plugin.inc.php
View file @
7889e5d0
...
...
@@ -206,16 +206,14 @@ class apps_vhost_plugin {
$use_socket
=
'#'
;
}
/* Check if SSL should be enabled: */
if
(
is_file
(
'/usr/local/ispconfig/interface/ssl/ispserver.crt'
)
&&
is_file
(
'/usr/local/ispconfig/interface/ssl/ispserver.key'
))
{
/* Check if SSL should be enabled: */
if
(
is_file
(
'/usr/local/ispconfig/interface/ssl/ispserver.crt'
)
&&
is_file
(
'/usr/local/ispconfig/interface/ssl/ispserver.key'
))
{
$content
=
str_replace
(
'{ssl_comment}'
,
''
,
$content
);
$content
=
str_replace
(
'{ssl_on}'
,
'ssl'
,
$content
);
$content
=
str_replace
(
'{vhost_port}'
,
$web_config
[
'apps_vhost_port'
],
$content
);
}
else
{
}
else
{
$content
=
str_replace
(
'{ssl_comment}'
,
'#'
,
$content
);
$content
=
preg_replace
(
'/(\s)\{ssl_on\}/'
,
''
,
$content
);
$content
=
str_replace
(
'{vhost_port}'
,
$web_config
[
'apps_vhost_port'
],
$content
);
}
}
$content
=
str_replace
(
'{use_tcp}'
,
$use_tcp
,
$content
);
$content
=
str_replace
(
'{use_socket}'
,
$use_socket
,
$content
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment