Apache HTTPD with mod_ssl: Exploring configuration options

This is yet another blog post related to LPIC-3 Exam 303: Security. Knowing Apache configuration options is an important topic for Security Engineers. Apache web server is often serving web interfaces or acting as reverse proxy (for example for Splunk or Kibana). TLS configuration is an important step for securing these interfaces from eavesdropping and man-in-the-middle attacks. Let's examine Apache web server configuration with mod_ssl.

TLS configuration

SSL/TLS configuration file resides under /etc/httpd/conf.d/ssl.conf.

SSLCertificateFile and SSLCertificateKeyFile mod_ssl directives are used to enable https. 

SSLCertificateFile "/usr/local/apache2/conf/ssl.crt/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/ssl.key/server.key"

 

Mutual TLS authentication

To enable client authentication with certificate we need the following three directives:

  • SSLVerifyClient: set to require, so client has to present a valid certificate
  • SSLVerifyDepth: the maximum number of intermediate certificate issuers, default: 1
  • SSLCACertificateFile: CA certificate for client authentication
SSLVerifyClient require
SSLVerifyDepth 10
SSLCACertificateFile "/etc/apache2/conf/root_cert.pem
"

 

Online Certificate Status Protocol (OCSP) stapling

OCSP is a standard for checking the revocation status of X.509 digital certificates. It contrary to Certificate Revocation Lists (CRL), OCSP allows to check the certificate status in real time.

SSLStaplingCache directive specifies cache location and size (bytes).

SSLUseStapling on 
SSLStaplingCache "shmcb:/tmp/stapling_cache(128000)"

 

Server Name Indication (SNI)

SNI allows a server to present multiple certificates on the same IP address and port number, which enables the name-based virtual hosts with unique certificates. This way, multiple websites can be hosted on a single web server. 

If SSLStrictSNIVHostCheck is enabled, SNI unaware clients won't be able to connect. All modern browsers support SNI.

SSLStrictSNIVHostCheck on

 

HTTP Strict Transport Security (HSTS)

As  RFC 6797 describes, HSTS is "a mechanism enabling web sites to declare themselves accessible only via secure connections [...]". By sending Strict-Transport-Security header, the server instructs browser to always access the page via HTTPS. 

Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"

max-age (at least 1 year), includeSubDomains and preload directives must be specified to leverage HSTS preloading mechanism (which basically ensures that a site will be never visited using unsecured connection).

Comments

Popular posts from this blog

Splunk: Authentication with Discord? Wht not! (OAuth 2.0)

Study notes: Understanding DNSSEC

Linux: auditd fundamentals