Compare commits

..

23 Commits

Author SHA1 Message Date
Michael Kaufmann (d00p)
547140bafb set version to 0.9.38 for upcoming release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 08:36:35 +01:00
Michael Kaufmann (d00p)
432645431c allow CIDR values in AXFR setting, fixes #1672
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-15 08:03:34 +01:00
Michael Kaufmann (d00p)
7e4164da26 do not double validate openbasedir-values, as appendOpenbasedirPath() already takes care of that; also fix /dev/urandom as openbasedir-path-value to be treated as file correctly, fixes #1669
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-10 10:07:00 +01:00
Michael Kaufmann (d00p)
fad607c6e8 set version to 0.9.38-rc2 for second release candidate 2016-11-07 07:28:58 +01:00
Michael Kaufmann (d00p)
d6b56262ce fix unnecessary idn encoding
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-04 18:28:32 +01:00
Michael Kaufmann (d00p)
c409d8a6ba re-enable removing of orphaned entries, fixes #1666
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-03 14:14:33 +01:00
Michael Kaufmann (d00p)
4274b8a737 fix setting of hsts values when security questions are asked; insert config-rebuild task if only hsts stuff changes; fix undefined variable regarding alias domain
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-03 10:52:33 +01:00
Michael Kaufmann (d00p)
60c1babd93 fix wrong protocol name for apache
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-31 20:44:31 +01:00
Michael Kaufmann (d00p)
ec6ddd054d remove certificate entry for LE if admin/customer disables LE for a domain
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-31 11:18:40 +01:00
Michael Kaufmann (d00p)
76c200a56c disable tlsv1.1 for ssl settings
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-31 11:17:56 +01:00
Michael Kaufmann (d00p)
a44be363a6 set domain, letsencrypt-flag and loginname for froxlor-hostname in ssl-overview because the certificate will get removed as invalid otherwise, thx to Tbyte
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-31 10:53:18 +01:00
Michael Kaufmann (d00p)
304926260f PowerDNS does not like multi-line-format, thx to Marc
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-29 14:20:50 +02:00
Michael Kaufmann (d00p)
462fca7328 do not add www.[froxlorfqdn] to SAN list of certificate request for Let's Encrypt froxlor-vhost certificate; fixes #1662
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-28 10:57:51 +02:00
Michael Kaufmann (d00p)
884b2ed913 various fixes for idn converted domains + fix undefined index alias when editing a domain with alias
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-25 12:24:57 +02:00
Michael Kaufmann (d00p)
af77453bfe do not generate ssl-vhost-container without a certificate
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-20 09:23:44 +02:00
Michael Kaufmann (d00p)
fa45de6586 fix empty dir parameter for makeCorrectDir() when directory-selection is set to 'Dropdown', thx to D2Red for letting me debug on his system
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-19 19:22:52 +02:00
Michael Kaufmann (d00p)
b4e8458076 enhance findDirs function and filter awstats/webalizer (sub)folders for target-directory selection
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-18 15:32:14 +02:00
Michael Kaufmann (d00p)
979b1b0ad8 forgot to add template for subjectAlternativeName stuff in ssl-overview
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-18 13:23:35 +02:00
Michael Kaufmann (d00p)
2bee58166b show also Subject-alternative-names in ssl-overview
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-18 09:07:20 +02:00
Michael Kaufmann (d00p)
3597a89da3 add missing customer_hide_option for fresh installs
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-13 11:08:26 +02:00
Michael Kaufmann (d00p)
f406962dfd allow empty select-value for panel.customer_hide_options
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-13 10:48:28 +02:00
Michael Kaufmann (d00p)
ce31a0b3fd enable custom redirect codes also for lighttpd
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-13 10:16:17 +02:00
Michael Kaufmann (d00p)
fc2ae594cb enable custom redirect codes also for nginx
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-10-13 09:51:57 +02:00
29 changed files with 306 additions and 146 deletions

View File

@@ -234,6 +234,7 @@ return array(
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_emptyallowed' => true,
'option_options' => array(
'email' => $lng['menue']['email']['email'],
'mysql' => $lng['menue']['mysql']['mysql'],

View File

@@ -39,7 +39,7 @@ return array(
'varname' => 'le_froxlor_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingClearCertificates',
'visible' => Settings::Get('system.leenabled')
),
'system_le_froxlor_redirect' => array(

View File

@@ -260,11 +260,7 @@ return array(
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'lighttpd'
)
'save_method' => 'storeSettingField'
),
'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'],
@@ -274,11 +270,7 @@ return array(
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'lighttpd'
)
'save_method' => 'storeSettingField'
)
)
)

View File

