<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Combatopera</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Combatopera"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Combatopera"/>
		<updated>2026-04-26T12:06:58Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:Securing_tomcat&amp;diff=12831</id>
		<title>Talk:Securing tomcat</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:Securing_tomcat&amp;diff=12831"/>
				<updated>2006-11-15T22:39:30Z</updated>
		
		<summary type="html">&lt;p&gt;Combatopera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What's the best way to acknowledge the contributions of others as I'd like to add some thanks to Kris Easter, Michel Prunet and Stephen More.  This discussion area?  In brackets after the article link from [https://www.owasp.org/index.php/OWASP_Java_Project_Roadmap#Securing_Popular_J2EE_Servers Java Project Roadmap] ? [[User:Dledmonds|Darren]] 08:58, 27 October 2006 (EDT)&lt;br /&gt;
&lt;br /&gt;
==UNIX Permissions==&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Change files in CATALINA_HOME/conf to be readonly (440)&lt;br /&gt;
&lt;br /&gt;
Initially these are 600 (except for tomcat-users.xml which is 644 and Tomcat keeps it that way). Is there a need to make them group-readable?&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Make sure tomcat user has ... write (220 - yes, only write) access to CATALINA_HOME/logs&lt;br /&gt;
&lt;br /&gt;
This doesn't work. I think the best that can be done here is 750 or 700.&lt;br /&gt;
&lt;br /&gt;
[[User:Combatopera|Combatopera]] 15:53, 12 November 2006 (EST)&lt;/div&gt;</summary>
		<author><name>Combatopera</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:Securing_tomcat&amp;diff=12830</id>
		<title>Talk:Securing tomcat</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:Securing_tomcat&amp;diff=12830"/>
				<updated>2006-11-15T22:37:39Z</updated>
		
		<summary type="html">&lt;p&gt;Combatopera: Refined my previous question.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What's the best way to acknowledge the contributions of others as I'd like to add some thanks to Kris Easter, Michel Prunet and Stephen More.  This discussion area?  In brackets after the article link from [https://www.owasp.org/index.php/OWASP_Java_Project_Roadmap#Securing_Popular_J2EE_Servers Java Project Roadmap] ? [[User:Dledmonds|Darren]] 08:58, 27 October 2006 (EDT)&lt;br /&gt;
&lt;br /&gt;
==UNIX Permissions==&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Change files in CATALINA_HOME/conf to be readonly (440)&lt;br /&gt;
&lt;br /&gt;
Initially these are 600 (except for tomcat-users.xml which is 640). Is there a need to make them group-readable?&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Make sure tomcat user has ... write (220 - yes, only write) access to CATALINA_HOME/logs&lt;br /&gt;
&lt;br /&gt;
This doesn't work. I think the best that can be done here is 750 or 700.&lt;br /&gt;
&lt;br /&gt;
[[User:Combatopera|Combatopera]] 15:53, 12 November 2006 (EST)&lt;/div&gt;</summary>
		<author><name>Combatopera</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:Securing_tomcat&amp;diff=12374</id>
		<title>Talk:Securing tomcat</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:Securing_tomcat&amp;diff=12374"/>
				<updated>2006-11-12T20:53:12Z</updated>
		
		<summary type="html">&lt;p&gt;Combatopera: Added questions on UNIX permissions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What's the best way to acknowledge the contributions of others as I'd like to add some thanks to Kris Easter, Michel Prunet and Stephen More.  This discussion area?  In brackets after the article link from [https://www.owasp.org/index.php/OWASP_Java_Project_Roadmap#Securing_Popular_J2EE_Servers Java Project Roadmap] ? [[User:Dledmonds|Darren]] 08:58, 27 October 2006 (EDT)&lt;br /&gt;
&lt;br /&gt;
==UNIX Permissions==&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Change files in CATALINA_HOME/conf to be readonly (440)&lt;br /&gt;
&lt;br /&gt;
Initially these are 600. Is there a need to make them group-readable?&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Make sure tomcat user has ... write (220 - yes, only write) access to CATALINA_HOME/logs&lt;br /&gt;
&lt;br /&gt;
You can't create files in a dir that is 220, I have tried and see [http://www.cpqlinux.com/permissions.html]. Does Tomcat use some form of cunning to create its logs in such a dir? If not I think the best that can be done here is 330. (Or even 300?)&lt;br /&gt;
&lt;br /&gt;
[[User:Combatopera|Combatopera]] 15:53, 12 November 2006 (EST)&lt;/div&gt;</summary>
		<author><name>Combatopera</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Combatopera&amp;diff=12372</id>
		<title>User:Combatopera</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Combatopera&amp;diff=12372"/>
				<updated>2006-11-12T20:44:58Z</updated>
		
		<summary type="html">&lt;p&gt;Combatopera: The username I would prefer.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:''This user would prefer the username '''combatopera'''. The initial letter is capitalized because of technical limitations.&lt;/div&gt;</summary>
		<author><name>Combatopera</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Securing_tomcat&amp;diff=12371</id>
		<title>Securing tomcat</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Securing_tomcat&amp;diff=12371"/>
				<updated>2006-11-12T20:38:18Z</updated>
		
		<summary type="html">&lt;p&gt;Combatopera: /* UNIX */ The dir is called 'logs' not 'log'.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Most weaknesses in [http://tomcat.apache.org/ Apache Tomcat] come from incorrect or inappropiate configuration.  It is nearly always possible to make Tomcat more secure than the default out of the box installation.  What follows documents best practices and recommendations on securing a production Tomcat server, whether it be hosted on a Windows or Unix based operating system.  ''Please note that the section ordering is not a representation of the section importance.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Versions ==&lt;br /&gt;
&lt;br /&gt;
The first step is to make sure you are running the latest stable releases of software;&lt;br /&gt;
* Java Runtime Environment (JRE) or SDK&lt;br /&gt;
* Tomcat&lt;br /&gt;
* Third party libraries&lt;br /&gt;
This does not mean you have to upgrade all your production servers to a new (and potentially buggy) release which has just been made available to the public.  What you must do is download the latest stable bugfix release that has continual support.  For the JRE and Tomcat you should be looking at the last digits in the version number (5.5.'''X''') as it represents the bugfix information.  The bugs fixed in these releases are publicly available so if you don't upgrade you could be providing attackers with a very easy route to compromise your server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation of Apache Tomcat 5.5 ==&lt;br /&gt;
&lt;br /&gt;
=== UNIX ===&lt;br /&gt;
&lt;br /&gt;
* Create a tomcat user/group&lt;br /&gt;
* Download and unpack the core distribution (referenced as '''CATALINA_HOME''' from now on)&lt;br /&gt;
* Change '''CATALINA_HOME''' ownership to tomcat user and tomcat group&lt;br /&gt;
* Change files in '''CATALINA_HOME'''/conf to be readonly (440)&lt;br /&gt;
* Make sure tomcat user has read/write access (660) to /tmp and write (220 - yes, only write) access to '''CATALINA_HOME'''/logs&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
* Download the core windows service installer&lt;br /&gt;
* Start the installation, click ''Next'' and ''Agree'' to the licence&lt;br /&gt;
* Untick ''native'', ''documentation'', ''examples'' and ''webapps'' then click ''Next''&lt;br /&gt;
* Choose an installation directory (referenced as '''CATALINA_HOME''' from now on), preferably on a different drive to the OS.  &lt;br /&gt;
* Choose an administrator username (NOT admin) and a secure password that complies with your organisations password policy.&lt;br /&gt;
* Complete tomcat installation, but do not start service.&lt;br /&gt;
&lt;br /&gt;
=== Common ===&lt;br /&gt;
&lt;br /&gt;
* Remove everything from '''CATALINA_HOME'''/webapps (ROOT, balancer, jsp-examples, servlet-examples, tomcat-docs, webdav)&lt;br /&gt;
&lt;br /&gt;
* Remove everything from '''CATALINA_HOME'''/server/webapps (host-manager, manager).  Note that it can be useful to keep the manager webapp installed if you need the ability to redeploy without restarting Tomcat.  If you choose to keep it please read the section on Securing the Manager WebApp.&lt;br /&gt;
&lt;br /&gt;
* Remove '''CATALINA_HOME'''/conf/Catalina/localhost/host-manager.xml and '''CATALINA_HOME'''/conf/Catalina/localhost/manager.xml (again, if you are keeping the manager application, do not remove this).&lt;br /&gt;
&lt;br /&gt;
* Make sure the default servlet is configured '''not''' to serve index pages when a welcome file is not present.  In '''CATALINA_HOME'''/conf/web.xml&lt;br /&gt;
  &amp;lt;servlet&amp;gt;&lt;br /&gt;
    &amp;lt;servlet-name&amp;gt;default&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
    &amp;lt;servlet-class&amp;gt;org.apache.catalina.servlets.DefaultServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
    &amp;lt;init-param&amp;gt;&lt;br /&gt;
      &amp;lt;param-name&amp;gt;debug&amp;lt;/param-name&amp;gt;&lt;br /&gt;
      &amp;lt;param-value&amp;gt;0&amp;lt;/param-value&amp;gt;&lt;br /&gt;
    &amp;lt;/init-param&amp;gt;&lt;br /&gt;
    &amp;lt;init-param&amp;gt;&lt;br /&gt;
      &amp;lt;param-name&amp;gt;listings&amp;lt;/param-name&amp;gt;&lt;br /&gt;
      &amp;lt;param-value&amp;gt;'''false'''&amp;lt;/param-value&amp;gt;  &amp;amp;lt;!-- make sure this is false --&amp;amp;gt;&lt;br /&gt;
    &amp;lt;/init-param&amp;gt;&lt;br /&gt;
    &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;
  &amp;lt;/servlet&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Remove version string from HTTP error messages by repacking '''CATALINA_HOME'''/server/lib/catalina.jar with an updated ServerInfo.properties file.&lt;br /&gt;
:unpack catalina.jar&lt;br /&gt;
  cd CATALINA_HOME/server/lib&lt;br /&gt;
  jar xf catalina.jar org/apache/catalina/util/ServerInfo.properties&lt;br /&gt;
:update ServerInfo.properties by changing server.info line to server.info=Apache Tomcat&lt;br /&gt;
:repackage catalina.jar&lt;br /&gt;
  jar uf catalina.jar org/apache/catalina/util/ServerInfo.properties&lt;br /&gt;
:remove CATALINA_HOME/server/lib/org (created when extracting the ServerInfo.properties file)&lt;br /&gt;
&lt;br /&gt;
* Replace default error page (default is stacktrace) by adding the following into '''CATALINA_HOME'''/conf/web.xml.  The default error page shows a full stacktrace which is a disclosure of sensitive information.  ''The following solution is not ideal as it produces a blank page because Tomcat cannot find the file specified, but without a better solution this, at least, achieves the desired result.  A well configured web application will override this default in CATALINA_HOME/webapps/APP_NAME/WEB-INF/web.xml so it won't cause problems.''&lt;br /&gt;
  &amp;lt;error-page&amp;gt;&lt;br /&gt;
    &amp;lt;exception-type&amp;gt;java.lang.Exception&amp;lt;/exception-type&amp;gt;&lt;br /&gt;
    &amp;lt;location&amp;gt;/error.jsp&amp;lt;/location&amp;gt;&lt;br /&gt;
  &amp;lt;/error-page&amp;gt;&lt;br /&gt;
* Consider replacing '''CATALINA_HOME'''/conf/server.xml with '''CATALINA_HOME'''/conf/server-minimal.xml - ''work out what we lose''&lt;br /&gt;
&lt;br /&gt;
* Replace the server version string from HTTP headers in server responses, by adding the server keyword in your Connectors in '''CATALINA_HOME'''/conf/server.xml&lt;br /&gt;
  &amp;lt;Connector port=&amp;quot;8080&amp;quot; ...&lt;br /&gt;
             server=&amp;quot;Apache&amp;quot; /&amp;gt;  &amp;amp;lt;!-- server header is now Apache --&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Start Tomcat, deploy your applications into '''CATALINA_HOME'''/webapps and hope it works!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Protecting the Shutdown Port ==&lt;br /&gt;
Tomcat uses a port (defaults to 8005) as a shutdown port.  What this means is that to stop all webapps and stop Tomcat cleanly the shutdown scripts make a connection to this port and send the ''shutdown'' command.  This is not as huge a security problem as it may sound considering the connection to the port must be made from the machine running tomcat and the ''shutdown'' command can be changed to something other than the string ''SHUTDOWN''.  However, it's wise to take the following precautions;&lt;br /&gt;
* if you are running a publicly accessible server make sure you prevent external access to the shutdown port by using a suitable firewall.&lt;br /&gt;
* change the shutdown command in '''CATALINA_HOME'''/conf/server.xml and make sure that file is only readable by the tomcat user.&lt;br /&gt;
  &amp;amp;lt;Server port=&amp;quot;8005&amp;quot; shutdown=&amp;quot;ReallyComplexWord&amp;quot;&amp;amp;gt;&lt;br /&gt;
* if this is still a big problem for you then check [http://marc.theaimsgroup.com/?l=tomcat-user&amp;amp;m=104400608619118&amp;amp;w=2 this thread], from the Tomcat mailing list, for alternatives (they all involve code customisation though).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Securing Manager WebApp ==&lt;br /&gt;
&lt;br /&gt;
* By default there are no users with the manager role.  To make use of the manager webapp you need to add a new user into the '''CATALINA_HOME'''/conf/tomcat-users.xml file.&lt;br /&gt;
  &amp;lt;user username=&amp;quot;darren&amp;quot; password=&amp;quot;ReallyComplexPassword&amp;quot; roles=&amp;quot;manager&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using a [http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html valve] to filter by IP or hostname to only allow a subset of machines to connect (i.e. LAN machines).  Add one of the following within the Context tag in '''CATALINA_HOME'''/conf/Catalina/localhost/manager.xml&lt;br /&gt;
  &amp;amp;lt;!-- allow only LAN IPs to connect to the manager webapp --&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;!-- contrary to the current Tomcat 5.5 documation the value for '''allow''' is not a regular expression --&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;!-- future versions may have to be specified as 192\.168\.1\.* --&amp;amp;gt;&lt;br /&gt;
  &amp;lt;Valve className=&amp;quot;org.apache.catalina.valves.RemoteAddrValve&amp;quot;&lt;br /&gt;
         allow=&amp;quot;192.168.1.*&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;!-- allow only LAN hosts to connect to the manager webapp --&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;!-- contrary to the current Tomcat 5.5 documation the value for '''allow''' is not a regular expression --&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;!-- future versions may have to be specified as *\.localdomain\.com --&amp;amp;gt;&lt;br /&gt;
  &amp;lt;Valve className=&amp;quot;org.apache.catalina.valves.RemoteHostValve&amp;quot;&lt;br /&gt;
         allow=&amp;quot;*.localdomain.com&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You can rename the manager webapp to something else, e.g. ''foobar''&lt;br /&gt;
** Move '''CATALINA_HOME'''/conf/Catalina/localhost/'''manager.xml''' to '''CATALINA_HOME'''/conf/Catalina/localhost/'''foobar.xml'''&lt;br /&gt;
** Update the '''docBase''' attribute within '''CATALINA_HOME'''/conf/Catalina/localhost/'''foobar.xml''' to ${catalina.home}/server/webapps/foobar&lt;br /&gt;
** Move '''CATALINA_HOME'''/server/webapps/'''manager''' to '''CATALINA_HOME'''/server/webapps/'''foobar'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
&lt;br /&gt;
* TODO: Audit trails&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encryption ==&lt;br /&gt;
&lt;br /&gt;
* SSL for password or other sensitive data exchange (''bordering on application security, not specific to tomcat'')&lt;br /&gt;
* SSL for connections (JDBC, LDAP, etc ..)&lt;br /&gt;
* The Tomcat documentation clearly explains how to [http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html enable SSL.]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Java Security ==&lt;br /&gt;
&lt;br /&gt;
=== Running Tomcat with a Security Manager=== &lt;br /&gt;
The default Tomcat configuration provides good protection for most requirements, but does not prevent a malicious application from compromising the security of other applications running in the same instance.  To prevent this sort of attack, Tomcat can be run with a Security Manager enabled which strictly controls access to server resources.&lt;br /&gt;
Tomcat documentation has a good section on [http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html enabling the Security Manager.]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
* [http://tomcat.apache.org/faq/security.html Tomcat Security FAQ]&lt;br /&gt;
&lt;br /&gt;
=== Using Port 80 ===&lt;br /&gt;
&lt;br /&gt;
If you are on a Windows machine you will be able to change the port attribute of the connector within the ''Catalina'' service from 8080 to 80.  This allows you to use tomcat directly to serve all requests.  Depending on your requirements it may not be good enough to serve directly from Tomcat so you may like to consider;&lt;br /&gt;
* Use IIS / Apache running on port 80 and mod_jk to proxy requests to Tomcat&lt;br /&gt;
&lt;br /&gt;
On a UNIX machine only root is allowed to run services on ports below 1024 (kernel recompilation can overcome this).  It is a very bad idea to run Tomcat as root, so the options are;&lt;br /&gt;
* Use Apache running on port 80 and mod_jk (or mod_proxy_ajp) to proxy requests to Tomcat&lt;br /&gt;
* Run Tomcat as root, but in a chroot jail&lt;br /&gt;
* Use a tool like authbind to enable a non root user to bind to ports below 1024&lt;br /&gt;
* Use a port forwarder such as [http://www.netfilter.org/projects/iptables/index.html Iptables] to redirect incoming requests from 8080 to 80.  This has the disadvantage that internal redirects still need to use 8080.&lt;br /&gt;
* Run [http://www.squid-cache.org/ Squid] as a web accelerator in front of Tomcat&lt;br /&gt;
* Use JSVC/procrun&lt;br /&gt;
&lt;br /&gt;
=== Cleartext Passwords in CATALINA_HOME/conf/server.xml ===&lt;br /&gt;
&lt;br /&gt;
When configuring a resource, such as a JDBC pool, it is necessary to include clear text username and password in CATALINA_HOME/conf/server.xml  Best practices advice us never to store clear text passwords, but the following paragraphs highlight it is very difficult to avoid.&lt;br /&gt;
&lt;br /&gt;
If one way encryption was used on the password it must be possible for a database connection to be established using a username and encrypted password - so the encrypted password is just as valuable as the clear text one to an attacker.&lt;br /&gt;
&lt;br /&gt;
If two way encryption was used a keyfile is needed which must also live on the filesystem.  To make it more secure a passphase is added to the keyfile which then has to be stored in the configuration as clear text - no improvement.&lt;br /&gt;
&lt;br /&gt;
Encoding is security by obscurity and offers no form of protection (algorithms can be reverse engineered).  What encoding does do is make huge amounts of overhead work - you need to customise Tomcat and the commons digester it uses to parse the config files.  You'd also need a way to create encoded passwords.&lt;br /&gt;
&lt;br /&gt;
In the case of a JDBC pool what you can do is;&lt;br /&gt;
* make sure the database user only has access to the databases and tables they need (also limit rights as necessary).&lt;br /&gt;
* make sure the raw database files are only accessible to the user running the database services (e.g. mysql/postgresql user)&lt;br /&gt;
* make sure the Tomcat configuration files are only accessible to the tomcat user&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Java Project]]&lt;br /&gt;
[[Category:Java]]&lt;/div&gt;</summary>
		<author><name>Combatopera</name></author>	</entry>

	</feed>