Bug 1442872

Summary: apache user is not created during httpd installation when apache group already exist with GID other than 48
Product: Red Hat Enterprise Linux 7 Reporter: James Hartsock <hartsjc>
Component: httpdAssignee: Luboš Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: Jan Houska <jhouska>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: jhouska, jorton, luhliari
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: httpd-2.4.6-64.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1487164 1669074 (view as bug list) Environment:
Last Closed: 2017-08-01 21:36:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1298243, 1669074    

Description James Hartsock 2017-04-17 20:06:09 UTC
Description of problem:

When installing httpd via yum and apache group already exists on the system with GID other than 48 (for example when it is defined in IDM), installation is not able to create apache user because '-g 48' is used on RHEL 7.

This worked in RHEL 6 because '-g apache' was utilized.  Now that BZ 1299889 has split the group & user creation into individual commands, believe useradd should be modified to use '-g apache' in RHEL 7 (as it is already in RHEL 6).


Version-Release number of selected component (if applicable):
httpd-2.4.6-45.el7

How reproducible:
Very

Steps to Reproduce:
1. Make apache group resolvable, but do NOT use GID=48.  Generally this would be resolved from IDM, but here just using local user to replicate issue.
   # groupadd -g 4800 apache

2. Install httpd
   # yum install httpd


Actual results
NOTE: useradd -g 48 (like RHEL 7 httpd preinstall)
# getent passwd apache
# getent group apache
apache:x:4800:

# /usr/sbin/useradd -c "Apache" -u 48 -g 48 -s /sbin/nologin -r -d /usr/share/httpd apache
useradd: group '48' does not exist




Expected results:
NOTE: useradd -g apache (like RHEL 6 httpd preinstall)

# getent passwd apache
# getent group apache
apache:x:4800:

# getent passwd apache >/dev/null || useradd -r -u 48 -g apache -s /sbin/nologin -d /var/www -c "Apache" apache

# echo $?
0



Additional info:

Comment 6 Jan Houska 2017-04-28 15:31:32 UTC
Verified


New PASS:
httpd-2.4.6-64.el7.x86_64

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Changes of apache user.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'yum install -y httpd &> install_Output.log '
:: [   PASS   ] :: Command 'yum install -y httpd &> install_Output.log ' (Expected 0, got 0)
httpd-2.4.6-64.el7.x86_64
:: [   PASS   ] :: Checking for the presence of httpd rpm 
:: [ 11:27:13 ] :: Package versions:
:: [ 11:27:13 ] ::   httpd-2.4.6-64.el7.x86_64
============output of install_Output.log===========
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-64.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch             Version                  Repository      Size
================================================================================
Installing:
 httpd           x86_64           2.4.6-64.el7             rhel           1.2 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 1.2 M
Installed size: 3.7 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
httpd-CoreOS-httpd-Library-http-1.0-43.noarch has missing requires of httpd
1:mod_ssl-2.4.6-64.el7.x86_64 has missing requires of httpd = ('0', '2.4.6', '64.el7')
1:mod_ssl-2.4.6-64.el7.x86_64 has missing requires of httpd-mmn = ('0', '20120211x8664', None)
  Installing : httpd-2.4.6-64.el7.x86_64                                    1/1 
  Verifying  : httpd-2.4.6-64.el7.x86_64                                    1/1 

Installed:
  httpd.x86_64 0:2.4.6-64.el7                                                   

Complete!
===========/output of install_Output.log===========
./runtest.sh: line 87: rlIsRhel: command not found
:: [  BEGIN   ] :: Running 'getent group apache > output_group.log'
:: [   PASS   ] :: Command 'getent group apache > output_group.log' (Expected 0, got 0)
============output of output_group.log===========
apache:x:6800:
===========/output of output_group.log===========
:: [   PASS   ] :: File 'output_group.log' should contain 'apache:x:6800' 
:: [   PASS   ] :: Group apache exists. 
:: [  BEGIN   ] :: Running 'getent passwd apache > output_passwd.log'
:: [   PASS   ] :: Command 'getent passwd apache > output_passwd.log' (Expected 0, got 0)
============output of output_passwd.log===========
apache:x:48:6800:Apache:/usr/share/httpd:/sbin/nologin
===========/output of output_passwd.log===========
:: [   PASS   ] :: File 'output_passwd.log' should contain 'apache:x:48:6800' 
:: [   PASS   ] :: There is password for apache group. 

::::::::


Old FAIL:
httpd-2.4.6-45.el7.x86_64


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Changes of apache user.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'yum install -y httpd &> install_Output.log '
:: [   PASS   ] :: Command 'yum install -y httpd &> install_Output.log ' (Expected 0, got 0)
httpd-2.4.6-45.el7.x86_64
:: [   PASS   ] :: Checking for the presence of httpd rpm 
:: [ 11:29:13 ] :: Package versions:
:: [ 11:29:13 ] ::   httpd-2.4.6-45.el7.x86_64
============output of install_Output.log===========
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch             Version                  Repository      Size
================================================================================
Installing:
 httpd           x86_64           2.4.6-45.el7             rhel           1.2 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 1.2 M
Installed size: 3.7 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
httpd-CoreOS-httpd-Library-http-1.0-43.noarch has missing requires of httpd
1:mod_ssl-2.4.6-45.el7.x86_64 has missing requires of httpd = ('0', '2.4.6', '45.el7')
1:mod_ssl-2.4.6-45.el7.x86_64 has missing requires of httpd-mmn = ('0', '20120211x8664', None)
  Installing : httpd-2.4.6-45.el7.x86_64                                    1/1 
warning: user apache does not exist - using root
warning: user apache does not exist - using root
warning: user apache does not exist - using root
warning: user apache does not exist - using root
  Verifying  : httpd-2.4.6-45.el7.x86_64                                    1/1 

Installed:
  httpd.x86_64 0:2.4.6-45.el7                                                   

Complete!
===========/output of install_Output.log===========
./runtest.sh: line 87: rlIsRhel: command not found
:: [  BEGIN   ] :: Running 'getent group apache > output_group.log'
:: [   PASS   ] :: Command 'getent group apache > output_group.log' (Expected 0, got 0)
============output of output_group.log===========
apache:x:6800:
===========/output of output_group.log===========
:: [   PASS   ] :: File 'output_group.log' should contain 'apache:x:6800' 
:: [   PASS   ] :: Group apache exists. 
:: [  BEGIN   ] :: Running 'getent passwd apache > output_passwd.log'
:: [   FAIL   ] :: Command 'getent passwd apache > output_passwd.log' (Expected 0, got 2)
============output of output_passwd.log===========
===========/output of output_passwd.log===========
:: [   FAIL   ] :: File 'output_passwd.log' should contain 'apache:x:48:6800' 
:: [   FAIL   ] :: There is NO password for apache group! 

::::::::

Comment 7 errata-xmlrpc 2017-08-01 21:36:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2175