How to upgrade Tomcat version manually on existing on
How to upgrade Tomcat version manually on existing on
Introduction
Below are the steps to upgrade Tomcat version manually on existing on-premise Foundry
instance in case of security vulnerabilities. When manually upgrading Tomcat, always
upgrade to minor version. For example, if current Tomcat version is 9.0.0 upgrade it to 9.0.x.
Instructions
Folders to be deleted:
tomcat\webapps\ROOT,
tomcat\webapps\docs,
tomcat\webapps\examples,
tomcat\webapps\host-manager
a. Add below tag at the end of <Host> section, just above closing of </Host>
tag.
<Valve className="org.apache.catalina.valves.ErrorReportValve"
showReport="false" showServerInfo="false"/>
6.
b. Copy the entire connector tag from existing Foundry instance which is present
in tomcat\conf\server.xml and replace it in new tomcat\conf\server.xml.
If existing Foundry instance is http, then copy only http connector tag else,
copy both http and https connector tags and update in new tomcat\conf\
server.xml. This needs to be done in <Service name="Catalina"> section
by deleting existing connector tag.
6.
c. Update the shutdown port as per in existing Foundry instance.
6.
d. Change
to
8. Copy the existing context.xml file from tomcat\conf and replace it in new tomcat\
conf folder.
9. Copy all war files from existing tomcat\webapps folder to new tomcat\
webapps folder.
10. Copy JAVA_OPTS, JAVA_HOME and JRE_HOME lines from existing Foundry
instance tomcat\bin\catalina.sh file (catalina.bat in windows) and add at the start
of new tomcat\bin\catalina.sh file (catalina.bat in windows).
14. Copy the file tomcat-users.xml from existing Foundry instance tomcat\conf and
replace it in new tomcat\conf folder.
15. Add below tags above the "Built In Filter Definitions" comment line in tomcat\
conf\web.xml.
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/j_spring_security_check</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/j_spring_security_logout</url-pattern>
</servlet-mapping>
15. Add below tags at the end just above </web-app> tag in tomcat\conf\web.xml if
protocol is https.
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
16. Add below thing just below the "Built In Filter Mappings" comment line in tomcat\
conf\web.xml.
<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</
filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>antiClickJackingEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>ALLOW-FROM</param-value>
</init-param>
<init-param>
<param-name>hstsEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>hstsMaxAgeSeconds</param-name>
<param-value>31536000</param-value>
</init-param>
<init-param>
<param-name>hstsIncludeSubDomains</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>hstsPreload</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>xssProtectionEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>blockContentTypeSniffingEnabled</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>httpHeaderSecurity</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>