@@ -777,7 +777,7 @@ if ($page == 'domains' || $page == 'overview') {
'termination_date' => $termination_date,
'issubof' => $issubof,
'letsencrypt' => $letsencrypt,
'hsts' => $hsts_maxage,
'hsts_maxage' => $hsts_maxage,
'hsts_sub' => $hsts_sub,
'hsts_preload' => $hsts_preload
);
@@ -1081,8 +1081,12 @@ if ($page == 'domains' || $page == 'overview') {
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("
SELECT `d`.*, `c`.`customerid` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
WHERE `d`.`parentdomainid` = '0' AND `d`.`id` = :id" . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = :adminid"));
SELECT `d`.*, `c`.`customerid`
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
WHERE `d`.`parentdomainid` = '0'
AND `d`.`id` = :id" . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = :adminid")
);
$params = array(
'id' => $id
);
@@ -1227,7 +1231,7 @@ if ($page == 'domains' || $page == 'overview') {
$adminid = $result['adminid'];
}
$aliasdomain = intval($_POST['alias']);
$aliasdomain = isset($_POST['alias']) ? intval($_POST['alias']) : 0;
$issubof = intval($_POST['issubof']);
$subcanemaildomain = intval($_POST['subcanemaildomain']);
$caneditdomain = isset($_POST['caneditdomain']) ? intval($_POST['caneditdomain']) : 0;
@@ -1398,6 +1402,11 @@ if ($page == 'domains' || $page == 'overview') {
$letsencrypt = (int) $_POST['letsencrypt'];
}
// HSTS
$hsts_maxage = isset($_POST['hsts_maxage']) ? (int)$_POST['hsts_maxage'] : 0;
$hsts_sub = isset($_POST['hsts_sub']) && (int)$_POST['hsts_sub'] == 1 ? 1 : 0;
$hsts_preload = isset($_POST['hsts_preload']) && (int)$_POST['hsts_preload'] == 1 ? 1 : 0;
$ssl_ipandports = array();
if (isset($_POST['ssl_ipandport']) && ! is_array($_POST['ssl_ipandport'])) {
$_POST['ssl_ipandport'] = unserialize($_POST['ssl_ipandport']);
@@ -1424,11 +1433,6 @@ if ($page == 'domains' || $page == 'overview') {
}
}
// HSTS
$hsts_maxage = isset($_POST['hsts_maxage']) ? (int)$_POST['hsts_maxage'] : 0;
$hsts_sub = isset($_POST['hsts_sub']) && (int)$_POST['hsts_sub'] == 1 ? 1 : 0;
$hsts_preload = isset($_POST['hsts_preload']) && (int)$_POST['hsts_preload'] == 1 ? 1 : 0;
} else {
$ssl_redirect = 0;
$letsencrypt = 0;
@@ -1590,7 +1594,7 @@ if ($page == 'domains' || $page == 'overview') {
'ipandport' => serialize($ipandports),
'ssl_ipandport' => serialize($ssl_ipandports),
'letsencrypt' => $letsencrypt,
'hsts' => $hsts_maxage,
'hsts_maxage' => $hsts_maxage,
'hsts_sub' => $hsts_sub,
'hsts_preload' => $hsts_preload
);
@@ -1611,7 +1615,7 @@ if ($page == 'domains' || $page == 'overview') {
$wwwserveralias = ($serveraliasoption == '1') ? '1' : '0';
$iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0';
if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt']) {
if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload']) {
inserttask('1');
}
@@ -1640,6 +1644,16 @@ if ($page == 'domains' || $page == 'overview') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "deleted domain #" . $id . " from mail-tables");
}
// check whether LE has been disabled, so we remove the certificate
if ($letsencrypt == '0' && $result['letsencrypt'] == '1') {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :id
");
Database::pexecute($del_stmt, array(
'id' => $id
));
}
$updatechildren = '';
if ($subcanemaildomain == '0' && $result['subcanemaildomain'] != '0') {

View File

@@ -578,7 +578,7 @@ if ($page == 'overview') {
$_doredirect = true;
}
$aliasdomain = intval($_POST['alias']);
$aliasdomain = isset($_POST['alias']) ? intval($_POST['alias']) : 0;
if (isset($_POST['selectserveralias'])) {
$iswildcarddomain = ($_POST['selectserveralias'] == '0') ? '1' : '0';
@@ -681,7 +681,11 @@ if ($page == 'overview') {
|| $aliasdomain != $result['aliasdomain']
|| $openbasedir_path != $result['openbasedir_path']
|| $ssl_redirect != $result['ssl_redirect']
|| $letsencrypt != $result['letsencrypt']) {
|| $letsencrypt != $result['letsencrypt']
|| $hsts_maxage != $result['hsts']
|| $hsts_sub != $result['hsts_sub']
|| $hsts_preload != $result['hsts_preload']
) {
$log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
@@ -720,11 +724,20 @@ if ($page == 'overview') {
// trigger when domain id for alias destination has changed: both for old and new destination
triggerLetsEncryptCSRForAliasDestinationDomain($result['aliasdomain'], $log);
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
} else
if ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) {
// or when wwwserveralias or letsencrypt was changed
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
}
} elseif ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) {
// or when wwwserveralias or letsencrypt was changed
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
}
// check whether LE has been disabled, so we remove the certificate
if ($letsencrypt == '0' && $result['letsencrypt'] == '1') {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :id
");
Database::pexecute($del_stmt, array(
'id' => $id
));
}
inserttask('1');

