mod_tls is an alternative to
mod_tls, being written in C, used the Rust implementation of TLS named rustls via its C interface rustls-ffi. This gives memory safe cryptography and protocol handling at comparable performance.
It can be configured for frontend and backend connections. The configuration
directive have been kept mostly similar to
The above is a minimal configuration. Instead of enabling mod_tls in every virtual host, the port for incoming TLS connections is specified.
You cannot mix virtual hosts with
The table below gives a comparison of feature between
Feature | mod_ssl | mod_tls | Comment |
---|---|---|---|
Frontend TLS | yes | yes | |
Backend TLS | yes | yes | |
TLS v1.3 | yes* | yes | *)with recent OpenSSL |
TLS v1.2 | yes | yes | |
TLS v1.0 | yes* | no | *)if enabled in OpenSSL |
SNI Virtual Hosts | yes | yes | |
Client Certificates | yes | no | |
Machine Certificates for Backend | yes | yes | |
OCSP Stapling | yes | yes* | *)via |
Backend OCSP check | yes | no* | *)stapling will be verified |
TLS version to allow | min-max | min | |
TLS ciphers | exclusive list | preferred/suppressed | |
TLS cipher ordering | client/server | client/server | |
TLS sessions | yes | yes | |
SNI strictness | default no | default yes | |
Option EnvVars | exhaustive | limited* | *)see var list |
Option ExportCertData | client+server | server | |
Backend CA | file/dir | file | |
Revocation CRLs | yes | no | |
TLS Renegotiation | yes* | no | *)in TLS v1.2 |
Encrypted Cert Keys | yes | no |
mod_tls supports TLS protocol version 1.2 and 1.3. Should there ever be
a version 1.4 and rustls
supports it, it will be available as well.
In mod_tls, you configure the minimum version to use, never the maximum:
This allows only version 1.3 and whatever may be its successor one day when talking to your server or to a particular virtual host.
The list of TLS ciphers supported in the rustls
library,
can be found here. All TLS v1.3
ciphers are supported. For TLS v1.2, only ciphers that rustls considers
secure are available.
mod_tls supports the following names for TLS ciphers:
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
ECDHE-ECDSA-AES256-SHA384
.
Such names often appear in documentation. `mod_tls` defines them for all TLS v1.2 ciphers.
For TLS v1.3 ciphers, names starting with TLS13_
are also supported.
0xc024
.
You can use this in configurations as TLS_CIPHER_0xc024
.
You can configure a preference for ciphers, which means they will be used
for clients that support them. If you do not configure a preference, rustls
will use the one that it considers best. This is recommended.
Should you nevertheless have the need to prefer one cipher over another, you may configure it like this:
If you name a cipher that is unknown, the configuration will fail.
If you name a cipher is not supported by rustls
(or no
longer supported in an updated version of rustls
for security
reasons), mod_tls will log a WARNING
, but continue to work.
A similar mechanism exists, if you want to disable a particular cipher:
A suppressed cipher will not longer be used.
If you name a cipher that is unknown, the configuration will fail.
If you name a cipher is not supported by rustls
(or no
longer supported in an updated version of rustls
for security
reasons), mod_tls will log a WARNING
, but continue to work.
mod_tls uses the SNI (Server Name Indicator) to select one of the
configured virtual hosts that match the port being served. Should
the client not provide an SNI, the first configured
virtual host will be selected. If the client does provide
an SNI (as all today's clients do), it must match one
virtual host (
As with
The example above show different TLS settings for virtual hosts on the
same port. This is supported. example1
can be contacted via
all TLS versions and example2
only allows v1.3 or later.
ACME certificates via
mod_tls has no own implementation to retrieve OCSP information for
a certificate. However, it will use such for Stapling if it is provided
by
Via the directive
The variable names are given by
Variable | TLSOption | Description |
---|---|---|
SSL_TLS_SNI | * | the server name indicator (SNI) send by the client |
SSL_PROTOCOL | * | the TLS protocol negotiated |
SSL_CIPHER | * | the name of the TLS cipher negotiated |
SSL_VERSION_INTERFACE | StdEnvVars | the module version |
SSL_VERSION_LIBRARY | StdEnvVars | the rustls-ffi version |
SSL_SECURE_RENEG | StdEnvVars | always `false` |
SSL_COMPRESS_METHOD | StdEnvVars | always `false` |
SSL_CIPHER_EXPORT | StdEnvVars | always `false` |
SSL_CLIENT_VERIFY | StdEnvVars | always `false` |
SSL_SESSION_RESUMED | StdEnvVars | either `Resumed` if a known TLS session id was presented by the client or `Initial` otherwise |
SSL_SERVER_CERT | ExportCertData | the selected server certificate in PEM format |
The variable SSL_SESSION_ID
is intentionally not supported as
it contains sensitive information.
While rustls
supports client certificates in principle, parts
of the infrastructure to make use of these in a server are not
offered.
Among these features are: revocation lists, inspection of certificate extensions and the matched issuer chain for OCSP validation. Without these, revocation of client certificates is not possible. Offering authentication without revocation is not considered an option.
Work will continue on this and client certificate support may become available in a future release.
This is set on a global level, not in individual
The example tells mod_tls to handle incoming connection on port 443 for all listeners.
If you do not specify a separate key file, the key is assumed to also be found in the first file. You may add more than one certificate to a server/virtual host. The first certificate suitable for a client is then chosen.
The path can be specified relative to the server root.
The default is `v1.2+`. Settings this to `v1.3+` would disable TLSv1.2.
This will not disable any ciphers supported by `rustls`. If you specify a cipher that is completely unknown, the configuration will fail. If you specify a cipher that is known but not supported by `rustls`, a warning will be logged but the server will continue.
The example gives 2 ciphers preference over others, in the order they are mentioned.
This will not disable any unmentioned ciphers supported by `rustls`. If you specify a cipher that is completely unknown, the configuration will fail. If you specify a cipher that is known but not supported by `rustls`, a warning will be logged but the server will continue.
The example removes a cipher for use in connections.
Adding variables to a request environment adds overhead, especially when certificates need to be inspected and fields extracted. Therefore most variables are not set by default.
You can configure
The `Defaults` value can be used to reset any options that are inherited from other locations or the virtual host/server.
This can be used in a server/virtual host or
The default is `v1.2+`. Settings this to `v1.3+` would disable TLSv1.2.
This will not disable any ciphers supported by `rustls`. If you specify a cipher that is completely unknown, the configuration will fail. If you specify a cipher that is known but not supported by `rustls`, a warning will be logged but the server will continue.
This will not disable any unmentioned ciphers supported by `rustls`. If you specify a cipher that is completely unknown, the configuration will fail. If you specify a cipher that is known but not supported by `rustls`, a warning will be logged but the server will continue.
The certificate is used to authenticate against a proxied backend server.
If you do not specify a separate key file, the key is assumed to also be
found in the first file. You may add more than one certificate to a proxy
setup. The first certificate suitable for a proxy connection to a backend
is then chosen by rustls
.
The path can be specified relative to the server root.
Client connections using SNI will be unsuccessful if no match is found.
This uses a cache on the server side to allow clients to resume connections.
You can set this to `none` or define a cache as in the
If not configured, `mod_tls` will try to create a shared memory cache on its own, using `shmcb:tls/session-cache` as specification. Should that fail, a warning is logged, but the server continues.