- added possibility to set a custom docroot for any ip/port combination, fixes #417
- sort vhosts-file by type (subdomain, sub-of-main, main-domain), fixes #437
This commit is contained in:
@@ -147,6 +147,7 @@ if($page == 'ipsandports'
|
||||
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
|
||||
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
|
||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
|
||||
$docroot = validate($_POST['docroot'], 'docroot');
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
@@ -193,6 +194,15 @@ if($page == 'ipsandports'
|
||||
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
|
||||
}
|
||||
|
||||
if(strlen(trim($docroot)) > 0)
|
||||
{
|
||||
$docroot = makeCorrectDir($docroot);
|
||||
}
|
||||
else
|
||||
{
|
||||
$docroot = '';
|
||||
}
|
||||
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
|
||||
if($result_checkfordouble['id'] != '')
|
||||
@@ -215,7 +225,8 @@ if($page == 'ipsandports'
|
||||
`ssl_key_file` = '" . $db->escape($ssl_key_file) . "',
|
||||
`ssl_ca_file` = '" . $db->escape($ssl_ca_file) . "',
|
||||
`ssl_cert_chainfile` = '" . $db->escape($ssl_cert_chainfile) . "',
|
||||
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "';
|
||||
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "',
|
||||
`docroot` = '" . $db->escape($docroot) . "';
|
||||
");
|
||||
|
||||
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
@@ -264,6 +275,7 @@ if($page == 'ipsandports'
|
||||
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
|
||||
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
|
||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
|
||||
$docroot = validate($_POST['docroot'], 'docroot');
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
@@ -310,6 +322,15 @@ if($page == 'ipsandports'
|
||||
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
|
||||
}
|
||||
|
||||
if(strlen(trim($docroot)) > 0)
|
||||
{
|
||||
$docroot = makeCorrectDir($docroot);
|
||||
}
|
||||
else
|
||||
{
|
||||
$docroot = '';
|
||||
}
|
||||
|
||||
if($result['ip'] != $ip
|
||||
&& $result['ip'] == $settings['system']['ipaddress']
|
||||
&& $result_sameipotherport['id'] == '')
|
||||
@@ -338,7 +359,8 @@ if($page == 'ipsandports'
|
||||
`ssl_key_file` = '" . $db->escape($ssl_key_file) . "',
|
||||
`ssl_ca_file` = '" . $db->escape($ssl_ca_file) . "',
|
||||
`ssl_cert_chainfile` = '" . $db->escape($ssl_cert_chainfile) . "',
|
||||
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "'
|
||||
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "',
|
||||
`docroot` = '" . $db->escape($docroot) . "'
|
||||
WHERE `id`='" . (int)$id . "'
|
||||
");
|
||||
|
||||
|
||||
@@ -338,6 +338,7 @@ CREATE TABLE `panel_ipsandports` (
|
||||
`ssl_ca_file` varchar(255) NOT NULL,
|
||||
`default_vhostconf_domain` text NOT NULL,
|
||||
`ssl_cert_chainfile` varchar(255) NOT NULL,
|
||||
`docroot` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
@@ -461,7 +462,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn4');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn5');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');
|
||||
|
||||
@@ -1139,3 +1139,14 @@ if(isFroxlorVersion('0.9.14-svn3'))
|
||||
|
||||
updateToVersion('0.9.14-svn4');
|
||||
}
|
||||
|
||||
if(isFroxlorVersion('0.9.14-svn4'))
|
||||
{
|
||||
showUpdateStep("Updating from 0.9.14-svn4 to 0.9.14-svn5", false);
|
||||
|
||||
showUpdateStep("Adding docroot-field to IPs and ports for custom-docroot settings");
|
||||
$db->query("ALTER TABLE `".TABLE_PANEL_IPSANDPORTS."` ADD `docroot` varchar(255) NOT NULL default '' AFTER `ssl_cert_chainfile`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9.14-svn5');
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
|
||||
$version = '0.9.14-svn4';
|
||||
$version = '0.9.14-svn5';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
|
||||
@@ -1506,4 +1506,8 @@ $lng['serversettings']['awstats_icons']['description'] = 'e.g. /usr/share/awstat
|
||||
// ADDED IN FROXLOR 0.9.14-svn4
|
||||
$lng['admin']['ipsandports']['ssl_cert_chainfile'] = 'Path to the SSL CertificateChainFile';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.14-svn5
|
||||
$lng['admin']['ipsandports']['docroot']['title'] = 'Custom docroot (empty = point to Froxlor)';
|
||||
$lng['admin']['ipsandports']['docroot']['description'] = 'You can define a custom document-root (the destination for a request) for this ip/port combination here.<br /><strong>ATTENTION:</strong> Please be careful with what you enter here!';
|
||||
|
||||
?>
|
||||
|
||||
@@ -1489,4 +1489,8 @@ $lng['serversettings']['awstats_icons']['description'] = 'z.B. /usr/share/awstat
|
||||
// ADDED IN FROXLOR 0.9.14-svn4
|
||||
$lng['admin']['ipsandports']['ssl_cert_chainfile'] = 'Pfad zu dem SSL CertificateChainFile';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.14-svn5
|
||||
$lng['admin']['ipsandports']['docroot']['title'] = 'Benutzerdefinierter Docroot (leer = zeige auf Froxlor)';
|
||||
$lng['admin']['ipsandports']['docroot']['description'] = 'Hier kann ein benutzerdefinierter Document-Root (der Zeilordner für einen Zugriff) für diese IP/Port Kombination gesetzt werden.<br /><strong>ACHTUNG:</strong> Bitte überlege vorher, welchen Pfad du hier angibst!';
|
||||
|
||||
?>
|
||||
|
||||
@@ -189,17 +189,26 @@ class apache
|
||||
{
|
||||
$this->virtualhosts_data[$vhosts_filename].= '<VirtualHost ' . $ipport . '>' . "\n";
|
||||
|
||||
/**
|
||||
* add 'real'-vhost content here, like doc-root :)
|
||||
*/
|
||||
if($this->settings['system']['froxlordirectlyviahostname'])
|
||||
if($row_ipsandports['docroot'] == '')
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
/**
|
||||
* add 'real'-vhost content here, like doc-root :)
|
||||
*/
|
||||
if($this->settings['system']['froxlordirectlyviahostname'])
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
// user-defined docroot, #417
|
||||
$mypath = makeCorrectDir($row_ipsandports['docroot']);
|
||||
}
|
||||
|
||||
$this->virtualhosts_data[$vhosts_filename].= 'DocumentRoot "'.$mypath.'"'."\n";
|
||||
|
||||
if($row_ipsandports['vhostcontainer_servername_statement'] == '1')
|
||||
@@ -1111,6 +1120,13 @@ class apache
|
||||
// Save one big file
|
||||
$vhosts_file = '';
|
||||
|
||||
// sort by filename so the order is:
|
||||
// 1. subdomains 20
|
||||
// 2. subdomains as main-domains 21
|
||||
// 3. main-domains 22
|
||||
// #437
|
||||
ksort($this->virtualhosts_data);
|
||||
|
||||
foreach($this->virtualhosts_data as $vhosts_filename => $vhost_content)
|
||||
{
|
||||
$vhosts_file.= $vhost_content . "\n\n";
|
||||
|
||||
@@ -107,14 +107,23 @@ class lighttpd
|
||||
$this->lighttpd_data[$vhost_filename].= '# Froxlor default vhost' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename].= '$HTTP["host"] =~ "^(?:www\.|)' . $myhost . '$" {' . "\n";
|
||||
|
||||
if($this->settings['system']['froxlordirectlyviahostname'])
|
||||
if($row_ipsandports['docroot'] == '')
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
if($this->settings['system']['froxlordirectlyviahostname'])
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
// user-defined docroot, #417
|
||||
$mypath = makeCorrectDir($row_ipsandports['docroot']);
|
||||
}
|
||||
|
||||
$this->lighttpd_data[$vhost_filename].= ' server.document-root = "'.$mypath.'"'."\n";
|
||||
|
||||
/**
|
||||
@@ -855,6 +864,13 @@ class lighttpd
|
||||
// Save one big file
|
||||
$vhosts_file = '';
|
||||
|
||||
// sort by filename so the order is:
|
||||
// 1. subdomains
|
||||
// 2. subdomains as main-domains
|
||||
// 3. main-domains
|
||||
// #437
|
||||
ksort($this->lighttpd_data);
|
||||
|
||||
foreach($this->lighttpd_data as $vhosts_filename => $vhost_content)
|
||||
{
|
||||
$vhosts_file.= $vhost_content . "\n\n";
|
||||
|
||||
@@ -47,6 +47,10 @@ $header
|
||||
</td>
|
||||
<td class="main_field_display" nowrap="nowrap">$vhostcontainer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['admin']['ipsandports']['docroot']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" class="text" name="docroot" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name" valign="top">{$lng['admin']['ownvhostsettings']}:<br /><font size="1">{$lng['serversettings']['default_vhostconf']['description']}</font>
|
||||
<if $settings['system']['webserver'] == 'lighttpd'><div style="color:red">{$lng['panel']['not_supported']}lighttpd</div></if>
|
||||
|
||||
@@ -46,6 +46,10 @@ $header
|
||||
<td class="main_field_name">{$lng['admin']['ipsandports']['create_vhostcontainer']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap">$vhostcontainer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['admin']['ipsandports']['docroot']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" class="text" name="docroot" value="{$result['docroot']}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name" valign="top">{$lng['admin']['ownvhostsettings']}:<br /><font size="1">{$lng['serversettings']['default_vhostconf']['description']}</font></td>
|
||||
<td class="main_field_display" nowrap="nowrap"><textarea class="textarea_border" rows="12" cols="60" name="specialsettings">{$result['specialsettings']}</textarea></td>
|
||||
|
||||
Reference in New Issue
Block a user