@@ -2060,8 +2060,10 @@ public function configure_rspamd() {
20602060 }
20612061
20622062 # unneccesary, since this was done above?
2063- $ command = 'usermod -a -G amavis _rspamd ' ;
2064- caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
2063+ if (is_user ('_rspamd ' ) && is_group ('amavis ' )) {
2064+ $ command = 'usermod -a -G amavis _rspamd ' ;
2065+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
2066+ }
20652067
20662068 if (strpos (rf ('/etc/rspamd/rspamd.conf ' ), '.include "$LOCAL_CONFDIR/local.d/users.conf" ' ) === false ){
20672069 af ('/etc/rspamd/rspamd.conf ' , '.include "$LOCAL_CONFDIR/local.d/users.conf" ' );
@@ -2682,7 +2684,7 @@ public function configure_apps_vhost() {
26822684
26832685 //$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group;
26842686 $ command = 'usermod -a -G ' .$ apps_vhost_group .' ' .$ conf ['apache ' ]['user ' ];
2685- caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
2687+ caselog ($ command .' &> /dev/null 2>&1 ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
26862688
26872689 if (!@is_dir ($ install_dir )){
26882690 mkdir ($ install_dir , 0755 , true );
@@ -2774,7 +2776,7 @@ public function configure_apps_vhost() {
27742776
27752777 //$command = 'adduser '.$conf['nginx']['user'].' '.$apps_vhost_group;
27762778 $ command = 'usermod -a -G ' .$ apps_vhost_group .' ' .$ conf ['nginx ' ]['user ' ];
2777- caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
2779+ caselog ($ command .' &> /dev/null 2>&1 ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
27782780
27792781 if (!@is_dir ($ install_dir )){
27802782 mkdir ($ install_dir , 0755 , true );
@@ -3654,20 +3656,32 @@ public function install_ispconfig() {
36543656 // and must be fixed as this will allow the apache user to read the ispconfig files.
36553657 // Later this must run as own apache server or via suexec!
36563658 if ($ conf ['apache ' ]['installed ' ] == true ){
3657- $ command = 'adduser ' .$ conf ['apache ' ]['user ' ].' ispconfig ' ;
3658- caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
3659- if (is_group ('ispapps ' )){
3660- $ command = 'adduser ' .$ conf ['apache ' ]['user ' ].' ispapps ' ;
3659+ $ ispc_groupinfo = posix_getgrnam ('ispconfig ' );
3660+ if (!in_array ($ conf ['apache ' ]['user ' ],$ ispc_groupinfo ['members ' ])) {
3661+ $ command = 'adduser ' .$ conf ['apache ' ]['user ' ].' ispconfig ' ;
36613662 caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
36623663 }
3664+ if (is_group ('ispapps ' )){
3665+ $ ispapps_groupinfo = posix_getgrnam ('ispapps ' );
3666+ if (!in_array ($ conf ['apache ' ]['user ' ],$ ispapps_groupinfo ['members ' ])) {
3667+ $ command = 'adduser ' .$ conf ['apache ' ]['user ' ].' ispapps ' ;
3668+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
3669+ }
3670+ }
36633671 }
36643672 if ($ conf ['nginx ' ]['installed ' ] == true ){
3665- $ command = 'adduser ' .$ conf ['nginx ' ]['user ' ].' ispconfig ' ;
3666- caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
3667- if (is_group ('ispapps ' )){
3668- $ command = 'adduser ' .$ conf ['nginx ' ]['user ' ].' ispapps ' ;
3673+ $ ispc_groupinfo = posix_getgrnam ('ispconfig ' );
3674+ if (!in_array ($ conf ['nginx ' ]['user ' ],$ ispc_groupinfo ['members ' ])) {
3675+ $ command = 'adduser ' .$ conf ['nginx ' ]['user ' ].' ispconfig ' ;
36693676 caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
36703677 }
3678+ if (is_group ('ispapps ' )){
3679+ $ ispapps_groupinfo = posix_getgrnam ('ispapps ' );
3680+ if (!in_array ($ conf ['nginx ' ]['user ' ],$ ispapps_groupinfo ['members ' ])) {
3681+ $ command = 'adduser ' .$ conf ['nginx ' ]['user ' ].' ispapps ' ;
3682+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
3683+ }
3684+ }
36713685 }
36723686
36733687 //* Make the shell scripts executable
0 commit comments