diff --git a/topics/tls.md b/topics/tls.md index 55bef78c..665795e9 100644 --- a/topics/tls.md +++ b/topics/tls.md @@ -184,6 +184,73 @@ Additional TLS configuration is available to control the choice of TLS protocol versions, ciphers and cipher suites, etc. Please consult the self documented `valkey.conf` for more information. +### Post-quantum key exchange + +Traffic recorded today could be decrypted later by a quantum computer that can +break the elliptic curve key exchange TLS uses now. Hybrid post-quantum key +exchange protects against this by combining a classical group such as X25519 +with ML-KEM, the key encapsulation mechanism standardized in NIST FIPS 203. +The connection stays secure as long as either ML-KEM or elliptic curve key exchange are secure. + +Valkey uses the key exchange groups provided by the OpenSSL library it was built +against. OpenSSL 3.5 and later support the hybrid group `X25519MLKEM768` and +prefer it by default. A Valkey server built with OpenSSL 3.5 or later uses it +with any client that supports it, without extra configuration. The official +Valkey container images ship OpenSSL 3.5. Earlier OpenSSL versions, including +the 3.0 series shipped by many long-term support distributions, do not support +ML-KEM. + +Keep these points in mind: + +* Post-quantum key exchange requires TLS 1.3. If you set `tls-protocols`, make + sure it includes `TLSv1.3`. +* Both sides of a connection must support it. This includes clients, replicas, + and cluster nodes that connect to each other. If one side does not support + it, the connection falls back to a classical group. + +To check what a server negotiates, connect with an OpenSSL 3.5 or later client: + +``` +openssl s_client -connect 127.0.0.1:6379 -tls1_3 -groups X25519MLKEM768 &1 | grep -i negotiated +``` + +A server that supports it prints: + +``` +Negotiated TLS1.3 group: X25519MLKEM768 +``` + +A server that does not support it prints `` as the group. + +Valkey has no directive for key exchange groups. To change them, use an OpenSSL +configuration file, which Valkey loads at startup. This example requires +post-quantum key exchange and rejects clients that support only classical +groups: + +``` +openssl_conf = openssl_init + +[openssl_init] +ssl_conf = ssl_module + +[ssl_module] +system_default = tls_defaults + +[tls_defaults] +Groups = X25519MLKEM768 +``` + +Point Valkey at the file with the `OPENSSL_CONF` environment variable: + +``` +OPENSSL_CONF=/path/to/openssl-pq.cnf valkey-server /path/to/valkey.conf +``` + +To prefer post-quantum key exchange while still accepting classical clients, +list more groups, for example `Groups = X25519MLKEM768:X25519:secp256r1`. This +setting applies to every TLS connection the server makes, including replication +and cluster bus connections. + ### Performance considerations TLS adds a layer to the communication stack with overheads due to writing/reading to/from an SSL connection, encryption/decryption and integrity checks. Consequently, using TLS results in a decrease of the achievable throughput per Valkey instance. diff --git a/wordlist b/wordlist index 2a1fcabe..8f6ebae1 100644 --- a/wordlist +++ b/wordlist @@ -199,6 +199,7 @@ Deauthenticate deauthenticate deauthenticated Deauthenticates +decrypted deduplicated deduplication Defrag @@ -1012,6 +1013,7 @@ whos-using-redis WQE WQEs WSL2 +X25519 x86 x86-64 xack