--- rpms/e-smith-base/sme9/e-smith-base-5.6.0-ensure_apache_alias_www.patch 2014/11/02 21:53:22 1.1 +++ rpms/e-smith-base/sme9/e-smith-base-5.6.0-ensure_apache_alias_www.patch 2015/01/03 19:53:54 1.2 @@ -1,34 +1,38 @@ -diff -Nur e-smith-base-5.6.0/root/etc/e-smith/events/actions/init-accounts e-smith-base-5.6.0_bz8549/root/etc/e-smith/events/actions/init-accounts +diff -Nur e-smith-base-5.6.0/root/etc/e-smith/events/actions/init-accounts e-smith-base-5.6.0.bz8549/root/etc/e-smith/events/actions/init-accounts --- e-smith-base-5.6.0/root/etc/e-smith/events/actions/init-accounts 2014-03-24 03:47:24.000000000 +0100 -+++ e-smith-base-5.6.0_bz8549/root/etc/e-smith/events/actions/init-accounts 2014-11-02 22:49:34.550000000 +0100 -@@ -30,7 +30,29 @@ ++++ e-smith-base-5.6.0.bz8549/root/etc/e-smith/events/actions/init-accounts 2015-01-03 20:30:14.270708139 +0100 +@@ -30,7 +30,33 @@ my $conf = esmith::ConfigDB->open_ro or die "Could not open Config DB"; -my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; ++#create the group apache if doesn't exist +system(qw(/usr/sbin/groupadd -g 102 -r -o -f apache)) -+ unless getgrnam("apache"); -+ -+# Make sure apache exist and has the same uid/gid as www ++ unless getgrnam("apache"); ++ ++# create the user apache if doesn't exist and has not the same uid/gid as www +if ( !getpwnam("apache") ) +{ + die "Error creating apache user or group" unless ( -+ system(qw(/usr/sbin/groupadd -g 102 -o apache)) == 0 && -+ system(qw(/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache)) == 0 -+ ); ++ system(qw(/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache)) == 0); ++} ++ ++#set apache gid if different of 102 ++my $apachegidtest = getgrnam("apache"); ++if ( $apachegidtest != '102' ) ++{ ++ die "Error changing apache gid" unless ( ++ system(qw(/usr/sbin/groupmod -g 102 -o apache)) == 0); +} -+else ++ ++#set apache uid if different of 102 ++my $apacheuidtest = getpwnam("apache"); ++if ( $apacheuidtest != '102' ) +{ -+ my $id = `/usr/bin/id -u apache`; -+ chomp($id); -+ if ( $id ne '102') -+ { -+ die "Error changing apache uid or gid" unless ( -+ system(qw(/usr/sbin/groupmod -g 102 -o apache)) == 0 && -+ system(qw(/usr/sbin/usermod -u 102 -g 102 -o apache)) == 0 -+ ); -+ } ++ die "Error changing apache uid " unless ( ++ system(qw(/usr/sbin/usermod -u 102 -g 102 -o apache )) == 0); +} ++ # fix permissions for www and apache warn "failed to fix permissions for www" unless (