]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
automatically set DH parameters for ephemeral keying
authorAlan T. DeKok <aland@freeradius.org>
Thu, 26 Jun 2025 14:18:01 +0000 (10:18 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 26 Jun 2025 14:18:01 +0000 (10:18 -0400)
and update sample config / docs to match

doc/antora/modules/reference/pages/raddb/mods-available/eap.adoc
doc/antora/modules/reference/pages/raddb/mods-available/eap_inner.adoc
doc/antora/modules/reference/pages/raddb/sites-available/tls.adoc
raddb/mods-available/eap
raddb/mods-available/eap_inner
raddb/sites-available/tls
src/lib/tls/ctx.c

index cdbbc442465ae3a635fc215ebcfd93ce36814134..6b4c4b5a2aefea7d5fc3057f4919ab2d8261d568 100644 (file)
@@ -467,13 +467,16 @@ need to customize it for your installation.
 
 
 
-For DH cipher suites to work, you have to run OpenSSL to
-create the DH file first:
+You can create the DH parameters by running the
+following command:
 
        openssl dhparam -out certs/dh 2048
 
 The DH parameters will usually be ignored in FIPS mode.
 
+If this file isn't specified, then OpenSSL will
+automatically set the correct DH parameters.
+
 
 
 fragment_size:: Limit for size of EAP fragments.
@@ -1399,7 +1402,7 @@ eap {
 #              psk_identity = "test"
 #              psk_hexphrase = "036363823"
 #              psk_query = "%sql(select hex(key) from psk_keys where keyid = '%{TLS-PSK-Identity}')"
-               dh_file = ${certdir}/dh
+#              dh_file = ${certdir}/dh
 #              fragment_size = 1024
                ca_path = ${cadir}
                cipher_list = "DEFAULT"
index 4140837e6ee1353c1cfbd44071f050dd103e546e..cdc36b21f32db145ddaf80773da7d4ef1fa14fe5 100644 (file)
@@ -79,7 +79,7 @@ ca_file:: See the `eap` module for common configuration explanation.
 
 
 
-dh_file::
+dh_file:: See xref:reference:raddb/mods-available/eap.adoc[mods-available/eap]
 
 
 
@@ -157,7 +157,7 @@ eap inner-eap {
                        private_key_file = ${certdir}/rsa/server.key
                }
                ca_file = ${cadir}/rsa/ca.pem
-               dh_file = ${certdir}/dh
+#              dh_file = ${certdir}/dh
 #              random_file = /dev/urandom
                fragment_size = 16384
 #              check_crl = yes
index 0ee0fe625d8e8a5dc5d251479c908ffe789191b0..d839c1e7f06f206ad5945499efb28ce1f8f7157b 100644 (file)
@@ -93,13 +93,18 @@ this configuration item.
 
 ```
 
-For DH cipher suites to work, you have to
-run OpenSSL to create the DH file first:
+You can create the DH parameters by running the
+following command:
 
-       openssl dhparam -out certs/dh 1024
+       openssl dhparam -out certs/dh 2048
+
+The DH parameters will usually be ignored in FIPS mode.
+
+If this file isn't specified, then OpenSSL will
+automatically set the correct DH parameters.
 
 ```
-                       dh_file = ${certdir}/dh
+#                      dh_file = ${certdir}/dh
 
 ```
 
index e7a888897e9b805f3f0bc88055ced09d08206ebd..562ad3e4d8f3470168cdd522053f328377c148d2 100644 (file)
@@ -517,14 +517,17 @@ eap {
 #              psk_query = "%sql(select hex(key) from psk_keys where keyid = '%{TLS-PSK-Identity}')"
 
                #
-               #  For DH cipher suites to work, you have to run OpenSSL to
-               #  create the DH file first:
+               #  You can create the DH parameters by running the
+               #  following command:
                #
                #       openssl dhparam -out certs/dh 2048
                #
                #  The DH parameters will usually be ignored in FIPS mode.
                #
-               dh_file = ${certdir}/dh
+               #  If this file isn't specified, then OpenSSL will
+               #  automatically set the correct DH parameters.
+               #
+#              dh_file = ${certdir}/dh
 
                #
                #  fragment_size:: Limit for size of EAP fragments.
index f604c117d5eccbad51c3fcc55476092dee1c091f..c89d474862bc1521f5029a6084f6b828b0ded70b 100644 (file)
@@ -106,9 +106,9 @@ eap inner-eap {
                ca_file = ${cadir}/rsa/ca.pem
 
                #
-               #  dh_file::
+               #  dh_file:: See `mods-available/eap`
                #
-               dh_file = ${certdir}/dh
+#              dh_file = ${certdir}/dh
 
                #
                #  random_file:: See the `eap` module for common configuration explanation.
index 7c730abe04715eb37aefb6729a043f332ea9c94e..a0a05deecef930b2a4953a5f37b247e55b6c496f 100644 (file)
@@ -81,12 +81,17 @@ server radsec {
                        ca_file = ${cadir}/ca.pem
 
                        #
-                       #  For DH cipher suites to work, you have to
-                       #  run OpenSSL to create the DH file first:
+                       #  You can create the DH parameters by running the
+                       #  following command:
                        #
-                       #       openssl dhparam -out certs/dh 1024
+                       #       openssl dhparam -out certs/dh 2048
                        #
-                       dh_file = ${certdir}/dh
+                       #  The DH parameters will usually be ignored in FIPS mode.
+                       #
+                       #  If this file isn't specified, then OpenSSL will
+                       #  automatically set the correct DH parameters.
+                       #
+#                      dh_file = ${certdir}/dh
 
                        #
                        #  If your system doesn't have /dev/urandom,
index ed60a308303ec4610ac259b6f90de4acfb0b046f..d08c0168ba1b6ca426e8b73f6413b16670058c93 100644 (file)
@@ -961,7 +961,17 @@ post_ca:
        /*
         *      Load dh params
         */
-       if (conf->dh_file && (ctx_dh_params_load(ctx, UNCONST(char *, conf->dh_file)) < 0)) goto error;
+       if (conf->dh_file) {
+               if (ctx_dh_params_load(ctx, UNCONST(char *, conf->dh_file)) < 0) goto error;
+       } else {
+               /*
+                *      Tell OpenSSL to automatically set the DH
+                *      parameters based on the the size of the key
+                *      associated with the certificate, or for PSK,
+                *      with the negotiated symmetric cipher key.
+                */
+               SSL_CTX_set_dh_auto(ctx, 1);
+       }
 
        /*
         *      Setup session caching