More fixes for gentoo's confs related to uid/gid.

Gentoo 'mail' user/group has uid/gid 8/12 respectively. This makes
postfix' 'virtual' complain about 'bad uid'. Then the default is set
back to 'vmail' user/group. You can force using the 'mail' user (which
is responsible for the local mail delivery files) by adding to
/etc/postfix/main.cf the following lines:
virtual_minimum_uid = 8
virtual_minimum_gid = 12

  But this is not encouraged, so the default is to create a really
unprivileged 'vmail' user with a high uid/gid (above 1000).

  Due to this, the test for already existent uid/gid is added here (if
you have set uid/gid on froxlor but they don't actually exist, lines to
add the user/group will be added to the config file as it does with the
other distro's files.
This commit is contained in:
avengerx
2012-07-02 03:11:27 -03:00
parent 7a4ce63b75
commit e7c11bfe5f

View File

@@ -24,12 +24,12 @@ $vmail_group=posix_getgrgid($settings['system']['vmail_gid']);
/* If one of them are not set, call it 'vmail' and suggest creating user/group
* in scripts. */
if ($vmail_user === false) {
$vmail_username="mail"; // Gentoo uses 'mail' user/group
$vmail_username="vmail";
} else {
$vmail_username=$vmail_user['name'];
}
if ($vmail_group === false) {
$vmail_groupname="mail"; // Gentoo uses 'mail' user/group
$vmail_groupname="vmail";
} else {
$vmail_groupname=$vmail_group['name'];
}
@@ -140,10 +140,12 @@ return Array(
'postfix_courier' => Array(
'label' => 'Postfix/Courier',
'commands_1' => Array(
($vmail_group === false) ? 'groupadd -g ' . $settings['system']['vmail_gid'] . ' ' . $vmail_groupname : '',
($vmail_user === false) ? 'useradd -u ' . $settings['system']['vmail_uid'] . ' -g ' . $vmail_groupname . ' ' . $vmail_username : '',
'echo "mail-mta/postfix -dovecot-sasl sasl" >> /etc/portage/package.use',
'emerge -av postfix',
'mkdir -p ' . $settings['system']['vmail_homedir'],
'chown -R '.$vmail_user['name'].':'.$vmail_group['name'].' ' . $settings['system']['vmail_homedir'],
'chown -R '.$vmail_username.':'.$vmail_groupname.' ' . $settings['system']['vmail_homedir'],
'chmod 0750 ' . $settings['system']['vmail_homedir'],
'mv /etc/postfix/main.cf /etc/postfix/main.cf.gentoo',
'touch /etc/postfix/main.cf',
@@ -178,6 +180,8 @@ return Array(
'postfix_dovecot' => Array(
'label' => 'Postfix/Dovecot',
'commands_1' => Array(
($vmail_group === false) ? 'groupadd -g ' . $settings['system']['vmail_gid'] . ' ' . $vmail_groupname : '',
($vmail_user === false) ? 'useradd -u ' . $settings['system']['vmail_uid'] . ' -g ' . $vmail_groupname . ' ' . $vmail_username : '',
'echo "mail-mta/postfix dovecot-sasl -sasl" >> /etc/portage/package.use',
'emerge -av postfix',
'mkdir -p ' . $settings['system']['vmail_homedir'],