1 |
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 |
2 |
--- e-smith-base-5.6.0/root/etc/e-smith/events/actions/init-accounts 2014-03-24 03:47:24.000000000 +0100 |
3 |
+++ e-smith-base-5.6.0.bz8549/root/etc/e-smith/events/actions/init-accounts 2015-01-03 20:30:14.270708139 +0100 |
4 |
@@ -30,7 +30,33 @@ |
5 |
my $conf = esmith::ConfigDB->open_ro |
6 |
or die "Could not open Config DB"; |
7 |
|
8 |
-my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; |
9 |
+#create the group apache if doesn't exist |
10 |
+system(qw(/usr/sbin/groupadd -g 102 -r -o -f apache)) |
11 |
+ unless getgrnam("apache"); |
12 |
+ |
13 |
+# create the user apache if doesn't exist and has not the same uid/gid as www |
14 |
+if ( !getpwnam("apache") ) |
15 |
+{ |
16 |
+ die "Error creating apache user or group" unless ( |
17 |
+ system(qw(/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache)) == 0); |
18 |
+} |
19 |
+ |
20 |
+#set apache gid if different of 102 |
21 |
+my $apachegidtest = getgrnam("apache"); |
22 |
+if ( $apachegidtest != '102' ) |
23 |
+{ |
24 |
+ die "Error changing apache gid" unless ( |
25 |
+ system(qw(/usr/sbin/groupmod -g 102 -o apache)) == 0); |
26 |
+} |
27 |
+ |
28 |
+#set apache uid if different of 102 |
29 |
+my $apacheuidtest = getpwnam("apache"); |
30 |
+if ( $apacheuidtest != '102' ) |
31 |
+{ |
32 |
+ die "Error changing apache uid " unless ( |
33 |
+ system(qw(/usr/sbin/usermod -u 102 -g 102 -o apache )) == 0); |
34 |
+} |
35 |
+ |
36 |
|
37 |
# fix permissions for www and apache |
38 |
warn "failed to fix permissions for www" unless ( |