/[smeserver]/rpms/e-smith-base/sme9/e-smith-base-5.6.0-ensure_apache_alias_www.patch
ViewVC logotype

Diff of /rpms/e-smith-base/sme9/e-smith-base-5.6.0-ensure_apache_alias_www.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.1 by vip-ire, Sun Nov 2 21:53:22 2014 UTC Revision 1.2 by stephdl, Sat Jan 3 19:53:54 2015 UTC
# Line 1  Line 1 
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  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  --- 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  +++ 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,29 @@  @@ -30,7 +30,33 @@
5   my $conf = esmith::ConfigDB->open_ro   my $conf = esmith::ConfigDB->open_ro
6       or die "Could not open Config DB";       or die "Could not open Config DB";
7    
8  -my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';  -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))  +system(qw(/usr/sbin/groupadd -g 102 -r -o -f apache))
11  +  unless getgrnam("apache");  +    unless getgrnam("apache");
12  +  +  
13  +# Make sure apache exist and has the same uid/gid as www  +# create the user apache if doesn't exist and has not the same uid/gid as www
14  +if ( !getpwnam("apache") )  +if ( !getpwnam("apache") )
15  +{  +{
16  +    die "Error creating apache user or group" unless (  +    die "Error creating apache user or group" unless (
17  +        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);
18  +        system(qw(/usr/sbin/useradd -u 102 -g 102 -o -c 'Apache' -d /var/www -M -s /bin/nologin apache)) == 0  +}
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  +else  +
28    +#set apache uid if different of 102
29    +my $apacheuidtest = getpwnam("apache");
30    +if ( $apacheuidtest != '102' )
31  +{  +{
32  +    my $id = `/usr/bin/id -u apache`;  +    die "Error changing apache uid " unless (
33  +    chomp($id);  +        system(qw(/usr/sbin/usermod -u 102 -g 102 -o apache )) == 0);
 +    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  
 +        );  
 +    }  
34  +}  +}
35    +
36    
37   # fix permissions for www and apache   # fix permissions for www and apache
38   warn "failed to fix permissions for www" unless (   warn "failed to fix permissions for www" unless (


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed