Bug 915447 - Problem to start tomcat with a user whose group has a name different to the user
Summary: Problem to start tomcat with a user whose group has a name different to the user
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tomcat6
Version: 6.1
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: David Knox
QA Contact: tomcat-qe
URL:
Whiteboard:
Depends On:
Blocks: 835616 1505762 1510896
TreeView+ depends on / blocked
 
Reported: 2013-02-25 18:46 UTC by Etienne Carrière
Modified: 2018-12-04 15:03 UTC (History)
11 users (show)

Fixed In Version: tomcat6-6.0.24-60.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1505762 (view as bug list)
Environment:
Last Closed: 2013-11-21 23:50:47 UTC
Target Upstream Version:


Attachments (Terms of Use)
Patch (1.76 KB, patch)
2013-02-25 18:59 UTC, Etienne Carrière
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1721 normal SHIPPED_LIVE tomcat6 bug fix update 2013-11-20 21:51:34 UTC
Red Hat Knowledge Base (Solution) 362934 None None None Never

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 Product and 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


Note You need to log in before you can comment on or make changes to this bug.