View File

@@ -575,7 +575,8 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_numeric', '0'),
('panel', 'password_special_char_required', '0'),
('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'version', '0.9.38-rc1'),
('panel', 'customer_hide_options', ''),
('panel', 'version', '0.9.38'),
('panel', 'db_version', '201610070');

View File

@@ -3507,3 +3507,15 @@ if (isFroxlorVersion('0.9.37')) {
showUpdateStep("Updating from 0.9.37 to 0.9.38-rc1", false);
updateToVersion('0.9.38-rc1');
}
if (isFroxlorVersion('0.9.38-rc1')) {
showUpdateStep("Updating from 0.9.38-rc1 to 0.9.38-rc2", false);
updateToVersion('0.9.38-rc2');
}
if (isFroxlorVersion('0.9.38-rc2')) {
showUpdateStep("Updating from 0.9.38-rc2 to 0.9.38 final", false);
updateToVersion('0.9.38');
}

View File

@@ -135,15 +135,6 @@ class phpinterface_fcgid {
$openbasedir .= appendOpenBasedirPath($this->getTempDir());
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach ($openbasedir as $number => $path) {
if (trim($path) != '/') {
$clean_openbasedir[] = makeCorrectDir($path);
}
}
$openbasedir = implode(':', $clean_openbasedir);
} else {
$openbasedir = 'none';
$openbasedirc = ';';

View File

@@ -267,15 +267,6 @@ class phpinterface_fpm {
$openbasedir .= appendOpenBasedirPath($this->getTempDir());
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach ($openbasedir as $number => $path) {
if (trim($path) != '/') {
$clean_openbasedir[] = makeCorrectDir($path);
}
}
$openbasedir = implode(':', $clean_openbasedir);
}
}
$fpm_config.= 'php_admin_value[session.save_path] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";

View File

@@ -54,7 +54,7 @@ return array(
'type' => 'text'
),
'redirectcode' => array(
'visible' => ((Settings::Get('system.webserver') == 'apache2' && Settings::Get('customredirect.enabled') == '1') ? true : false),
'visible' => (Settings::Get('customredirect.enabled') == '1' ? true : false),
'label' => $lng['domains']['redirectifpathisurl'],
'desc' => $lng['domains']['redirectifpathisurlinfo'],
'type' => 'select',

View File

@@ -54,7 +54,7 @@ return array(
'value' => $urlvalue
),
'redirectcode' => array(
'visible' => ((Settings::Get('system.webserver') == 'apache2' && Settings::Get('customredirect.enabled') == '1') ? true : false),
'visible' => (Settings::Get('customredirect.enabled') == '1' ? true : false),
'label' => $lng['domains']['redirectifpathisurl'],
'desc' => $lng['domains']['redirectifpathisurlinfo'],
'type' => 'select',

View File

@@ -275,13 +275,11 @@ function createDomainZone($domain_id, $froxlorhostname = false, $isMainButSubTo
Database::pexecute($upd_stmt, array('serial' => $domain['bindserial'], 'id' => $domain['id']));
}
$soa_content = $primary_ns . " " . escapeSoaAdminMail(Settings::Get('panel.adminmail')) . " (" . PHP_EOL;
$soa_content .= $domain['bindserial'] . "\t; serial" . PHP_EOL;
// PowerDNS does not like multi-line-format
$soa_content = $primary_ns . " " . escapeSoaAdminMail(Settings::Get('panel.adminmail')) . " ";
$soa_content .= $domain['bindserial'] . " ";
// TODO for now, dummy time-periods
$soa_content .= "1800\t; refresh (30 mins)" . PHP_EOL;
$soa_content .= "900\t; retry (15 mins)" . PHP_EOL;
$soa_content .= "604800\t; expire (7 days)" . PHP_EOL;
$soa_content .= "1200\t)\t; minimum (20 mins)";
$soa_content .= "1800 900 604800 1200";
$soa_record = new DnsEntry('@', 'SOA', $soa_content);
array_unshift($zonerecords, $soa_record);

View File

@@ -17,27 +17,57 @@
*
*/
/**
* Returns an array of found directories
*
* This function checks every found directory if they match either $uid or $gid, if they do
* the found directory is valid. It uses recursive-iterators to find subdirectories.
*
* @param string $path the path to start searching in
* @param int $uid the uid which must match the found directories
* @param int $gid the gid which must match the found direcotries
* @param string $path
* the path to start searching in
* @param int $uid
* the uid which must match the found directories
* @param int $gid
* the gid which must match the found direcotries
*
* @return array Array of found valid paths
*/
function findDirs($path, $uid, $gid) {
$_fileList = array ();
function findDirs($path, $uid, $gid)
{
$_fileList = array();
$path = makeCorrectDir($path);
// valid directory?
if (is_dir($path)) {
// Will exclude everything under these directories
$exclude = array(
'awstats',
'webalizer'
);
/**
*
* @param SplFileInfo $file
* @param mixed $key
* @param RecursiveCallbackFilterIterator $iterator
* @return bool True if you need to recurse or if the item is acceptable
*/
$filter = function ($file, $key, $iterator) use ($exclude) {
if (in_array($file->getFilename(), $exclude)) {
return false;
}
return true;
};
// create RecursiveIteratorIterator
$its = new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($path));
$its = new RecursiveIteratorIterator(
new RecursiveCallbackFilterIterator(
new IgnorantRecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
$filter
)
);
// we can limit the recursion-depth, but will it be helpful or
// will people start asking "why do I only see 2 subdirectories, i want to use /a/b/c"
// let's keep this in mind and see whether it will be useful
@@ -50,24 +80,27 @@ function findDirs($path, $uid, $gid) {
$_fileList[] = makeCorrectDir(dirname($fullFileName));
}
}
$_fileList[] = $path;
}
return array_unique($_fileList);
}
/**
* If you use RecursiveDirectoryIterator with RecursiveIteratorIterator and run
* into UnexpectedValueException you may use this little hack to ignore those
* directories, such as lost+found on linux.
* (User "antennen" @ http://php.net/manual/en/class.recursivedirectoryiterator.php#101654)
**/
class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
function getChildren() {
try {
return new IgnorantRecursiveDirectoryIterator($this->getPathname());
} catch(UnexpectedValueException $e) {
return new RecursiveArrayIterator(array());
}
}
* If you use RecursiveDirectoryIterator with RecursiveIteratorIterator and run
* into UnexpectedValueException you may use this little hack to ignore those
* directories, such as lost+found on linux.
* (User "antennen" @ http://php.net/manual/en/class.recursivedirectoryiterator.php#101654)
*/
class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator
{
function getChildren()
{
try {
return new IgnorantRecursiveDirectoryIterator($this->getPathname());
} catch (UnexpectedValueException $e) {
return new RecursiveArrayIterator(array());
}
}
}

View File

@@ -26,7 +26,7 @@
*/
function makeCorrectDir($dir) {
assert('is_string($dir) && strlen($dir) > 0 /* $dir does not look like an actual folder name */');
assert('is_string($dir) && strlen($dir) > 0', 'Value "' . $dir .'" does not look like an actual folder name');
$dir = trim($dir);

View File

@@ -64,7 +64,12 @@ function makePathfield($path, $uid, $gid, $value = '', $dom = false) {
$_field = '';
foreach ($dirList as $key => $dir) {
if (strpos($dir, $path) === 0) {
$dir = makeCorrectDir(substr($dir, strlen($path)));
$dir = substr($dir, strlen($path));
// docroot cut off of current directory == empty -> directory is the docroot
if (empty($dir)) {
$dir = '/';
}
$dir = makeCorrectDir($dir);
}
$_field.= makeoption($dir, $dir, $value);
}

View File

@@ -20,7 +20,7 @@
function validateFormFieldOption($fieldname, $fielddata, $newfieldvalue)
{
$returnvalue = true;
if(isset($fielddata['option_mode']) && $fielddata['option_mode'] == 'multiple')
{
$options = explode(',', $newfieldvalue);
@@ -33,13 +33,16 @@ function validateFormFieldOption($fieldname, $fielddata, $newfieldvalue)
{
$returnvalue = isset($fielddata['option_options'][$newfieldvalue]);
}
if($returnvalue === true)
{
return true;
}
else
{
if (isset($fielddata['option_emptyallowed']) && $fielddata['option_emptyallowed']) {
return true;
}
return 'not in option';
}
}

View File

@@ -122,7 +122,7 @@ function validateFormFieldString($fieldname, $fielddata, $newfieldvalue)
$newfieldvalue = '';
$returnvalue = 'stringmustntbeempty';
} else {
$newfieldvalue = validate_ip2($newfieldvalue, true, true, true);
$newfieldvalue = validate_ip2($newfieldvalue, true, 'invalidip', true, true, true);
$returnvalue = ($newfieldvalue !== false ? true : 'invalidip');
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
function storeSettingClearCertificates($fieldname, $fielddata, $newfieldvalue) {
$returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
if ($returnvalue !== false
&& is_array($fielddata)
&& isset($fielddata['settinggroup'])
&& $fielddata['settinggroup'] == 'system'
&& isset($fielddata['varname'])
&& $fielddata['varname'] == 'le_froxlor_enabled'
&& $newfieldvalue == '0'
) {
Database::query("
DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = '0'
");
}
return $returnvalue;
}

View File

@@ -21,40 +21,43 @@
* to a line for a open_basedir directive
*
* @param string $path
* the path to check and append
* the path to check and append
* @param boolean $first
* if true, no ':' will be prefixed to the path
*
* if true, no ':' will be prefixed to the path
*
* @return string
*/
function appendOpenBasedirPath($path = '', $first = false)
{
if ($path != '' && $path != '/'
&& (! preg_match("#^/dev#i", $path) || preg_match("#^/dev/urandom#i", $path))
&& ! preg_match("#^/proc#i", $path)
&& ! preg_match("#^/etc#i", $path)
&& ! preg_match("#^/sys#i", $path)
&& ! preg_match("#:#", $path)
) {
$path = makeCorrectDir($path);
// check for php-version that requires the trailing
// slash to be removed as it does not allow the usage
// of the subfolders within the given folder, fixes #797
if ((PHP_MINOR_VERSION == 2 && PHP_VERSION_ID >= 50216) || PHP_VERSION_ID >= 50304) {
// check trailing slash
if (substr($path, - 1, 1) == '/') {
// remove it
$path = substr($path, 0, - 1);
}
}
if ($first) {
return $path;
}
return ':' . $path;
}
return '';
if ($path != '' && $path != '/' &&
(! preg_match("#^/dev#i", $path) || preg_match("#^/dev/urandom#i", $path))
&& ! preg_match("#^/proc#i", $path)
&& ! preg_match("#^/etc#i", $path)
&& ! preg_match("#^/sys#i", $path)
&& ! preg_match("#:#", $path)) {
if (preg_match("#^/dev/urandom#i", $path)) {
$path = makeCorrectFile($path);
} else {
$path = makeCorrectDir($path);
}
// check for php-version that requires the trailing
// slash to be removed as it does not allow the usage
// of the subfolders within the given folder, fixes #797
if ((PHP_MINOR_VERSION == 2 && PHP_VERSION_ID >= 50216) || PHP_VERSION_ID >= 50304) {
// check trailing slash
if (substr($path, - 1, 1) == '/') {
// remove it
$path = substr($path, 0, - 1);
}
}
if ($first) {
return $path;
}
return ':' . $path;
}
return '';
}

View File

@@ -49,23 +49,43 @@ function validate_ip($ip, $return_bool = false, $lng = 'invalidip') {
* @param string $lng index for error-message (if $return_bool is false)
* @param bool $allow_localhost whether to allow 127.0.0.1
* @param bool $allow_priv whether to allow private network addresses
* @param bool $allow_cidr whether to allow CIDR values e.g. 10.10.10.10/16
*
* @return string|bool ip address on success, false on failure
*/
function validate_ip2($ip, $return_bool = false, $lng = 'invalidip', $allow_localhost = false, $allow_priv = false) {
function validate_ip2($ip, $return_bool = false, $lng = 'invalidip', $allow_localhost = false, $allow_priv = false, $allow_cidr = false) {
$filter_lan = $allow_priv ? FILTER_FLAG_NO_RES_RANGE : (FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE);
$cidr = "";
if ($allow_cidr) {
$org_ip = $ip;
$ip_cidr = explode("/", $ip);
if (count($ip_cidr) == 2) {
$ip = $ip_cidr[0];
$cidr = "/".$ip_cidr[1];
} else {
$ip = $org_ip;
}
} elseif (strpos($ip, "/") !== false) {
if ($return_bool) {
return false;
} else {
standard_error($lng, $ip);
exit();
}
}
$filter_lan = $allow_priv ? FILTER_FLAG_NO_RES_RANGE : (FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE);
if ((filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
|| filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
&& filter_var($ip, FILTER_VALIDATE_IP, $filter_lan)
) {
return $ip;
return $ip.$cidr;
}
// special case where localhost ip is allowed (mysql-access-hosts for example)
if ($allow_localhost && $ip == '127.0.0.1') {
return $ip;
return $ip.$cidr;
}
if ($return_bool) {

View File

@@ -16,7 +16,7 @@
*/
// Main version variable
$version = '0.9.38-rc1';
$version = '0.9.38';
// Database version (YYYYMMDDC where C is a daily counter)
$dbversion = '201610070';

View File

@@ -141,8 +141,7 @@ if (Settings::Get('system.le_froxlor_enabled') == '1') {
if ($insert_or_update_required) {
$domains = array(
$certrow['domain'],
'www.' . $certrow['domain']
$certrow['domain']
);
// Only renew let's encrypt certificate if no broken ssl_redirect is enabled

View File

@@ -129,9 +129,7 @@ class bind extends DnsBase
// AXFR server #100
if (count($this->_axfr) > 0) {
foreach ($this->_axfr as $axfrserver) {
if (validate_ip($axfrserver, true) !== false) {
$bindconf_file .= ' ' . $axfrserver . ';' . "\n";
}
$bindconf_file .= ' ' . $axfrserver . ';' . "\n";
}
}
// close allow-transfer

View File

@@ -194,10 +194,8 @@ class pdns extends DnsBase
// AXFR server #100
if (count($this->_axfr) > 0) {
foreach ($this->_axfr as $axfrserver) {
if (validate_ip($axfrserver, true) !== false) {
$ins_data['value'] = $axfrserver;
$ins_stmt->execute($ins_data);
}
$ins_data['value'] = $axfrserver;
$ins_stmt->execute($ins_data);
}
}
}

View File

@@ -1,5 +1,4 @@
<?php
if (! defined('MASTER_CRONJOB'))
die('You cannot access this file directly!');
@@ -183,6 +182,10 @@ class apache extends HttpConfigBase
}
if ($row_ipsandports['vhostcontainer'] == '1') {
$without_vhost = $this->virtualhosts_data[$vhosts_filename];
$close_vhost = true;
$this->virtualhosts_data[$vhosts_filename] .= '<VirtualHost ' . $ipport . '>' . "\n";
$mypath = $this->getMyPath($row_ipsandports);
@@ -224,7 +227,7 @@ class apache extends HttpConfigBase
}
}
if (!$is_redirect) {
if (! $is_redirect) {
// create fcgid <Directory>-Part (starter is created in apache_fcgid)
if (Settings::Get('system.mod_fcgid_ownvhost') == '1' && Settings::Get('system.mod_fcgid') == '1') {
$configdir = makeCorrectDir(Settings::Get('system.mod_fcgid_configdir') . '/froxlor.panel/' . Settings::Get('system.hostname'));
@@ -274,13 +277,14 @@ class apache extends HttpConfigBase
}
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
}
} // create php-fpm <Directory>-Part (config is created in apache_fcgid)
}
elseif (Settings::Get('phpfpm.enabled') == '1') {
// create php-fpm <Directory>-Part (config is created in apache_fcgid)
$domain = array(
'id' => 'none',
'domain' => Settings::Get('system.hostname'),
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => - 1,
'mod_fcgid_starter' => - 1,
'mod_fcgid_maxrequests' => - 1,
'guid' => Settings::Get('phpfpm.vhost_httpuser'),
'openbasedir' => 0,
@@ -332,7 +336,7 @@ class apache extends HttpConfigBase
'id' => 'none',
'domain' => Settings::Get('system.hostname'),
'adminid' => 1, /* first admin-user (superadmin) */
'guid' => Settings::Get('system.httpuser'),
'guid' => Settings::Get('system.httpuser'),
'openbasedir' => 0,
'email' => Settings::Get('panel.adminmail'),
'loginname' => 'froxlor.panel',
@@ -408,7 +412,7 @@ class apache extends HttpConfigBase
} else {
$this->virtualhosts_data[$vhosts_filename] .= ' SSLEngine On' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' SSLProtocol ALL -SSLv2 -SSLv3' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' SSLProtocol -ALL +TLSv1 +TLSv1.2' . "\n";
// this makes it more secure, thx to Marcel (08/2013)
$this->virtualhosts_data[$vhosts_filename] .= ' SSLHonorCipherOrder On' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCipherSuite ' . Settings::Get('system.ssl_cipher_list') . "\n";
@@ -443,10 +447,19 @@ class apache extends HttpConfigBase
}
}
}
} else {
// if there is no cert-file specified but we are generating a ssl-vhost,
// we should return an empty string because this vhost would suck dick, ref #1583
$this->logger->logAction(CRON_ACTION, LOG_ERR, $domain['domain'] . ' :: empty certificate file! Cannot create ssl-directives');
$this->virtualhosts_data[$vhosts_filename] = $without_vhost;
$this->virtualhosts_data[$vhosts_filename] .= '# no ssl-certificate was specified for this domain, therefore no explicit vhost-container is being generated';
$close_vhost = false;
}
}
$this->virtualhosts_data[$vhosts_filename] .= '</VirtualHost>' . "\n";
if ($close_vhost) {
$this->virtualhosts_data[$vhosts_filename] .= '</VirtualHost>' . "\n";
}
$this->logger->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted vhostcontainer');
}
unset($vhosts_filename);
@@ -602,10 +615,10 @@ class apache extends HttpConfigBase
} else {
$stats_text .= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer') . '"' . "\n";
}
} // if the docroots are equal, we still have to set an alias for awstats
// because the stats are in /awstats/[domain], not just /awstats/
// also, the awstats-icons are someplace else too!
// -> webalizer does not need this!
} // if the docroots are equal, we still have to set an alias for awstats
// because the stats are in /awstats/[domain], not just /awstats/
// also, the awstats-icons are someplace else too!
// -> webalizer does not need this!
elseif (Settings::Get('system.awstats_enabled') == '1') {
$stats_text .= ' Alias /awstats "' . makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '"' . "\n";
$stats_text .= ' Alias /awstats-icon "' . makeCorrectDir(Settings::Get('system.awstats_icons')) . '"' . "\n";
@@ -817,7 +830,7 @@ class apache extends HttpConfigBase
if ($domain['ssl_cert_file'] != '') {
$vhost_content .= ' SSLEngine On' . "\n";
$vhost_content .= ' SSLProtocol ALL -SSLv2 -SSLv3' . "\n";
$vhost_content .= ' SSLProtocol -ALL +TLSv1 +TLSv1.2' . "\n";
// this makes it more secure, thx to Marcel (08/2013)
$vhost_content .= ' SSLHonorCipherOrder On' . "\n";
$vhost_content .= ' SSLCipherSuite ' . Settings::Get('system.ssl_cipher_list') . "\n";
@@ -860,8 +873,10 @@ class apache extends HttpConfigBase
$domain['documentroot'] = trim($domain['documentroot']);
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
$corrected_docroot = $this->idnaConvert->encode_uri($domain['documentroot']);
$corrected_docroot = $domain['documentroot'];
// prevent empty return-cde
$code = "301";
// Get domain's redirect code
$code = getDomainRedirectCode($domain['id']);
$modrew_red = '';

View File

@@ -210,7 +210,9 @@ class lighttpd extends HttpConfigBase
echo $ip . ':' . $port . ' :: certificate file "' . $domain['ssl_cert_file'] . '" does not exist! Cannot create SSL-directives' . "\n";
} else {
$this->lighttpd_data[$vhost_filename] .= 'ssl.engine = "enable"' . "\n";
$this->lighttpd_data[$vhost_filename] .= 'ssl.use-compression = "disable"' . "\n";
$this->lighttpd_data[$vhost_filename] .= 'ssl.use-sslv2 = "disable"' . "\n";
$this->lighttpd_data[$vhost_filename] .= 'ssl.use-sslv3 = "disable"' . "\n";
$this->lighttpd_data[$vhost_filename] .= 'ssl.cipher-list = "' . Settings::Get('system.ssl_cipher_list') . '"' . "\n";
$this->lighttpd_data[$vhost_filename] .= 'ssl.honor-cipher-order = "enable"' . "\n";
$this->lighttpd_data[$vhost_filename] .= 'ssl.pemfile = "' . makeCorrectFile($domain['ssl_cert_file']) . '"' . "\n";
@@ -429,8 +431,15 @@ class lighttpd extends HttpConfigBase
$domain['documentroot'] = trim($domain['documentroot']);
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
$uri = $domain['documentroot'];
// prevent empty return-cde
$code = "301";
// Get domain's redirect code
$code = getDomainRedirectCode($domain['id']);
$vhost_content .= ' url.redirect-code = ' . $code. "\n";
$vhost_content .= ' url.redirect = (' . "\n";
$vhost_content .= ' "^/(.*)$" => "' . $this->idnaConvert->encode_uri($domain['documentroot']) . '$1"' . "\n";
$vhost_content .= ' "^/(.*)$" => "' . $uri . '$1"' . "\n";
$vhost_content .= ' )' . "\n";
} else {
@@ -510,7 +519,9 @@ class lighttpd extends HttpConfigBase
if ($domain['ssl_cert_file'] != '') {
$ssl_settings .= 'ssl.engine = "enable"' . "\n";
$ssl_settings .= 'ssl.use-compression = "disable"' . "\n";
$ssl_settings .= 'ssl.use-sslv2 = "disable"' . "\n";
$ssl_settings .= 'ssl.use-sslv3 = "disable"' . "\n";
$ssl_settings .= 'ssl.cipher-list = "' . Settings::Get('system.ssl_cipher_list') . '"' . "\n";
$ssl_settings .= 'ssl.honor-cipher-order = "enable"' . "\n";
$ssl_settings .= 'ssl.pemfile = "' . makeCorrectFile($domain['ssl_cert_file']) . '"' . "\n";

View File

@@ -456,12 +456,17 @@ class nginx extends HttpConfigBase
// if the documentroot is an URL we just redirect
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
$uri = $this->idnaConvert->encode_uri($domain['documentroot']);
$uri = $domain['documentroot'];
if (substr($uri, - 1) == '/') {
$uri = substr($uri, 0, - 1);
}
// prevent empty return-cde
$code = "301";
// Get domain's redirect code
$code = getDomainRedirectCode($domain['id']);
$vhost_content .= "\t" . 'if ($request_uri !~ "^/\.well-known/acme-challenge/\w+$") {' . "\n";
$vhost_content .= "\t\t" . 'return 301 ' . $uri . '$request_uri;' . "\n";
$vhost_content .= "\t\t" . 'return ' . $code .' ' . $uri . '$request_uri;' . "\n";
$vhost_content .= "\t" . '}' . "\n";
} else {
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true);
@@ -596,7 +601,7 @@ class nginx extends HttpConfigBase
} else {
// obsolete: ssl on now belongs to the listen block as 'ssl' at the end
// $sslsettings .= "\t" . 'ssl on;' . "\n";
$sslsettings .= "\t" . 'ssl_protocols TLSv1 TLSv1.1 TLSv1.2;' . "\n";
$sslsettings .= "\t" . 'ssl_protocols TLSv1 TLSv1.2;' . "\n";
$sslsettings .= "\t" . 'ssl_ciphers ' . Settings::Get('system.ssl_cipher_list') . ';' . "\n";
$sslsettings .= "\t" . 'ssl_ecdh_curve secp384r1;' . "\n";
$sslsettings .= "\t" . 'ssl_prefer_server_ciphers on;' . "\n";

View File

@@ -86,6 +86,13 @@ if (count($all_certs) == 0) {
foreach ($all_certs as $idx => $cert) {
if ($paging->checkDisplay($idx)) {
// respect froxlor-hostname
if ($cert['domainid'] == 0) {
$cert['domain'] = Settings::Get('system.hostname');
$cert['letsencrypt'] = Settings::Get('system.le_froxlor_enabled');
$cert['loginname'] = 'froxlor.panel';
}
if (empty($cert['domain']) || empty($cert['ssl_cert_file'])) {
// no domain found to the entry or empty entry - safely delete it from the DB
Database::pexecute($del_stmt, array(
@@ -96,10 +103,10 @@ if (count($all_certs) == 0) {
$cert_data = openssl_x509_parse($cert['ssl_cert_file']);
$cert['domain'] = $idna_convert->encode($cert['domain']);
$cert['domain'] = $idna_convert->decode($cert['domain']);
$adminCustomerLink = "";
if (AREA == 'admin') {
if (AREA == 'admin' && $cert['domainid'] > 0) {
if (! empty($cert['loginname'])) {
$adminCustomerLink = '&nbsp;(<a href="' . $linker->getLink(array(
'section' => 'customers',
@@ -119,6 +126,18 @@ if (count($all_certs) == 0) {
$isValid = false;
}
$san_list = "";
if (isset($cert_data['extensions']['subjectAltName']) && !empty($cert_data['extensions']['subjectAltName'])) {
$SANs = explode(",", $cert_data['extensions']['subjectAltName']);
$SANs = array_map('trim', $SANs);
foreach ($SANs as $san) {
$san = str_replace("DNS:", "", $san);
if ($san != $cert_data['subject']['CN'] && strpos($san, "othername:") === false) {
$san_list .= $san."<br>";
}
}
}
$row = htmlentities_array($cert);
eval("\$certificates.=\"" . getTemplate("ssl_certificates/certs_cert", true) . "\";");
} else {

View File

@@ -5,6 +5,7 @@
</td>
<td>
{$cert_data['subject']['CN']}
<if !empty($san_list)><br>SAN: {$san_list}</if>
</td>
<td>
{$cert_data['issuer']['O']}