Bug 1341850

Summary: tomcat-jsvc.service has TOMCAT_USER value hard-coded
Product: [Fedora] Fedora Reporter: Coty Sutherland <csutherl>
Component: tomcatAssignee: Coty Sutherland <csutherl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: alee, coolsvap, csutherl, enrico.tagliavini, ivan.afonichev, java-sig-commits, krzysztof.daniel, rsawhill
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tomcat-8.0.36-2.fc25 tomcat-8.0.36-2.fc24 tomcat-8.0.36-2.fc23 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-01 13:38:15 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:

Description Coty Sutherland 2016-06-01 21:25:45 UTC
Description of problem:
The TOMCAT_USER value should be configurable instead of always "tomcat". Looking at the way that the service unit executes the tomcat script, I see that the functions script is sourced in the preamble BEFORE the configuration is loaded, so even if we check the TOMCAT_USER variable and try and use it, it would always be empty. Could we move the configuration sourcing before we source functions to make it configurable?

Version-Release number of selected component (if applicable):
tomcat-8.0.32-5.fc23.noarch

How reproducible:
Always

Steps to Reproduce:
1. Set TOMCAT_USER="notTomcat" in tomcat.conf
2. Start service with jsvc: systemctl start tomcat-jsvc
3. Observe that the process owner is "tomcat" instead of "notTomcat"

Actual results:
Process owner is "tomcat"

Expected results:
Process owner is "notTomcat"

Additional info:
This issue was raised against RHEL in the bug here https://bugzilla.redhat.com/show_bug.cgi?id=1201409. I'll link it as well.

Comment 1 Coty Sutherland 2016-07-01 17:49:15 UTC
https://github.com/csutherl/fedora-tomcat/commit/da76ecf

This patch works when setting TOMCAT_USER in tomcat.conf, but doesn't seem to source the variable correctly when setting it in /etc/sysconfig/tomcat. I think that's something to do with systemd, but at least this provides a mechanism to change the user where there wasn't one before.

Comment 2 Ivan Afonichev 2016-07-01 18:18:11 UTC
There is no 
EnvironmentFile=-/etc/sysconfig/tomcat
line in tomcat-8.0-jsvc.service which is present in tomcat-8.0.service thats it.

Comment 3 Coty Sutherland 2016-07-01 18:52:05 UTC
Ah, I don't know why I didn't check that...do you think we should add it? If so, I can amend that last commit.

Comment 4 Ryan Sawhill 2016-07-08 16:47:09 UTC
(In reply to Coty Sutherland from comment #3)
> Ah, I don't know why I didn't check that...do you think we should add it? If
> so, I can amend that last commit.

Yup that's absolutely necessary!

Comment 5 Coty Sutherland 2016-07-08 16:59:03 UTC
Apparently I'd already done this, but forgot to push :)

https://github.com/csutherl/fedora-tomcat/commit/4eeb249

Comment 7 Fedora Update System 2016-08-11 18:50:02 UTC
tomcat-8.0.36-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-0a4dccdd23

Comment 8 Fedora Update System 2016-08-11 18:50:45 UTC
tomcat-8.0.36-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-2b0c16fd82

Comment 9 Fedora Update System 2016-08-11 18:51:26 UTC
tomcat-8.0.36-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f4a443888b

Comment 10 Fedora Update System 2016-08-12 14:28:16 UTC
tomcat-8.0.36-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f4a443888b

Comment 11 Fedora Update System 2016-08-12 20:53:02 UTC
tomcat-8.0.36-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-0a4dccdd23

Comment 12 Fedora Update System 2016-08-12 20:53:05 UTC
tomcat-8.0.36-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-2b0c16fd82

Comment 13 Fedora Update System 2016-09-01 13:37:08 UTC
tomcat-8.0.36-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2016-09-01 16:55:44 UTC
tomcat-8.0.36-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2016-09-01 18:53:12 UTC
tomcat-8.0.36-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.