Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 915447

Summary: Problem to start tomcat with a user whose group has a name different to the user
Product: Red Hat Enterprise Linux 6 Reporter: Etienne Carrière <etienne.carriere>
Component: tomcat6Assignee: David Knox <dknox>
Status: CLOSED ERRATA QA Contact: tomcat-qe
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1CC: aneelica, djorm, hajek, jclere, lnovich, luvilla, mhasko, rbiba, rhatlapa, tfonteyn, thoger
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tomcat6-6.0.24-60.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1505762 (view as bug list) Environment:
Last Closed: 2013-11-21 23:50:47 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: 1505762, 1510896    
Attachments:
Description Flags
Patch none

Description Etienne Carrière 2013-02-25 18:46:50 UTC
Description of problem:

The /etc/init.d/tomcat script is not constructed to handle a user with a name that does not correspond to an existing group


Version-Release number of selected component (if applicable):


How reproducible: Always


Steps to Reproduce:
1. Create a user (such as "test") on a system where the group "test" does not exist. For example, create with test:test1 configuration
2. Change the /etc/sysconfig/tomcat with TOMCAT_USER=test
3. Start /etc/init.d/tomcat6
  
Actual results:
The chown of the CATALINA_PID file failed
The tomcat can't write to the CATALINA_PID file 
It is impossible to stop tomcat with /etc/init.d/tomcat stop

Expected results:
The chown is done correctly and the start/stop of tomcat is operationnal

Additional info:

Comment 1 Etienne Carrière 2013-02-25 18:58:21 UTC
I propose to : 
- Add a variable TOMCAT_GROUP to 
   /etc/tomcat6/tomcat6
   /etc/sysconfig/tomcat6
- Modify /etc/init.d/tomcat6 with the following patch (attached)

With this modification, we are retro-compatible with the previous behaviour

Comment 2 Etienne Carrière 2013-02-25 18:59:35 UTC
Created attachment 702485 [details]
Patch

Comment 5 RHEL Program Management 2013-03-04 06:48:10 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 David Knox 2013-03-04 21:37:38 UTC
The fix has been applied and is ready to commit. Looks like we only need 6.5+.

Comment 8 Michal Haško 2013-04-15 13:18:39 UTC
Simpler reproducer I've found:

# groupmod -n test tomcat
# service tomcat6 start
...

Comment 30 Michal Haško 2013-09-05 14:13:00 UTC
FAILED QA on tomcat6-6.0.24-59.el6

(1) A similar patch from the ont in comment 2 is applied, however, there is no
    TOMCAT_GROUP variable in /etc/sysconfig/tomcat6 or /etc/tomcat6/tomcat6.conf.

    User still can add the variable himself if wishes to change the name of
    tomcat user's primary group. However, I consider fix for this bug to be
    incomplete.

(2) Why are we defining a variable for something that can be computed? Doesn't it
    bring more possibilities of error? I propose to replace:

        # Define the tomcat group
        TOMCAT_GROUP="${TOMCAT_GROUP:-tomcat}"

    in initscript with something like:

        TOMCAT_GROUP="$(id -gn $TOMCAT_USER)"

    This way there is no need to configure the variable in /etc/sysconfig/tomcat6
    or /etc/tomcat6/tomcat6.conf

Comment 31 David Knox 2013-09-05 17:31:58 UTC
TOMCAT_GROUP now appears in sysconfig/tomcat6 and <confdir>/tomcat6.conf to stay with convention with the existing pattern. The appearance in the initscript is a safety net in case TOMCAT_USER and TOMCAT_GROUP is not defined appropriately in the config files.

The definition in sysconfig/tomcat6 is commented as is TOMCAT_USER. Customers running individual tomcat instances using a different user name and/or group should define TOMCAT_USER and TOMCAT_GROUP in sysconfig/tomcat6. The default is `id -gn $TOMCAT_USER`

TOMCAT_GROUP is defined in <confdir>/tomcat6.conf following convention. Customers running multiple instances using the same TOMCAT_USER and/or TOMCAT_GROUP should find the definitions in tomcat6.conf sufficient.

Comment 34 errata-xmlrpc 2013-11-21 23:50:47 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.

http://rhn.redhat.com/errata/RHBA-2013-1721.html