Security How To

Introduction:

Gratia supports 5 levels of security:

  1. no security [Current default]
  2. Track connections without SSL, check connection validity
  3. Check only SSL certificate (both cert validity and validity within Collector)
  4. Same as 2 + Track connection with SSL and check connection validity
  5. Require SSL connection + same checks as 2
  6. Same as 4 + Track connection with SSL and check connection validity

All of these options (and variations) are controlled by flags in the service-configuration.properties file found in the $CATALINA_HOME/gratia directory.
The first security level is straight-forward. Gratia does nothing.
The second level and up involve gratia working with tomcat. Using this approach requires a number of prerequisites:

Note that the ssl.port property must be equal to the ssl connector defined in tomcat's server.xml

Tomcat Settings:

Add something similar to your tomcat's server.xml to initiate ssl:
 <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
   <Connector port="8443" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" disableUploadTimeout="true" 
               acceptCount="100" scheme="https" secure="true"
               keystoreFile="/gratia/keystore" keystorePass="server"
               truststoreFile="/gratia/truststore" truststorePass="server"
               clientAuth="true" sslProtocol="TLS" /> 

Note that (for linux, at least) the location of the keystore file and the truststore file must be an absolute directory location.

Final Steps:

(And you thought you were finished) …

At this point tomcat has been configured with both an open port (8880 in our example) as well as a ssl secure port. Unfortunately, tomcat will still service requests on both ports. So, what you have to do is to force ssl authentication for each of the various services you are concerned with. Specifically, the major service(s) of concern is gratia-servlets and gratia-soap (which basically handle machine to machine communications). To secure this service (as well as any other) you must:

Service Configuration Settings:

Service.security.level
This flag controls the level of security gratia must deal with:
If set to 0, gratia doesn't do anything.
If set to 1, gratia works with tomcat to provide two way authentication using tomcat's ssl authentication mechanism.
If set to 2 (which is untested), gratia understands that it is running as a worker under Apache and the normal vdt/Apache security mechanisms will be used.

The rest of the options apply when running at security level 1.

Service.use.selfgenerated.certs
When set to 1 gratia will generate self signed certs for its use and will provide certs to requesting parties (such as a probe).
When set to 0 gratia will use doe/vdt certs but can still provide self signed certs to requesting parties.
Service.vdt.cert.file/service.vdt.key.file
Absolute path to the vdt/doe certificates and key pem's.
Service.autoregister.pem
When running at security level 1, an outside client (such as a probe) must "register" itself with gratia e.g. by sending gratia a copy of its public key.
If service.autoregister.pem = 0, gratia will add the key to the database but not insert it into its truststore. The administrator must manually do this via the gratia-administration screen.
If set to 1, however, the key is added both to the database as well as the truststore (no administration is required).
Service.open.connection
The open, unsecured url gratia is providing. As an example, http://yourgratiahost:8880
Service.secure.connection
The secure url gratia is providing. As an example, https://yourgratiahost:8843.