Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 7005 - Tomcat Ebuild: provide Initscript and do not run as root by default
Summary: Tomcat Ebuild: provide Initscript and do not run as root by default
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High enhancement (vote)
Assignee: Dylan Carlson (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 17907
Blocks: 18352
  Show dependency tree
 
Reported: 2002-08-25 06:41 UTC by Daniel Seyffer
Modified: 2003-03-30 16:04 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Sample Init script (from the src-rpm) - still RedHat style... (tomcat4-4.1.12.init,3.22 KB, text/plain)
2002-10-20 05:20 UTC, Daniel Seyffer
Details
The init script I use (tomcat,438 bytes, text/plain)
2003-03-20 21:27 UTC, Tony Murray
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Seyffer 2002-08-25 06:41:27 UTC
Hi,

The tomcat server, as provided in current ebuilds, starts using a shellscript. 
Leaving you with tomcat and all JVM childprocesses running as user root - a 
potential security risk in many ways and absolutely not suited for productive 
use! (besides others also think of the fact that files deployed in a webapps 
directory are automatically chown'ed to the user tomcat is running as...)

So instead it should definitely run as an unprivileged user ("tomcat" 
or "tomcat4") by default. This is also the way all other distros I know of, do 
it. In detail it should use an initscript similar to the one provided by the 
official Tomcat RPMS from the jakarta homepage, su'ing to an unprivileged user 
before starting tomcat.

To do this one would, more or less, simply have to "port" existing official 
initscript which can be easily extracted from the source RPMs to gentoo-style 
initscripts: http://jakarta.apache.org/builds/jakarta-tomcat-
4.0/release/v4.0.4/rpms/tomcat4-4.0.4-le.2jpp.src.rpm (probably an older 
version, but I didn't manage to find the script in the Tomcat CVS...).  

Unfortuantely only RPMs and SRPMs and not source or binary tar archives from 
the jakarta homepage seem to contain the initscripts - that's probably the 
reason why the ebuild doesn't either... ;( 

FYI: I've also already posted to the forums regarding this issue almost two 
months ago:
http://forums.gentoo.org/viewtopic.php?t=9029&highlight=tomcat 

And well, when I'm already about to write a feature request: While I finally 
managed to finally get it working by compiling from CVS, a package for the 
mod_webapp module (Tomcat integration into Apache, 
http://jakarta.apache.org/builds/jakarta-tomcat-connectors/webapp/) would 
really rock... ;)

Thanx a lot. 
Gentoo is great! :)
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-08-27 15:07:16 UTC
I don't have time to follow the forums closely. The current tomcat is provided
sort of as a stop-gap measure until we get the time to start compiling it from
sources and properly configuring it to work with the other jakarta projects, and
jboss and all the other goodies.

This bug will not be fixed before 1.4 is released, as it requires a new user,
and our user table is undergoing a revision.
Comment 2 Daniel Seyffer 2002-10-20 05:19:09 UTC
Hello,  FYI find attached a tomcat startup-script, extracted from a current tomcat-src-rpm (version 4.1.12 should IMHO also work for all 4.x releases).  If you are all maxed out with other things to do, maybe I will have a bit of free time during my holiday at the end of the month and I'll give it at try rewriting this to gentoo-syntax (should not be tooo difficult I suppose).   Or is this one really still on the ToDo List for 1.4? There's already a feature freeze for some days, isn't it? At least all ebuilds and updates I have submitted during the last 1-2 weeks or so are scheduled to be added "later"... ;)  Regards, Daniel Seyffer   
Comment 3 Daniel Seyffer 2002-10-20 05:20:29 UTC
Created attachment 4835 [details]
Sample Init script (from the src-rpm) - still RedHat style...

A templated which might usefull when creating a gentoo init-script...
Comment 4 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-11-02 16:24:58 UTC
You said you were working on a "from source" built of tomcat. Can you address
this issue as well, then ? You may assume there's a user called tomcat, and a
group called tomcat, if you need it. 
Comment 5 Tony Murray 2003-03-20 21:27:37 UTC
Created attachment 9646 [details]
The init script I use

This is the init script I use, it works well...
Comment 6 Dylan Carlson (RETIRED) gentoo-dev 2003-03-28 02:53:48 UTC
This issue has been resolved in tomcat-4.1.24.ebuild.  No longer runs as root, instead 
as uid/gid 'tomcat' (265/265).  The build-from-source issue will be approached after 
4.1.24 is moved to stable...  there have been enough changes that need to be tested 
for correctness first before it is made to build from source. 
Comment 7 Daniel Seyffer 2003-03-30 16:04:50 UTC
Nice to see that this has been fixed. And it also sounds really nice what is happening 
regarding connectors, startupscripts etc. (#18352). 
Thanks a lot everyone... ;-)