# Apache: Keep TLS 1.2, ECDSA and RSA, HSTS with subdomains

- Kind: example config
- Tested: no, built from documentation
- Web page: https://tldrtls.com/configs/apache-tls12-dual-sub/
- Other combinations: https://tldrtls.com/configs.md

Needs Apache 2.4 with OpenSSL 3.5 or later, plus `mod_ssl` and `mod_headers`. Swap `example.com` and the paths for your own.

```apache
ServerTokens Prod

<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName example.com
    DocumentRoot /var/www/example.com

    SSLEngine on
    SSLCertificateFile    /etc/ssl/example.com/ecdsa/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/example.com/ecdsa/privkey.pem
    SSLCertificateFile    /etc/ssl/example.com/rsa/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/example.com/rsa/privkey.pem

    SSLProtocol -all +TLSv1.2 +TLSv1.3
    SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305
    SSLHonorCipherOrder off
    SSLOpenSSLConfCmd Groups X25519MLKEM768:X25519:secp384r1
    SSLSessionTickets off

    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
    Header always set X-Content-Type-Options "nosniff"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</VirtualHost>
```

## What it does

- Accepts TLS 1.3 and TLS 1.2. On TLS 1.2 it allows only suites with forward secrecy and modern encryption. A TLS 1.2 connection gets no post-quantum protection. See [protocol versions](https://tldrtls.com/protocol-versions.md) and [cipher suites](https://tldrtls.com/cipher-suites.md).
- Offers the hybrid post-quantum group first, then X25519 and P-384. P-256 is not offered. See [post-quantum key exchange](https://tldrtls.com/post-quantum-key-exchange.md).
- Expects two certificates: ECDSA P-384, and RSA 3072 for clients that can't use ECDSA. See [certificate strength](https://tldrtls.com/certificate-keys.md).
- Sends HSTS for this hostname and every subdomain. Be sure all of them serve HTTPS first. See [HSTS](https://tldrtls.com/hsts.md).
- Turns session tickets off. Apache has no 0-RTT setting. See [0-RTT and session tickets](https://tldrtls.com/zero-rtt-and-tickets.md).

## What it leaves out

- OCSP stapling. See [revocation](https://tldrtls.com/revocation.md).
- A Content-Security-Policy. It depends on what your pages load.
- HTTP/3. We haven't tested it.

## Check what you deployed

```sh
openssl s_client -connect example.com:443 -groups X25519MLKEM768 -brief </dev/null
```

The output should include `Negotiated TLS1.3 group: X25519MLKEM768`.
