From: Steffan K. <st...@ka...> - 2014-08-23 16:22:30
|
As requested on the mailing list and in trac ticket #410, add an option to disable 'traditional' Diffie Hellman key exchange. People want to be able to create ecdh-only configurations. Also update the manpage to reflect the new behaviour, and while touching it change the text to motivate users towards a more secure configuration. Signed-off-by: Steffan Karger <st...@ka...> --- doc/openvpn.8 | 15 ++++++++++----- src/openvpn/options.c | 14 ++++++++++---- src/openvpn/ssl.c | 5 ++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/doc/openvpn.8 b/doc/openvpn.8 index f2911c0..0448d29 100644 --- a/doc/openvpn.8 +++ b/doc/openvpn.8 @@ -4238,13 +4238,18 @@ Not available with PolarSSL. File containing Diffie Hellman parameters in .pem format (required for .B \-\-tls-server -only). Use +only). -.B openssl dhparam -out dh1024.pem 1024 +Set +.B file=none +to disable Diffie Hellman key exchange (and use ECDH only). Note that this +requires peers to be using an SSL library that supports ECDH TLS cipher suites +(e.g. OpenSSL 1.0.1+, or PolarSSL 1.3+). -to generate your own, or use the existing dh1024.pem file -included with the OpenVPN distribution. Diffie Hellman parameters -may be considered public. +Use +.B openssl dhparam -out dh2048.pem 2048 +to generate 2048-bit DH parameters. Diffie Hellman parameters may be considered +public. .\"********************************************************* .TP .B \-\-ecdh-curve name diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 84eb6ed..92189a5 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2149,10 +2149,6 @@ options_postprocess_verify_ce (const struct options *options, const struct conne (options->shared_secret_file != NULL) > 1) msg (M_USAGE, "specify only one of --tls-server, --tls-client, or --secret"); - if (options->tls_server) - { - notnull (options->dh_file, "DH file (--dh)"); - } if (options->tls_server || options->tls_client) { #ifdef ENABLE_PKCS11 @@ -2504,6 +2500,16 @@ options_postprocess_mutate (struct options *o) for (i = 0; i < o->connection_list->len; ++i) options_postprocess_mutate_ce (o, o->connection_list->array[i]); +#ifdef ENABLE_SSL + if (o->tls_server) + { + /* Check that DH file is specified, or explicitly disabled */ + notnull (o->dh_file, "DH file (--dh)"); + if (streq (o->dh_file, "none")) + o->dh_file = NULL; + } +#endif + #if ENABLE_MANAGEMENT if (o->http_proxy_override) options_postprocess_http_proxy_override(o); diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 3ce1f60..34f02a7 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -483,7 +483,10 @@ init_ssl (const struct options *options, struct tls_root_ctx *new_ctx) if (options->tls_server) { tls_ctx_server_new(new_ctx); - tls_ctx_load_dh_params(new_ctx, options->dh_file, options->dh_file_inline); + + if (options->dh_file) + tls_ctx_load_dh_params(new_ctx, options->dh_file, + options->dh_file_inline); } else /* if client */ { -- 1.9.1 |
Re: [Openvpn-devel] [PATCH] Add option to disable Diffie Hellman
key exchange by setting "--dh none"
From: Steffan K. <st...@ka...> - 2014-10-18 15:54:41
|
Anyone willing to review / comment? On 23-08-14 18:21, Steffan Karger wrote: > As requested on the mailing list and in trac ticket #410, add an option to > disable 'traditional' Diffie Hellman key exchange. People want to be able > to create ecdh-only configurations. > > Also update the manpage to reflect the new behaviour, and while touching it > change the text to motivate users towards a more secure configuration. > > Signed-off-by: Steffan Karger <st...@ka...> > --- > doc/openvpn.8 | 15 ++++++++++----- > src/openvpn/options.c | 14 ++++++++++---- > src/openvpn/ssl.c | 5 ++++- > 3 files changed, 24 insertions(+), 10 deletions(-) > > diff --git a/doc/openvpn.8 b/doc/openvpn.8 > index f2911c0..0448d29 100644 > --- a/doc/openvpn.8 > +++ b/doc/openvpn.8 > @@ -4238,13 +4238,18 @@ Not available with PolarSSL. > File containing Diffie Hellman parameters > in .pem format (required for > .B \-\-tls-server > -only). Use > +only). > > -.B openssl dhparam -out dh1024.pem 1024 > +Set > +.B file=none > +to disable Diffie Hellman key exchange (and use ECDH only). Note that this > +requires peers to be using an SSL library that supports ECDH TLS cipher suites > +(e.g. OpenSSL 1.0.1+, or PolarSSL 1.3+). > > -to generate your own, or use the existing dh1024.pem file > -included with the OpenVPN distribution. Diffie Hellman parameters > -may be considered public. > +Use > +.B openssl dhparam -out dh2048.pem 2048 > +to generate 2048-bit DH parameters. Diffie Hellman parameters may be considered > +public. > .\"********************************************************* > .TP > .B \-\-ecdh-curve name > diff --git a/src/openvpn/options.c b/src/openvpn/options.c > index 84eb6ed..92189a5 100644 > --- a/src/openvpn/options.c > +++ b/src/openvpn/options.c > @@ -2149,10 +2149,6 @@ options_postprocess_verify_ce (const struct options *options, const struct conne > (options->shared_secret_file != NULL) > 1) > msg (M_USAGE, "specify only one of --tls-server, --tls-client, or --secret"); > > - if (options->tls_server) > - { > - notnull (options->dh_file, "DH file (--dh)"); > - } > if (options->tls_server || options->tls_client) > { > #ifdef ENABLE_PKCS11 > @@ -2504,6 +2500,16 @@ options_postprocess_mutate (struct options *o) > for (i = 0; i < o->connection_list->len; ++i) > options_postprocess_mutate_ce (o, o->connection_list->array[i]); > > +#ifdef ENABLE_SSL > + if (o->tls_server) > + { > + /* Check that DH file is specified, or explicitly disabled */ > + notnull (o->dh_file, "DH file (--dh)"); > + if (streq (o->dh_file, "none")) > + o->dh_file = NULL; > + } > +#endif > + > #if ENABLE_MANAGEMENT > if (o->http_proxy_override) > options_postprocess_http_proxy_override(o); > diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c > index 3ce1f60..34f02a7 100644 > --- a/src/openvpn/ssl.c > +++ b/src/openvpn/ssl.c > @@ -483,7 +483,10 @@ init_ssl (const struct options *options, struct tls_root_ctx *new_ctx) > if (options->tls_server) > { > tls_ctx_server_new(new_ctx); > - tls_ctx_load_dh_params(new_ctx, options->dh_file, options->dh_file_inline); > + > + if (options->dh_file) > + tls_ctx_load_dh_params(new_ctx, options->dh_file, > + options->dh_file_inline); > } > else /* if client */ > { > |
From: Steffan K. <st...@ka...> - 2015-01-01 19:46:29
|
As requested on the mailing list and in trac ticket #410, add an option to disable 'traditional' Diffie Hellman key exchange. People want to be able to create ecdh-only configurations. This patch also disables RSA key exchange by default for OpenSSL builds, to prevent that people who set "--dh none" but have an OpenSSL version that doesn't support ECDH end up with a less secure connection. Note that users that specify their own --tls-cipher override these defaults and thus can still use whatever OpenSSL supports (and might thus end up with less secure connections). PolarSSL does not allow to easily disable RSA key exchange during runtime, but its default compile options do not include RSA key exchange based cipher suites. Finally update the manpage to reflect the new behaviour, and while touching it change the text to motivate users towards a more secure configuration. v2 - disable RSA key exchange by default Signed-off-by: Steffan Karger <st...@ka...> --- doc/openvpn.8 | 15 ++++++++++----- src/openvpn/options.c | 14 ++++++++++---- src/openvpn/ssl.c | 6 +++++- src/openvpn/ssl_openssl.c | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/doc/openvpn.8 b/doc/openvpn.8 index 49183ee..a8c189c 100644 --- a/doc/openvpn.8 +++ b/doc/openvpn.8 @@ -4239,13 +4239,18 @@ Not available with PolarSSL. File containing Diffie Hellman parameters in .pem format (required for .B \-\-tls-server -only). Use +only). -.B openssl dhparam -out dh1024.pem 1024 +Set +.B file=none +to disable Diffie Hellman key exchange (and use ECDH only). Note that this +requires peers to be using an SSL library that supports ECDH TLS cipher suites +(e.g. OpenSSL 1.0.1+, or PolarSSL 1.3+). -to generate your own, or use the existing dh1024.pem file -included with the OpenVPN distribution. Diffie Hellman parameters -may be considered public. +Use +.B openssl dhparam -out dh2048.pem 2048 +to generate 2048-bit DH parameters. Diffie Hellman parameters may be considered +public. .\"********************************************************* .TP .B \-\-ecdh-curve name diff --git a/src/openvpn/options.c b/src/openvpn/options.c index f6e0855..4ea03d1 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2134,10 +2134,6 @@ options_postprocess_verify_ce (const struct options *options, const struct conne (options->shared_secret_file != NULL) > 1) msg (M_USAGE, "specify only one of --tls-server, --tls-client, or --secret"); - if (options->tls_server) - { - notnull (options->dh_file, "DH file (--dh)"); - } if (options->tls_server || options->tls_client) { #ifdef ENABLE_PKCS11 @@ -2497,6 +2493,16 @@ options_postprocess_mutate (struct options *o) for (i = 0; i < o->connection_list->len; ++i) options_postprocess_mutate_ce (o, o->connection_list->array[i]); +#ifdef ENABLE_CRYPTO + if (o->tls_server) + { + /* Check that DH file is specified, or explicitly disabled */ + notnull (o->dh_file, "DH file (--dh)"); + if (streq (o->dh_file, "none")) + o->dh_file = NULL; + } +#endif + #if ENABLE_MANAGEMENT if (o->http_proxy_override) options_postprocess_http_proxy_override(o); diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 9cc11fc..0bca28d 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -242,6 +242,7 @@ static const tls_cipher_name_pair tls_cipher_name_translation_table[] = { {"EDH", "EDH"}, {"EXP", "EXP"}, {"RSA", "RSA"}, + {"kRSA", "kRSA"}, {"SRP", "SRP"}, #endif {NULL, NULL} @@ -483,7 +484,10 @@ init_ssl (const struct options *options, struct tls_root_ctx *new_ctx) if (options->tls_server) { tls_ctx_server_new(new_ctx); - tls_ctx_load_dh_params(new_ctx, options->dh_file, options->dh_file_inline); + + if (options->dh_file) + tls_ctx_load_dh_params(new_ctx, options->dh_file, + options->dh_file_inline); } else /* if client */ { diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index ea3c99a..48c0571 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -234,7 +234,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers) if (ciphers == NULL) { /* Use sane default (disable export, and unsupported cipher modes) */ - if(!SSL_CTX_set_cipher_list(ctx->ctx, "DEFAULT:!EXP:!PSK:!SRP")) + if(!SSL_CTX_set_cipher_list(ctx->ctx, "DEFAULT:!EXP:!PSK:!SRP:!kRSA")) crypto_msg (M_FATAL, "Failed to set default TLS cipher list."); return; } -- 1.9.1 |
From: Arne S. <ar...@rf...> - 2015-01-04 11:52:10
|
On 01.01.2015 20:46, Steffan Karger wrote: > As requested on the mailing list and in trac ticket #410, add an option to > disable 'traditional' Diffie Hellman key exchange. People want to be able > to create ecdh-only configurations. > > This patch also disables RSA key exchange by default for OpenSSL builds, to > prevent that people who set "--dh none" but have an OpenSSL version that > doesn't support ECDH end up with a less secure connection. Note that users > that specify their own --tls-cipher override these defaults and thus can > still use whatever OpenSSL supports (and might thus end up with less secure > connections). > > PolarSSL does not allow to easily disable RSA key exchange during runtime, > but its default compile options do not include RSA key exchange based > cipher suites. > > Finally update the manpage to reflect the new behaviour, and while touching > it change the text to motivate users towards a more secure configuration. > > v2 - disable RSA key exchange by default > > ACK. On a side note we should document the default of tls-cipher (DEFAULT:!EXP:!PSK:!SRP:!kRSA) in the man page. Arne |
From: Gert D. <ge...@gr...> - 2015-01-04 12:59:53
|
Your patch has been applied to the master branch. commit bd9aa06feb41838689ed01f79845bc765f887ae3 Author: Steffan Karger Date: Thu Jan 1 20:46:09 2015 +0100 Add option to disable Diffie Hellman key exchange by setting '--dh none' Signed-off-by: Steffan Karger <st...@ka...> Acked-by: Arne Schwabe <ar...@rf...> Message-Id: <142...@ka...> URL: http://article.gmane.org/gmane.network.openvpn.devel/9376 Signed-off-by: Gert Doering <ge...@gr...> -- kind regards, Gert Doering |