diff --git a/install/froxlor.sql b/install/froxlor.sql
index fa352c50..fbdabcd5 100644
--- a/install/froxlor.sql
+++ b/install/froxlor.sql
@@ -552,6 +552,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'hsts_incsub', '0'),
('system', 'hsts_preload', '0'),
('system', 'leregistered', '0'),
+ ('system', 'nssextrausers', '0'),
('panel', 'decimal_places', '4'),
('panel', 'adminmail', 'admin@SERVERNAME'),
('panel', 'phpmyadmin_url', ''),
@@ -584,7 +585,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_special_char', '!?<>ยง$%+#=@'),
('panel', 'customer_hide_options', ''),
('panel', 'version', '0.9.38.7'),
- ('panel', 'db_version', '201704100');
+ ('panel', 'db_version', '201705050');
DROP TABLE IF EXISTS `panel_tasks`;
diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php
index 10a2ef19..1701f8be 100644
--- a/install/updates/froxlor/0.9/update_0.9.inc.php
+++ b/install/updates/froxlor/0.9/update_0.9.inc.php
@@ -3607,3 +3607,13 @@ if (isDatabaseVersion('201612110')) {
updateToDbVersion('201704100');
}
+
+if (isDatabaseVersion('201704100')) {
+
+ showUpdateStep("Adding new setting for libnss-extrausers");
+ $system_nssextrausers= isset($_POST['system_nssextrausers']) ? (int) $_POST['system_nssextrausers'] : 0;
+ Settings::AddNew('system.nssextrausers', $system_nssextrausers);
+ lastStepStatus(0);
+
+ updateToDbVersion('201705050');
+}
diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php
index a25b78fc..a528c322 100644
--- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php
+++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php
@@ -709,4 +709,12 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
$question .= '
';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
+
+ if (versionInUpdate($current_db_version, '201705050')) {
+ $has_preconfig = true;
+ $description = 'DEBIAN/UBUNTU ONLY: Enable usage of libnss-extrausers as alternative to libnss-mysql (NOTE: if enabled, go through the configuration steps right after the update!!!)
';
+ $question = 'Enable usage of libnss-extrausers?
';
+ $question .= makeyesno('system_nssextrausers', '1', '0', '0') . '
';
+ eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
+ }
}
diff --git a/lib/configfiles/jessie.xml b/lib/configfiles/jessie.xml
index c9ac50af..ccdbe9a3 100644
--- a/lib/configfiles/jessie.xml
+++ b/lib/configfiles/jessie.xml
@@ -4634,6 +4634,42 @@ aliases: files
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/configfiles/precise.xml b/lib/configfiles/precise.xml
index c985a38e..24d6967b 100644
--- a/lib/configfiles/precise.xml
+++ b/lib/configfiles/precise.xml
@@ -1624,6 +1624,42 @@ netmasks: files
netgroup: files
bootparams: files
+automount: files
+aliases: files
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/configfiles/trusty.xml b/lib/configfiles/trusty.xml
index 7a7aeb8d..44500921 100644
--- a/lib/configfiles/trusty.xml
+++ b/lib/configfiles/trusty.xml
@@ -1642,6 +1642,42 @@ aliases: files
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/configfiles/wheezy.xml b/lib/configfiles/wheezy.xml
index 6e286017..b6fe5698 100644
--- a/lib/configfiles/wheezy.xml
+++ b/lib/configfiles/wheezy.xml
@@ -5433,6 +5433,42 @@ netmasks: files
netgroup: files
bootparams: files
+automount: files
+aliases: files
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/version.inc.php b/lib/version.inc.php
index db028f51..7d67b9da 100644
--- a/lib/version.inc.php
+++ b/lib/version.inc.php
@@ -19,7 +19,7 @@
$version = '0.9.38.7';
// Database version (YYYYMMDDC where C is a daily counter)
-$dbversion = '201704100';
+$dbversion = '201705050';
// Distribution branding-tag (used for Debian etc.)
$branding = '';
diff --git a/scripts/classes/class.Extrausers.php b/scripts/classes/class.Extrausers.php
new file mode 100644
index 00000000..4b979a79
--- /dev/null
+++ b/scripts/classes/class.Extrausers.php
@@ -0,0 +1,72 @@
+ (2017-)
+ * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
+ * @package Cron
+ *
+ */
+class Extrausers
+{
+
+ public static function generateFiles(&$cronlog)
+ {
+ // passwd
+ $passwd = '/var/lib/extrausers/passwd';
+ $sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell FROM ftp_users WHERE login_enabled = 'Y' ORDER BY uid ASC";
+ self::_generateFile($passwd, $sql, $cronlog);
+
+ // group
+ $group = '/var/lib/extrausers/group';
+ $sql = "SELECT groupname,'x' as password,gid,members FROM ftp_groups ORDER BY gid ASC";
+ self::_generateFile($group, $sql, $cronlog);
+
+ // shadow
+ $shadow = '/var/lib/extrausers/shadow';
+ $sql = "SELECT username,password FROM ftp_users ORDER BY gid ASC";
+ self::_generateFile($shadow, $sql, $cronlog);
+ }
+
+ private static function _generateFile($file, $query, &$cronlog)
+ {
+ $type = basename($file);
+ $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Creating ' . $type . ' file');
+
+ if (! file_exists($file)) {
+ $cronlog->logAction(CRON_ACTION, LOG_NOTICE, $type . ' file does not yet exist');
+ @mkdir(dirname($file), 0750, true);
+ touch($file);
+ }
+
+ $data_sel_stmt = Database::query($query);
+ $data_content = "";
+ $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Writing ' . $data_sel_stmt->rowCount() . ' entries to ' . $type . ' file');
+ while ($u = $data_sel_stmt->fetch(PDO::FETCH_ASSOC)) {
+ switch ($type) {
+ case 'passwd':
+ $line = $u['username'] . ':' . $u['password'] . ':' . $u['uid'] . ':' . $u['gid'] . ':' . $u['comment'] . ':' . $u['homedir'] . ':' . $u['shell'] . PHP_EOL;
+ break;
+ case 'group':
+ $line = $u['groupname'] . ':' . $u['password'] . ':' . $u['gid'] . ':' . $u['members'] . PHP_EOL;
+ break;
+ case 'shadow':
+ $line = $u['username'] . ':' . $u['password'] . ':' . floor(time() / 86400 - 1) . ':0:99999:7:::' . PHP_EOL;
+ break;
+ }
+ $data_content .= $line;
+ }
+ if (file_put_contents($file, $data_content) !== false) {
+ $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Succesfully wrote ' . $type . ' file');
+ } else {
+ $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Error when writing ' . $type . ' file entries');
+ }
+ }
+}
diff --git a/scripts/froxlor_master_cronjob.php b/scripts/froxlor_master_cronjob.php
index 3e4923d4..d00926c6 100644
--- a/scripts/froxlor_master_cronjob.php
+++ b/scripts/froxlor_master_cronjob.php
@@ -68,6 +68,9 @@ for ($x = 1; $x < count($argv); $x++) {
$cronlog->setCronDebugFlag(defined('CRON_DEBUG_FLAG'));
+$tasks_cnt_stmt = Database::query("SELECT COUNT(*) as jobcnt FROM `panel_tasks`");
+$tasks_cnt = $tasks_cnt_stmt->fetch(PDO::FETCH_ASSOC);
+
// do we have anything to include?
if (count($jobs_to_run) > 0) {
// include all jobs we want to execute
@@ -76,6 +79,21 @@ if (count($jobs_to_run) > 0) {
$cronfile = getCronFile($cron);
require_once $cronfile;
}
+
+ if ($tasks_cnt['jobcnt'] > 0)
+ {
+ if (Settings::Get('system.nssextrausers') == 1)
+ {
+ include_once makeCorrectFile(FROXLOR_INSTALL_DIR.'/scripts/classes/class.Extrausers.php');
+ Extrausers::generateFiles($cronlog);
+ }
+
+ // clear NSCD cache if using fcgid or fpm, #1570
+ if (Settings::Get('system.mod_fcgid') == 1 || (int)Settings::Get('phpfpm.enabled') == 1) {
+ $false_val = false;
+ safe_exec('nscd -i group 1> /dev/null', $false_val, array('>'));
+ }
+ }
}
fwrite($debugHandler, 'Cronfiles have been included' . "\n");
diff --git a/scripts/jobs/cron_tasks.php b/scripts/jobs/cron_tasks.php
index dd7a754f..cd9bb294 100644
--- a/scripts/jobs/cron_tasks.php
+++ b/scripts/jobs/cron_tasks.php
@@ -168,6 +168,13 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: chown -R ' . (int)Settings::Get('system.vmail_uid') . ':' . (int)Settings::Get('system.vmail_gid') . ' ' . escapeshellarg($usermaildir));
safe_exec('chown -R ' . (int)Settings::Get('system.vmail_uid') . ':' . (int)Settings::Get('system.vmail_gid') . ' ' . escapeshellarg($usermaildir));
+ if (Settings::Get('system.nssextrausers') == 1)
+ {
+ // explicitly create files after user has been created to avoid unknown user issues for apache/php-fpm when task#1 runs after this
+ include_once makeCorrectFile(FROXLOR_INSTALL_DIR.'/scripts/classes/class.Extrausers.php');
+ Extrausers::generateFiles($cronlog);
+ }
+
// clear NSCD cache if using fcgid or fpm, #1570
if (Settings::Get('system.mod_fcgid') == 1 || (int)Settings::Get('phpfpm.enabled') == 1) {
$false_val = false;