1 |
vip-ire |
1.1 |
diff -Nur e-smith-base-5.2.0/root/etc/e-smith/events/actions/init-accounts e-smith-base-5.2.0_mod/root/etc/e-smith/events/actions/init-accounts |
2 |
|
|
--- e-smith-base-5.2.0/root/etc/e-smith/events/actions/init-accounts 2010-12-06 16:55:42.000000000 +0100 |
3 |
|
|
+++ e-smith-base-5.2.0_mod/root/etc/e-smith/events/actions/init-accounts 2010-12-06 22:40:10.000000000 +0100 |
4 |
|
|
@@ -188,6 +188,30 @@ |
5 |
|
|
} |
6 |
|
|
} |
7 |
|
|
|
8 |
|
|
+# Now that www exists, change uid/gid of user and group apache |
9 |
|
|
+# so they become alias of the www account |
10 |
|
|
+if ( !getpwnam("apache") ) |
11 |
|
|
+{ |
12 |
|
|
+ die "Error creating apache user or group" unless ( |
13 |
|
|
+ system("/usr/sbin/groupadd -g 102 -o apache") == 0 && |
14 |
|
|
+ system("/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache") == 0 |
15 |
|
|
+ ); |
16 |
|
|
+} |
17 |
|
|
+else |
18 |
|
|
+{ |
19 |
|
|
+ my $id = `/usr/bin/id -u apache`; |
20 |
|
|
+ chomp($id); |
21 |
|
|
+ if ( $id ne '102') |
22 |
|
|
+ { |
23 |
|
|
+ die "Error changing apache uid or gid" unless ( |
24 |
|
|
+ system("/usr/sbin/groupmod -g 102 -o apache") == 0 && |
25 |
|
|
+ system("/usr/sbin/usermod -u 102 -g 102 -o apache") == 0 |
26 |
|
|
+ ); |
27 |
|
|
+ warn "failed to fix permissions for apache" unless ( |
28 |
|
|
+ system("/bin/rpm --setugids httpd mod_auth_tkt mod_ssl php 2> /dev/null") == 0 |
29 |
|
|
+ ); |
30 |
|
|
+ } |
31 |
|
|
+} |
32 |
|
|
|
33 |
|
|
# delete unwanted user accounts |
34 |
|
|
foreach my $user (qw(halt shutdown sync)) |