How to Add HSTS headers to Authentication Manager, AM service responses, even for invalid URLs which return error such as 404
2 months ago
Originally Published: 2023-03-07
Article Number
000068128
Applies To

Authentication Manager, AM 8.3 and earlier, and their Web Tiers

Issue

HTTP Strict-Transport-Security (HSTS) is missing from Error responses, e.g. 404 in AM version 8.3 and earlier.
If you scan https://<AM_server_name>:7004 instead of a valid URL, like https://<AM_server_name>:7004/console-ims

The AM server returns a 404 page not found, but this Error page does not have HSTS enabled. 

Tasks
1. Edit the *Wrapper.conf files for the AM port services to add the HSTS setting
2. restart AM services, or reboot

HSTS_Wrapper_1 ls -l

rsaadmin@am83p:/opt/rsa/am/server/wrapper> 
ls -l *Wrapper.conf
-r-------- 1 rsaadmin rsaadmin 7839 Mar  7 10:33 AdminServerWrapper.conf
-r-------- 1 rsaadmin rsaadmin 7635 Mar  7 11:08 BiztierServerWrapper.conf
-r-------- 1 rsaadmin rsaadmin 7565 Aug 22  2022 ConsoleServerWrapper.conf
-r-------- 1 rsaadmin rsaadmin 4657 Jun 18  2018 PrimaryReplicationWrapper.conf
-r-------- 1 rsaadmin rsaadmin 7133 Aug 22  2022 RadiusOCServerWrapper.conf
-r-------- 1 rsaadmin rsaadmin 4657 Dec 16 18:12 ReplicaReplicationWrapper.conf
 
Resolution
  1. The resolution is to update to later versions of AM which have fixed all HSTS vulnerabilities
  2. This KB is available for historical purposes for manual fixes to very old and out-dated versions of AM. If you are running these versions of AM, you have many more problems than just HSTS

SSH into AM server, primary or replica, as rsaadmin
 cd /opt/rsa/am/server/wrapper/
There are several *Wrapper.conf files here, list them out

 ls -l *Wrapper.conf

 <screen shot above in tasks>

you need to determine the last number used for wrapper.java.additional.<nn> and use the next higher number, so for example in the AdminServerWrapper.conf on my AM 8.6 primary the highest number is .51, 

HSTS_Wrapper_2
 <screen shot 2>

so I need to add one more configuration parameter with .51, like this

 wrapper.java.additional.52=-Dweblogic.http.headers.enableHSTS=true

so that it ends up looking like this

HSTS_Wrapper_3
 <screen shot 3>

The next configuration file is BiztierServerWrapper.conf, and the highest # on wrapper.java.additional is 48, 

HSTS_Wrapper_4
 <screen shot 4>

so add the following line 

  wrapper.java.additional.49=-Dweblogic.http.headers.enableHSTS=true

and save, so that it looks like this.

HSTS_Wrapper_5
 <screen shot 5>

 cd /opt/rsa/am/server
 ./rsaserv restart all
 

Notes
When manually editing configuration files in AM, always make a backup file copy of the original .conf file, e.g.
 cd /opt/rsa/am/server/wrapper/
 cp AdminServerWrapper.conf AdminServerWrapper.conf.original

When using vi editor, you can use your arrow keys to move within the file, and in this case arrow down to the bottom of the .conf file, then 
 <press> i   for insert mode
use arrows to go to end of the existing line, press <enter> to create a blannk line, then paste in the configuration discussed above.

If you make a mistake in vi, and simply want to quit, remember these commands

 <esc> escape key gets you out of [insert] mode] or any mode
:   <colon> key on American keyboard brings up a   :     colon prompt

:q!                =   quit, no save

if you want to save, then enter 
:wq