Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 886653

Summary: Tomcat6 files should be owned by user / group tomcat
Product: Red Hat Enterprise Linux 6 Reporter: michael.jang
Component: tomcat6Assignee: Coty Sutherland <csutherl>
Status: CLOSED ERRATA QA Contact: Bogdan Sikora <bsikora>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.2CC: fgoldefu, mark.craig, michael, pslavice, rwilliam
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 00:06:14 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: 1275725    
Attachments:
Description Flags
Standard Tomcat6 Log File
none
proposed patch
none
proposed patch v2 none

Description michael.jang 2012-12-12 19:18:10 UTC
Created attachment 662576 [details]
Standard Tomcat6 Log File

Description of problem:

The Tomcat 6 RPM package, as built by Red Hat is not usable as a container, due to an ownership issue in the /usr/share/tomcat6 and the linked /var/lib/tomcat6/webapps directory. 

When a properly configured example.war archive is copied to the noted /var/lib/tomcat6/webapps directory while Tomcat is running, appropriate files are unpacked to the /var/lib/tomcat6/webapps/example directory, owned by user and group tomcat. This seems confirmed by the following message in catalina.out log file in the /var/lib/tomcat6 directory:

Dec 11, 2012 3:36:30 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive openam.war

However, the default ownership of the /usr/share/tomcat6, and the linked /var/lib/tomcat6/webapps directory is root.root. 

The result is that write access is not available to the application embedded in the .war archive. 

I believe this is a Red Hat issue, as this is not an issue for Apache Tomcat 6 as downloaded from tomcat.apache.org. A minimal “work around” grants group ownership of the following directories to the group tomcat:

/usr/share/tomcat6
/usr/share/tomcat6/webapps (which is linked to /var/lib/tomcat6/webapps)

(A more straightfoward “chown -R tomcat.tomcat /usr/share/tomcat6” also works for our purposes.)

As Tomcat6 is run by the user tomcat, I believe it makes sense that associated directories should also be accessible to at least the group tomcat. 

I therefore request that Red Hat repackage the Tomcat6 RPM to configure ownership on appropriate directories to user tomcat. I note that the Tomcat6 service is run by user tomcat, and suggest that the owner of the directory and user configured to run the service should match. 

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

tomcat6-6.0.24-45.el6.noarch

How reproducible:


Steps to Reproduce:
1. Download and unpack the stable or nightly release of OpenAM from forgerock.org/openam.html
2. Copy an appropriate WAR file to the /usr/share/tomcat6/webapps directory, as openam.war
3. Make sure Tomcat is running, and confirm that it processes the openam.war file into a /usr/share/tomcat6/webapps/openam directory.
4. Attempt to configure OpenAM.
  
Actual results:

The OpenAM configuration is unable to complete, as it can't write to directories owned by root. 

Expected results:

Configuration options should be writable to files and directories in /usr/share/tomcat6 and /usr/share/tomcat6/webapps. 

Additional info:

In the interest of full disclosure, I now work for ForgeRock, and have also filed other bugs under a different account (to which I no longer seem to have access). What I’m reporting is based on my work with the ForgeRock OpenAM access management platform, using the Apache Tomcat 6 container as packaged for RHEL 6 / CentOS 6. 

This issue appears to be tangentially related to the following existing bugs: 831464, 834169

In addition, in this bug report, I speak only for myself.

Comment 2 RHEL Program Management 2012-12-17 06:50:05 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 3 michael.jang 2014-10-20 19:25:57 UTC
FYI, I see that for RHEL 7, Tomcat files are now owned by group tomcat. I suspect the same solution should work for RHEL 6.x.

Comment 5 Coty Sutherland 2015-12-16 20:24:25 UTC
I walked through the steps to see exactly what was wrong here. This one is a bit odd. Deploying the nightly build and attempting to access it redirects me to http://rhel6:8080/OpenAM-13.0.0-SNAPSHOT/nowritewarning.jsp with the warning that it doesn't have write access to /usr/share/tomcat (as stated in the description).

It looks like the webapps dir permission is OK:

+++
# ll /var/lib/tomcat6/webapps/
total 122584
drwxr-xr-x. 10 root   tomcat      4096 Dec 16 14:46 docs
drwxrwxr-x.  5 root   tomcat      4096 Dec 16 14:46 examples
drwxrwxr-x.  5 root   tomcat      4096 Dec 16 14:46 host-manager
drwxrwxr-x.  5 root   tomcat      4096 Dec 16 14:46 manager
drwxr-xr-x. 23 tomcat tomcat      4096 Dec 16 15:14 OpenAM-13.0.0-SNAPSHOT
-rw-r--r--.  1 root   root   125490314 Dec 16 15:13 OpenAM-13.0.0-SNAPSHOT.war
drwxrwxr-x.  3 root   tomcat      4096 Dec 16 14:46 ROOT
drwxrwxr-x.  5 root   tomcat      4096 Dec 16 14:46 sample
+++

but it can't access it through the symlink:

+++
# ll /usr/share/tomcat6/
total 4
drwxr-xr-x. 2 root root   4096 Dec 16 14:46 bin
lrwxrwxrwx. 1 root tomcat   12 Dec 16 14:46 conf -> /etc/tomcat6
lrwxrwxrwx. 1 root root     23 Dec 16 14:46 lib -> /usr/share/java/tomcat6
lrwxrwxrwx. 1 root root     16 Dec 16 14:46 logs -> /var/log/tomcat6
lrwxrwxrwx. 1 root root     23 Dec 16 14:46 temp -> /var/cache/tomcat6/temp
lrwxrwxrwx. 1 root root     24 Dec 16 14:46 webapps -> /var/lib/tomcat6/webapps
lrwxrwxrwx. 1 root root     23 Dec 16 14:46 work -> /var/cache/tomcat6/work
+++

Chowning the /usr/share/tomcat6 directory to :tomcat works fine and matches what RHEL7 tomcat does.

Comment 6 Coty Sutherland 2015-12-16 20:25:22 UTC
By the way, I'm testing with build 90:

+++
# rpm -qa tomcat6*
tomcat6-lib-6.0.24-90.el6.x86_64
tomcat6-admin-webapps-6.0.24-90.el6.x86_64
tomcat6-servlet-2.5-api-6.0.24-90.el6.x86_64
tomcat6-el-2.1-api-6.0.24-90.el6.x86_64
tomcat6-6.0.24-90.el6.x86_64
tomcat6-docs-webapp-6.0.24-90.el6.x86_64
tomcat6-javadoc-6.0.24-90.el6.x86_64
tomcat6-jsp-2.1-api-6.0.24-90.el6.x86_64
tomcat6-webapps-6.0.24-90.el6.x86_64
+++

Comment 7 Coty Sutherland 2015-12-17 14:33:18 UTC
Created attachment 1106735 [details]
proposed patch

Comment 8 Coty Sutherland 2015-12-17 15:12:30 UTC
Created attachment 1106757 [details]
proposed patch v2

Comment 9 Coty Sutherland 2015-12-17 15:13:41 UTC
The latest proposed patch (v2) corrects the permissions on /usr/share/tomcat6 and the ownership of a couple of sub-dirs. I did test with OpenAM also and it no longer redirects to the write permission jsp.

Comment 10 michael.jang 2015-12-17 18:41:54 UTC
Coty, thank you for your attention to this. It sounds like you've replicated my steps, seen what I see, and have set up a patch. 

While I haven't tested your patch, the changes look like what I'm asking for. Thank you.

Comment 15 errata-xmlrpc 2016-05-11 00:06:14 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://rhn.redhat.com/errata/RHBA-2016-0870.html