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 2014-11-02 22:49:34.550000000 +0100 |
4 |
@@ -30,7 +30,29 @@ |
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 |
+system(qw(/usr/sbin/groupadd -g 102 -r -o -f apache)) |
10 |
+ unless getgrnam("apache"); |
11 |
+ |
12 |
+# Make sure apache exist and has the same uid/gid as www |
13 |
+if ( !getpwnam("apache") ) |
14 |
+{ |
15 |
+ die "Error creating apache user or group" unless ( |
16 |
+ system(qw(/usr/sbin/groupadd -g 102 -o apache)) == 0 && |
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 |
+else |
21 |
+{ |
22 |
+ my $id = `/usr/bin/id -u apache`; |
23 |
+ chomp($id); |
24 |
+ if ( $id ne '102') |
25 |
+ { |
26 |
+ die "Error changing apache uid or gid" unless ( |
27 |
+ system(qw(/usr/sbin/groupmod -g 102 -o apache)) == 0 && |
28 |
+ system(qw(/usr/sbin/usermod -u 102 -g 102 -o apache)) == 0 |
29 |
+ ); |
30 |
+ } |
31 |
+} |
32 |
|
33 |
# fix permissions for www and apache |
34 |
warn "failed to fix permissions for www" unless ( |