Add support for Keying Material Exporter [RFC 5705]
PATCH 1/1 Add support for Keying Material Exporter [RFC 5705]
Add support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
From df9b59db8099ce7cd754cf3dc4adf4c8af81c973 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]...>
Date: Mon, 26 May 2014 14:55:32 +0200
Subject: [PATCH] Added support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
--- doc/openvpn.8 | 15 +++++++++++++++ src/openvpn/init.c | 13 +++++++++++++ src/openvpn/options.c | 28 ++++++++++++++++++++++++++++ src/openvpn/options.h | 4 ++++ src/openvpn/ssl.c | 2 ++ src/openvpn/ssl_backend.h | 12 ++++++++++++ src/openvpn/ssl_common.h | 6 ++++++ src/openvpn/ssl_openssl.c | 33 +++++++++++++++++++++++++++++++++ 8 files changed, 113 insertions(+), 0 deletions(-)
doc/openvpn.8 +15 -0
@@ -2691,6 +2691,16 @@ client-connect), then every module and script must return success (0) in order for the connection to be authenticated. .\"********************************************************* +.TP +.B \-\-keying-material-exporter label len +Save Exported Keying Material [RFC5705] of len bytes using label in environment +for use by plugins. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". + +This option requires OpenSSL 1.0.1 or newer. +.\"********************************************************* .SS Server Mode Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is supported, and can be enabled with the
@@ -6116,6 +6126,11 @@ Like but in hex form (e.g. "12:34:56:78:9A"). .\"********************************************************* .TP +.B tls_binding_key +TLS Binding Key is a pseudorandom hex string based on Exported Keying Material +[RFC 5705]. +.\"********************************************************* +.TP .B tun_mtu The MTU of the TUN/TAP device. Set prior to
src/openvpn/init.c +13 -0
@@ -2294,6 +2294,19 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.comp_options = options->comp;#endif +/* TLS Exported Keying Material [RFC 5705] */ +if (options->keying_material_exporter_label) + { + to.ekm_used = true; + to.ekm_size = options->keying_material_exporter_length; + to.ekm_label = options->keying_material_exporter_label; + to.ekm_label_size =strlen (to.ekm_label); + } +else + { + to.ekm_used = false; + } +/* TLS handshake authentication (--tls-auth) */ if (options->tls_auth_file) {
src/openvpn/options.c +28 -0
@@ -630,6 +630,10 @@ static const char usage_message[] ="--x509-track x : Save peer X509 attribute x in environment for use by\n" " plugins and management interface.\n"#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +"--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n" + " of len bytes using label in environment for use by plugins.\n" +#endif "--remote-cert-ku v ... : Require that the peer certificate was signed with\n" " explicit key usage, you can specify more than one value.\n" " value should be given in hex format.\n"
@@ -6995,6 +6999,30 @@ add_option (struct options *options, options->persist_mode =1 ; }#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 + else if (streq (p[0], "keying-material-exporter") && p[1] && p[2]) + { +int ekm_length =positive_atoi (p[2 ]); + +VERIFY_PERMISSION (OPT_P_GENERAL ); + +if (strncmp (p[1 ],"EXPORTER" ,8 )) + { +msg (msglevel,"Keying material exporter label must begin with " +"\"EXPORTER\"" ); + goto err; + } + +if (ekm_length <1 || ekm_length >= (1 <<16 )) + { +msg (msglevel,"Invalid keying material exporter length" ); + goto err; + } + + options->keying_material_exporter_label = p[1 ]; + options->keying_material_exporter_length = ekm_length; + } +#endif else {int i;
src/openvpn/options.h +4 -0
@@ -602,6 +602,10 @@ struct optionsbool show_net_up;int route_method;#endif + +/* Keying Material Exporters [RFC 5705] */ +const char *keying_material_exporter_label; +int keying_material_exporter_length; };#define streq (x, y) (!strcmp((x), (y)))
src/openvpn/ssl.c +2 -0
@@ -2131,6 +2131,8 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi*/ if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) { +key_state_export_keying_material (&ks->ks_ssl, session); +if (plugin_call (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL ,NULL ,NULL , session->opt->es) !=OPENVPN_PLUGIN_FUNC_SUCCESS ) ks->authenticated = false; }
src/openvpn/ssl_backend.h +12 -0
@@ -333,6 +333,18 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,*/ void key_state_ssl_free (struct key_state_ssl *ks_ssl); +/** +* Keying Material Exporters [RFC 5705] allows additional keying material to be +* derived from existing TLS channel. This exported keying material can then be +* used for a variety of purposes. +* +* @param ks_ssl The SSL channel's state info +* @param session The session associated with the given key_state +*/ +void +key_state_export_keying_material (struct key_state_ssl *ks_ssl, +struct tls_session *session) __attribute__((nonnull)); +/**************************************************************************/ /** @addtogroup control_tls * @{ */
src/openvpn/ssl_common.h +6 -0
@@ -314,6 +314,12 @@ struct tls_options/* --gremlin bits */ int gremlin; + +/* Keying Material Exporter [RFC 5705] parameters */ +const char *ekm_label; +size_t ekm_label_size; +bool ekm_used;/* true when Keying Material should be exported */ +size_t ekm_size; };/** @addtogroup control_processor
src/openvpn/ssl_openssl.c +33 -0
@@ -1286,6 +1286,39 @@ key_state_read_plaintext (struct key_state_ssl *ks_ssl, struct buffer *buf,return ret; } +void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +if (session->opt->ekm_used) + { +#if (OPENSSL_VERSION_NUMBER >=0x10001000 ) +unsigned char ekm[session->opt->ekm_size]; + +if (SSL_export_keying_material (ssl->ssl, ekm,sizeof (ekm), + session->opt->ekm_label, session->opt->ekm_label_size,NULL ,0 ,0 )) + { +const char *ekm_hex =NULL ; +struct gc_arena gc =gc_new (); + + ekm_hex =format_hex (ekm,sizeof (ekm),0 , &gc); +setenv_str (session->opt->es,"tls_binding_key" , ekm_hex); +dmsg (M_DEBUG ,"%s: exported keying material: %s" , __func__, + ekm_hex); + +gc_free (&gc); + } +else + { +msg (M_WARN ,"WARNING: Export keying material failed!" ); +setenv_del (session->opt->es,"tls_binding_key" ); + } +#else +ASSERT (0 ); +#endif + } +} +/* ************************************** * * Information functions
Signature · 1 line
1.7.1
Quoted 5 lines · Daniel Kubec
Add support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
I've finally had some time to compile and test this patch, as well as done code review of it. First of all, this is a good piece of work! So I'm looking forward to see this arrive in OpenVPN. It will surely help develop more advanced authentication methods.
The patch does indeed work quite well. It provides a tls_binding_key environment variable to plugins which supports OPENVPN_PLUGIN_TLS_FINAL.
Here's my comments, thoughts and questions ...
a) Is the intention that this tls_binding_key variable should only be available when the OPENVPN_PLUGIN_TLS_FINAL plugin call happens?
Currently tls_binding_key is available to all plugin *and* script calls happening after OPENVPN_PLUGIN_TLS_FINAL has been called. But *only* after a plugin which supports this hook has run. This smells like a bug.
I think I would recommend this variable only to available for the OPENVPN_PLUGIN_TLS_FINAL call. Which means you would need to add a setenv_del() in ssl.c:key_method_2_read() after plugin_call().
I spotted tls_binding_key in the following hooks (using a slightly modified sample-plugin/log/log.c)
Client side: PLUGIN_IPCHANGE, PLUGIN_UP, PLUGIN_ROUTE_UP
and PLUGIN_ROUTE_DOWN
Server side: PLUGIN_IPCHANGE, PLUGIN_CLIENT_CONNECT_V2*,
PLUGIN_LEARN_ADDRESS and PLUGIN_CLIENT_DISCONNECT
* Most likely PLUGIN_CLIENT_CONNECT too
I also tried to use a --client-connect script which dumps 'printenv' to a file. When this log.so plug-in was used, I saw tls_binding_key in the printenv dump. It was not present when log.so was not loaded.
b) Should there be a script-hook available for this as well?
This could make it possible to make authentication methods using scripts as an addition to plug-ins written in C. Just thinking aloud, not saying it's a requirement.
c) The format is currently like this:
0f3d5a7a 8b78fe1a 8a7fce61 58b89142
Is this format the preferred formatting?
Other formats are available through format_hex_ex(). I would probably recommend another separator than space, if a separator is needed at all.
d) This patch breaks building with PolarSSL.
ssl.o: In function `key_method_2_read':
~/openvpn.git/src/openvpn/ssl.c:2129: undefined reference to `key_state_export_keying_material'
collect2: error: ld returned 1 exit status
I would recommend to add a kind of wrapper function in ssl_polarssl.c which adds this function. Not sure if it would be appropriate to do an ASSERT(0) or do something else. Maybe it should not set anything, just return without adding the tls_binding_key. When plug-ins expecting to see this fails to find this variable, it will the plug-in's responsibility to not explode.
e) Has this patch been tested with OpenSSL < 1.0.1?
Is it really needed with the #else ASSERT(0); ?
f) It should be stated better in the man page that this feature depends on a plug-in supporting OPENVPN_PLUGIN_TLS_FINAL.
Signature · 3 lines
kind regards, David Sommerseth
Hi David,
I am sorry for the delay but I was very busy :( I hope that I resolved all issues.
I made several tests with my aaa plugin prototype based on following crypto backends:
openssl-1.0.0m (no EKM support)
openssl-1.0.1 (with EKM support)
openssl-1.1.0-dev (with EKM support)
PolarSSL 1.3.8 (no EKM support)
a) tls_binding_key is available in OPENVPN_PLUGIN_TLS_FINAL only.
b) It depends (if someone request such feature I am open for extending)
c) Hex format is without spaces
d) It is working with PolarSSL
f) Man pages were updated to:
Save Exported Keying Material [RFC5705] of len bytes using label in environment (tls_binding_key) for use by plugins in OPENVPN_PLUGIN_TLS_FINAL callback.
Note that exporter labels have the potential to collide with existing PRF labels. In order to prevent this, labels MUST begin with "EXPORTER". This option requires OpenSSL 1.0.1 or newer.
Regards
Daniel
Quoted 76 lines · David Sommerseth
Quoted 5 lines · Daniel Kubec
Add support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
I've finally had some time to compile and test this patch, as well as done code review of it. First of all, this is a good piece of work! So I'm looking forward to see this arrive in OpenVPN. It will surely help develop more advanced authentication methods.
The patch does indeed work quite well. It provides a
tls_binding_keyenvironment variable to plugins which supportsOPENVPN_PLUGIN_TLS_FINAL.Here's my comments, thoughts and questions ...
a) Is the intention that this
tls_binding_keyvariable should only be available when theOPENVPN_PLUGIN_TLS_FINALplugin call happens?Currently
tls_binding_keyis available to all plugin *and* script calls happening afterOPENVPN_PLUGIN_TLS_FINALhas been called. But *only* after a plugin which supports this hook has run. This smells like a bug.I think I would recommend this variable only to available for the
OPENVPN_PLUGIN_TLS_FINALcall. Which means you would need to add asetenv_del()in ssl.c:key_method_2_read() afterplugin_call().I spotted
tls_binding_keyin the following hooks (using a slightly modifiedsample-plugin/log/log.c)Client side:
PLUGIN_IPCHANGE,PLUGIN_UP,PLUGIN_ROUTE_UP
andPLUGIN_ROUTE_DOWNServer side:
PLUGIN_IPCHANGE, PLUGIN_CLIENT_CONNECT_V2*,
PLUGIN_LEARN_ADDRESSandPLUGIN_CLIENT_DISCONNECT* Most likely
PLUGIN_CLIENT_CONNECTtooI also tried to use a --client-connect script which dumps 'printenv' to a file. When this log.so plug-in was used, I saw
tls_binding_keyin the printenv dump. It was not present when log.so was not loaded.b) Should there be a script-hook available for this as well?
This could make it possible to make authentication methods using scripts as an addition to plug-ins written in C. Just thinking aloud, not saying it's a requirement.
c) The format is currently like this:
0f3d5a7a 8b78fe1a 8a7fce61 58b89142Is this format the preferred formatting?
Other formats are available through
format_hex_ex(). I would probably recommend another separator than space, if a separator is needed at all.d) This patch breaks building with PolarSSL.
ssl.o: In function `key_method_2_read':
~/openvpn.git/src/openvpn/ssl.c:2129: undefined reference to `key_state_export_keying_material'
collect2: error: ld returned 1 exit statusI would recommend to add a kind of wrapper function in
ssl_polarssl.cwhich adds this function. Not sure if it would be appropriate to do an ASSERT(0) or do something else. Maybe it should not set anything, just return without adding thetls_binding_key. When plug-ins expecting to see this fails to find this variable, it will the plug-in's responsibility to not explode.
Quoted 14 lines
e) Has this patch been tested with OpenSSL < 1.0.1?
Is it really needed with the #else ASSERT(0); ?
f) It should be stated better in the man page that this feature depends on a plug-in supporting
OPENVPN_PLUGIN_TLS_FINAL.Signature · 3 lines
kind regards, David Sommerseth
From 2c4d6aeb0aa24792afb7df45a64de8e04416b95e Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]...>
Date: Wed, 27 Aug 2014 11:02:37 +0200
Subject: [PATCH] Added support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
--- doc/openvpn.8 | 10 ++++++++++ src/openvpn/init.c | 14 ++++++++++++++ src/openvpn/options.c | 27 +++++++++++++++++++++++++++ src/openvpn/options.h | 6 ++++++ src/openvpn/ssl.c | 4 ++++ src/openvpn/ssl_backend.h | 13 +++++++++++++ src/openvpn/ssl_common.h | 6 ++++++ src/openvpn/ssl_openssl.c | 31 +++++++++++++++++++++++++++++++ src/openvpn/ssl_polarssl.c | 6 ++++++ 9 files changed, 117 insertions(+), 0 deletions(-)
doc/openvpn.8 +10 -0
@@ -2684,6 +2684,16 @@ client-connect), then every module and script must return success (0) in order for the connection to be authenticated. .\"********************************************************* +.TP +.B \-\-keying-material-exporter [label] [len] +Save Exported Keying Material [RFC5705] of len bytes using label in environment +(tls_binding_key) for use by plugins in OPENVPN_PLUGIN_TLS_FINAL callback. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". + +This option requires OpenSSL 1.0.1 or newer. +.\"********************************************************* .SS Server Mode Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is supported, and can be enabled with the
src/openvpn/init.c +14 -0
@@ -2249,6 +2249,20 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.comp_options = options->comp;#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +if (options->keying_material_exporter_label) + { + to.ekm_used = true; + to.ekm_size = options->keying_material_exporter_length; + to.ekm_label = options->keying_material_exporter_label; + to.ekm_label_size =strlen (to.ekm_label); + } +else + { + to.ekm_used = false; + } +#endif +/* TLS handshake authentication (--tls-auth) */ if (options->tls_auth_file) {
src/openvpn/options.c +27 -0
@@ -623,6 +623,10 @@ static const char usage_message[] ="--x509-track x : Save peer X509 attribute x in environment for use by\n" " plugins and management interface.\n"#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +"--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n" + " of len bytes using label in environment for use by plugins.\n" +#endif "--remote-cert-ku v ... : Require that the peer certificate was signed with\n" " explicit key usage, you can specify more than one value.\n" " value should be given in hex format.\n"
@@ -6985,6 +6989,29 @@ add_option (struct options *options, options->persist_mode =1 ; }#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 + else if (streq (p[0], "keying-material-exporter") && p[1] && p[2]) + { +int ekm_length =positive_atoi (p[2 ]); + +VERIFY_PERMISSION (OPT_P_GENERAL ); + +if (strncmp (p[1 ],"EXPORTER" ,8 )) + { +msg (msglevel,"Keying material exporter label must begin with " +"\"EXPORTER\"" ); + goto err; + } +if (ekm_length <1 || ekm_length >= (1 <<16 )) + { +msg (msglevel,"Invalid keying material exporter length" ); + goto err; + } + + options->keying_material_exporter_label = p[1 ]; + options->keying_material_exporter_length = ekm_length; + } +#endif else {int i;
src/openvpn/options.h +6 -0
@@ -598,6 +598,12 @@ struct optionsbool show_net_up;int route_method;#endif + +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +/* Keying Material Exporters [RFC 5705] */ +const char *keying_material_exporter_label; +int keying_material_exporter_length; +#endif };#define streq (x, y) (!strcmp((x), (y)))
src/openvpn/ssl.c +4 -0
@@ -2130,8 +2130,12 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi*/ if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) { +key_state_export_keying_material (&ks->ks_ssl, session); +if (plugin_call (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL ,NULL ,NULL , session->opt->es) !=OPENVPN_PLUGIN_FUNC_SUCCESS ) ks->authenticated = false; + +setenv_del (session->opt->es,"tls_binding_key" ); }/*
src/openvpn/ssl_backend.h +13 -0
@@ -333,6 +333,19 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,*/ void key_state_ssl_free (struct key_state_ssl *ks_ssl); +/** +* Keying Material Exporters [RFC 5705] allows additional keying material to be +* derived from existing TLS channel. This exported keying material can then be +* used for a variety of purposes. +* +* @param ks_ssl The SSL channel's state info +* @param session The session associated with the given key_state +*/ + +void +key_state_export_keying_material (struct key_state_ssl *ks_ssl, +struct tls_session *session) __attribute__((nonnull)); +/**************************************************************************/ /** @addtogroup control_tls * @{ */
src/openvpn/ssl_common.h +6 -0
@@ -314,6 +314,12 @@ struct tls_options/* --gremlin bits */ int gremlin; + +/* Keying Material Exporter [RFC 5705] parameters */ +const char *ekm_label; +size_t ekm_label_size; +bool ekm_used;/* true when Keying Material should be exported */ +size_t ekm_size; };/** @addtogroup control_processor
src/openvpn/ssl_openssl.c +31 -0
@@ -133,6 +133,37 @@ bool tls_ctx_initialised(struct tls_root_ctx *ctx)return NULL != ctx->ctx; } +void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +if (session->opt->ekm_used) + { +#if (OPENSSL_VERSION_NUMBER >=0x10001000 ) +unsigned char ekm[session->opt->ekm_size]; + +if (SSL_export_keying_material (ssl->ssl, ekm,sizeof (ekm), + session->opt->ekm_label, session->opt->ekm_label_size,NULL ,0 ,0 )) + { +const char *ekm_hex =NULL ; +struct gc_arena gc =gc_new (); + + ekm_hex =format_hex_ex (ekm,sizeof (ekm),40 ,0 ,NULL , &gc); +setenv_str (session->opt->es,"tls_binding_key" , ekm_hex); +dmsg (M_DEBUG ,"%s: exported keying material: %s" , __func__, + ekm_hex); + +gc_free (&gc); + } +else + { +msg (M_WARN ,"WARNING: Export keying material failed!" ); +setenv_del (session->opt->es,"tls_binding_key" ); + } +#endif + } +} +/* * Print debugging information on SSL/TLS session negotiation. */
src/openvpn/ssl_polarssl.c +6 -0
@@ -146,6 +146,12 @@ tls_ctx_initialised(struct tls_root_ctx *ctx) }void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +} + +void tls_ctx_set_options (struct tls_root_ctx *ctx,unsigned int ssl_flags) { }
Signature · 1 line
1.7.1
Hi David,
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Daniel
From aec0e05d02392bca61eca9ea41e10f9a2dec5d07 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]...>
Date: Mon, 23 Feb 2015 16:04:48 +0100
Subject: [PATCH 1/1] Added support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
--- doc/openvpn.8 | 10 ++++++++++ src/openvpn/init.c | 14 ++++++++++++++ src/openvpn/options.c | 27 +++++++++++++++++++++++++++ src/openvpn/options.h | 6 ++++++ src/openvpn/ssl.c | 4 ++++ src/openvpn/ssl_backend.h | 13 +++++++++++++ src/openvpn/ssl_common.h | 6 ++++++ src/openvpn/ssl_openssl.c | 31 +++++++++++++++++++++++++++++++ src/openvpn/ssl_polarssl.c | 6 ++++++ 9 files changed, 117 insertions(+), 0 deletions(-)
doc/openvpn.8 +10 -0
@@ -2685,6 +2685,16 @@ client-connect), then every module and script must return success (0) in order for the connection to be authenticated. .\"********************************************************* +.TP +.B \-\-keying-material-exporter [label] [len] +Save Exported Keying Material [RFC5705] of len bytes using label in environment +(tls_binding_key) for use by plugins in OPENVPN_PLUGIN_TLS_FINAL callback. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". + +This option requires OpenSSL 1.0.1 or newer. +.\"********************************************************* .SS Server Mode Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is supported, and can be enabled with the
src/openvpn/init.c +14 -0
@@ -2259,6 +2259,20 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.comp_options = options->comp;#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +if (options->keying_material_exporter_label) + { + to.ekm_used = true; + to.ekm_size = options->keying_material_exporter_length; + to.ekm_label = options->keying_material_exporter_label; + to.ekm_label_size =strlen (to.ekm_label); + } +else + { + to.ekm_used = false; + } +#endif +/* TLS handshake authentication (--tls-auth) */ if (options->tls_auth_file) {
src/openvpn/options.c +27 -0
@@ -613,6 +613,10 @@ static const char usage_message[] ="--x509-track x : Save peer X509 attribute x in environment for use by\n" " plugins and management interface.\n"#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +"--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n" + " of len bytes using label in environment for use by plugins.\n" +#endif "--remote-cert-ku v ... : Require that the peer certificate was signed with\n" " explicit key usage, you can specify more than one value.\n" " value should be given in hex format.\n"
@@ -7023,6 +7027,29 @@ add_option (struct options *options, options->use_peer_id = true; options->peer_id =atoi (p[1 ]); } +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 + else if (streq (p[0], "keying-material-exporter") && p[1] && p[2]) + { +int ekm_length =positive_atoi (p[2 ]); + +VERIFY_PERMISSION (OPT_P_GENERAL ); + +if (strncmp (p[1 ],"EXPORTER" ,8 )) + { +msg (msglevel,"Keying material exporter label must begin with " +"\"EXPORTER\"" ); + goto err; + } +if (ekm_length <1 || ekm_length >= (1 <<16 )) + { +msg (msglevel,"Invalid keying material exporter length" ); + goto err; + } + + options->keying_material_exporter_label = p[1 ]; + options->keying_material_exporter_length = ekm_length; + } +#endif else {int i;
src/openvpn/options.h +6 -0
@@ -597,6 +597,12 @@ struct optionsbool use_peer_id;uint32_t peer_id; + +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +/* Keying Material Exporters [RFC 5705] */ +const char *keying_material_exporter_label; +int keying_material_exporter_length; +#endif };#define streq (x, y) (!strcmp((x), (y)))
src/openvpn/ssl.c +4 -0
@@ -2146,8 +2146,12 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi*/ if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) { +key_state_export_keying_material (&ks->ks_ssl, session); +if (plugin_call (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL ,NULL ,NULL , session->opt->es) !=OPENVPN_PLUGIN_FUNC_SUCCESS ) ks->authenticated = false; + +setenv_del (session->opt->es,"tls_binding_key" ); }/*
src/openvpn/ssl_backend.h +13 -0
@@ -334,6 +334,19 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,*/ void key_state_ssl_free (struct key_state_ssl *ks_ssl); +/** +* Keying Material Exporters [RFC 5705] allows additional keying material to be +* derived from existing TLS channel. This exported keying material can then be +* used for a variety of purposes. +* +* @param ks_ssl The SSL channel's state info +* @param session The session associated with the given key_state +*/ + +void +key_state_export_keying_material (struct key_state_ssl *ks_ssl, +struct tls_session *session) __attribute__((nonnull)); +/**************************************************************************/ /** @addtogroup control_tls * @{ */
src/openvpn/ssl_common.h +6 -0
@@ -316,6 +316,12 @@ struct tls_options/* --gremlin bits */ int gremlin; + +/* Keying Material Exporter [RFC 5705] parameters */ +const char *ekm_label; +size_t ekm_label_size; +bool ekm_used;/* true when Keying Material should be exported */ +size_t ekm_size; };/** @addtogroup control_processor
src/openvpn/ssl_openssl.c +31 -0
@@ -133,6 +133,37 @@ bool tls_ctx_initialised(struct tls_root_ctx *ctx)return NULL != ctx->ctx; } +void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +if (session->opt->ekm_used) + { +#if (OPENSSL_VERSION_NUMBER >=0x10001000 ) +unsigned char ekm[session->opt->ekm_size]; + +if (SSL_export_keying_material (ssl->ssl, ekm,sizeof (ekm), + session->opt->ekm_label, session->opt->ekm_label_size,NULL ,0 ,0 )) + { +const char *ekm_hex =NULL ; +struct gc_arena gc =gc_new (); + + ekm_hex =format_hex_ex (ekm,sizeof (ekm),40 ,0 ,NULL , &gc); +setenv_str (session->opt->es,"tls_binding_key" , ekm_hex); +dmsg (M_DEBUG ,"%s: exported keying material: %s" , __func__, + ekm_hex); + +gc_free (&gc); + } +else + { +msg (M_WARN ,"WARNING: Export keying material failed!" ); +setenv_del (session->opt->es,"tls_binding_key" ); + } +#endif + } +} +/* * Print debugging information on SSL/TLS session negotiation. */
src/openvpn/ssl_polarssl.c +6 -0
@@ -149,6 +149,12 @@ tls_ctx_initialised(struct tls_root_ctx *ctx) }void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +} + +void tls_ctx_set_options (struct tls_root_ctx *ctx,unsigned int ssl_flags) { }
Signature · 1 line
1.7.1
Hi,
Quoted 2 lines · Daniel Kubec
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
There definitely needs to be much(!) more documentation about this, maybe an extra .txt file under doc/ - I still(!) have *no* idea what this is useful for, or how to use it, so right now this is "extra code complexity with no well-explained gain" to me.
I understand that David understands this, but we really really need to have documentation understandable to non-crypto-geeks about it before it can go in.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 6 lines · Gert Doering
Hi,
Quoted 2 lines · Daniel Kubec
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Quoted 8 lines
There definitely needs to be much(!) more documentation about this, maybe an extra .txt file under doc/ - I still(!) have *no* idea what this is useful for, or how to use it, so right now this is "extra code complexity with no well-explained gain" to me.
I understand that David understands this, but we really really need to have documentation understandable to non-crypto-geeks about it before it can go in.
Fair enough.
Daniel, would it be possible to add some docs and possibly a very simple tool + plugin which could be used to demonstrate this feature? API docs should go into the docs/ sub-folder and the demo code into sample/sample-plugins/.
I suggest this comes as a separate patch, for patch maintainability. Will probably be a good idea to even split docs and demo/sample code
into separate patches too? (I'm not too keen on big patches doing
several things)
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEARECAAYFAlTrVUYACgkQDC186MBRfrr0jQCgjOBRc8VHLcuh9soopp5Ww+kd 3yMAnitmckErbeDYcwa44ZPFKOpdXbwq
=u30V
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 21 lines · David Sommerseth
Quoted 4 lines · Gert Doering
Quoted 2 lines · Daniel Kubec
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Quoted 8 lines
There definitely needs to be much(!) more documentation about this, maybe an extra .txt file under doc/ - I still(!) have *no* idea what this is useful for, or how to use it, so right now this is "extra code complexity with no well-explained gain" to me.
I understand that David understands this, but we really really need to have documentation understandable to non-crypto-geeks about it before it can go in.
Fair enough.
Daniel, would it be possible to add some docs and possibly a very simple tool + plugin which could be used to demonstrate this feature? API docs should go into the docs/ sub-folder and the demo code into sample/sample-plugins/.
Quoted 4 lines
I suggest this comes as a separate patch, for patch maintainability. Will probably be a good idea to even split docs
and demo/sample code into separate patches too? (I'm not too keen
on big patches doing several things)
Agreed that a bit more documentation would make this patch a lot more useful.
- From a crypto perspective I think the codes is good. I do have a few practicals nits though:
1) Instead of using just M_DEBUG in dmsg(), please add a log level. Since you are printing derived key material, I think a rather high log level like D_TLS_DEBUG, or perhaps D_TLS_DEBUG_MED would make sense.
2) ekm_used in struct tls_options is equivalent to (ekm_size > 0). You could just get rid of this extra variable.
3) tls_binding_key might not be the best env var name. That name hints at the use case you have in mind for this mechanisms, but it does not cover all use cases, nor does it easily match to the 'keying-material-exporter' name of the option you introduce. Something like 'exported_keying_material' might me more appropriate.
4) We might want to enforce a minimum length for the exported keying material. How about 128 bits / 16 bytes? Just to prevent a user making a typo from ending up with ridiculously small keys.
- -Steffan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJU7k8PAAoJEJgCyj0AftKIWBUIAJPG7+nbNS9dRbwDzOA8NpBU d0ueiNskJ5gGTfeUoRZwPK/wSlxPtRP0j1wKg7ltwJOvgJM7MCewI2KNxobPE/BF PptAzH8PU2X8YHMRhbgfcER4CyvTlg/KUW5PEieL7c1zAjq5pkQJMqTNIToq51Wo bUmQOEdtPuY5J3PF/06NpnKr9ZigM2FiIpx+M+GOietav8MX7a4OrGQVPnaZQo6E rtwCfhVTAxeaitRsWiJjuvg5tJOCqbs7uC8imjNNM6kCZzSpfJkC1nDDP6g+JAOa mTKgrbKS1HWYDlsE8kaSg8LLADWFix8Q2lTtGeXGUlbITtHYEE2n3DEAXqtgr4I= =vOYB
-----END PGP SIGNATURE-----
Greetings Steffan, David and Gert
Thank you very much for your comments.
1) log level switched to D_TLS_DEBUG_MED
2) ekm_size removed, ekm_size != 0 condition is used instead.
3) changed to: exported_keying_material
4) minimum set to 16 bytes and maximum set to 4095 bytes.
Added 2 patches related to [RFC-5705] (code + docs).
Regards
Daniel
Quoted 66 lines · Steffan Karger
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 21 lines · David Sommerseth
Quoted 4 lines · Gert Doering
Quoted 2 lines · Daniel Kubec
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Quoted 8 lines
There definitely needs to be much(!) more documentation about this, maybe an extra .txt file under doc/ - I still(!) have *no* idea what this is useful for, or how to use it, so right now this is "extra code complexity with no well-explained gain" to me.
I understand that David understands this, but we really really need to have documentation understandable to non-crypto-geeks about it before it can go in.
Fair enough.
Daniel, would it be possible to add some docs and possibly a very simple tool + plugin which could be used to demonstrate this feature? API docs should go into the docs/ sub-folder and the demo code into sample/sample-plugins/.
Quoted 4 lines
I suggest this comes as a separate patch, for patch maintainability. Will probably be a good idea to even split docs
and demo/sample code into separate patches too? (I'm not too keen
on big patches doing several things)Agreed that a bit more documentation would make this patch a lot more useful.
- From a crypto perspective I think the codes is good. I do have a few practicals nits though:
1) Instead of using just
M_DEBUGindmsg(), please add a log level. Since you are printing derived key material, I think a rather high log level likeD_TLS_DEBUG, or perhapsD_TLS_DEBUG_MEDwould make sense.2)
ekm_usedin structtls_optionsis equivalent to (ekm_size> 0). You could just get rid of this extra variable.3)
tls_binding_keymight not be the best env var name. That name hints at the use case you have in mind for this mechanisms, but it does not cover all use cases, nor does it easily match to the 'keying-material-exporter' name of the option you introduce. Something like 'exported_keying_material' might me more appropriate.4) We might want to enforce a minimum length for the exported keying material. How about 128 bits / 16 bytes? Just to prevent a user making a typo from ending up with ridiculously small keys.
- -Steffan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1iQEcBAEBAgAGBQJU7k8PAAoJEJgCyj0AftKIWBUIAJPG7+nbNS9dRbwDzOA8NpBU d0ueiNskJ5gGTfeUoRZwPK/wSlxPtRP0j1wKg7ltwJOvgJM7MCewI2KNxobPE/BF PptAzH8PU2X8YHMRhbgfcER4CyvTlg/KUW5PEieL7c1zAjq5pkQJMqTNIToq51Wo bUmQOEdtPuY5J3PF/06NpnKr9ZigM2FiIpx+M+GOietav8MX7a4OrGQVPnaZQo6E rtwCfhVTAxeaitRsWiJjuvg5tJOCqbs7uC8imjNNM6kCZzSpfJkC1nDDP6g+JAOa mTKgrbKS1HWYDlsE8kaSg8LLADWFix8Q2lTtGeXGUlbITtHYEE2n3DEAXqtgr4I= =vOYB
-----END PGP SIGNATURE-----
Quoted 10 lines
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
From 4b2428a807724a292e33c1cfa3319d75b71e65d6 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]>
Date: Mon, 2 Mar 2015 00:43:00 +0100
Subject: [PATCH 1/1] Added support for TLS Keying Material Exporters [RFC-5705]
Keying Material Exporter [RFC-5705] allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
--- doc/openvpn.8 | 11 +++++++++++ src/openvpn/init.c | 16 ++++++++++++++++ src/openvpn/options.c | 27 +++++++++++++++++++++++++++ src/openvpn/options.h | 6 ++++++ src/openvpn/ssl.c | 4 ++++ src/openvpn/ssl_backend.h | 13 +++++++++++++ src/openvpn/ssl_common.h | 5 +++++ src/openvpn/ssl_openssl.c | 31 +++++++++++++++++++++++++++++++ src/openvpn/ssl_polarssl.c | 6 ++++++ 9 files changed, 119 insertions(+), 0 deletions(-)
doc/openvpn.8 +11 -0
@@ -2685,6 +2685,17 @@ client-connect), then every module and script must return success (0) in order for the connection to be authenticated. .\"********************************************************* +.TP +.B \-\-keying-material-exporter [label] [len] (min. 16) +Save Exported Keying Material [RFC5705] of len bytes using label in environment +(exported_keying_material) for use by plugins in OPENVPN_PLUGIN_TLS_FINAL +callback. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". + +This option requires OpenSSL 1.0.1 or newer. +.\"********************************************************* .SS Server Mode Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is supported, and can be enabled with the
src/openvpn/init.c +16 -0
@@ -2259,6 +2259,22 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.comp_options = options->comp;#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +if (options->keying_material_exporter_label) + { + to.ekm_size = options->keying_material_exporter_length; +if (to.ekm_size <16 || to.ekm_size >4095 ) + to.ekm_size =0 ; + + to.ekm_label = options->keying_material_exporter_label; + to.ekm_label_size =strlen (to.ekm_label); + } +else + { + to.ekm_size =0 ; + } +#endif +/* TLS handshake authentication (--tls-auth) */ if (options->tls_auth_file) {
src/openvpn/options.c +27 -0
@@ -613,6 +613,10 @@ static const char usage_message[] ="--x509-track x : Save peer X509 attribute x in environment for use by\n" " plugins and management interface.\n"#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +"--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n" + " of len bytes using label in environment for use by plugins.\n" +#endif "--remote-cert-ku v ... : Require that the peer certificate was signed with\n" " explicit key usage, you can specify more than one value.\n" " value should be given in hex format.\n"
@@ -7023,6 +7027,29 @@ add_option (struct options *options, options->use_peer_id = true; options->peer_id =atoi (p[1 ]); } +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 + else if (streq (p[0], "keying-material-exporter") && p[1] && p[2]) + { +int ekm_length =positive_atoi (p[2 ]); + +VERIFY_PERMISSION (OPT_P_GENERAL ); + +if (strncmp (p[1 ],"EXPORTER" ,8 )) + { +msg (msglevel,"Keying material exporter label must begin with " +"\"EXPORTER\"" ); + goto err; + } +if (ekm_length <16 ) + { +msg (msglevel,"Invalid keying material exporter length" ); + goto err; + } + + options->keying_material_exporter_label = p[1 ]; + options->keying_material_exporter_length = ekm_length; + } +#endif else {int i;
src/openvpn/options.h +6 -0
@@ -597,6 +597,12 @@ struct optionsbool use_peer_id;uint32_t peer_id; + +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +/* Keying Material Exporters [RFC 5705] */ +const char *keying_material_exporter_label; +int keying_material_exporter_length; +#endif };#define streq (x, y) (!strcmp((x), (y)))
src/openvpn/ssl.c +4 -0
@@ -2146,8 +2146,12 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi*/ if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) { +key_state_export_keying_material (&ks->ks_ssl, session); +if (plugin_call (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL ,NULL ,NULL , session->opt->es) !=OPENVPN_PLUGIN_FUNC_SUCCESS ) ks->authenticated = false; + +setenv_del (session->opt->es,"exported_keying_material" ); }/*
src/openvpn/ssl_backend.h +13 -0
@@ -334,6 +334,19 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,*/ void key_state_ssl_free (struct key_state_ssl *ks_ssl); +/** +* Keying Material Exporters [RFC 5705] allows additional keying material to be +* derived from existing TLS channel. This exported keying material can then be +* used for a variety of purposes. +* +* @param ks_ssl The SSL channel's state info +* @param session The session associated with the given key_state +*/ + +void +key_state_export_keying_material (struct key_state_ssl *ks_ssl, +struct tls_session *session) __attribute__((nonnull)); +/**************************************************************************/ /** @addtogroup control_tls * @{ */
src/openvpn/ssl_common.h +5 -0
@@ -316,6 +316,11 @@ struct tls_options/* --gremlin bits */ int gremlin; + +/* Keying Material Exporter [RFC 5705] parameters */ +const char *ekm_label; +size_t ekm_label_size; +size_t ekm_size; };/** @addtogroup control_processor
src/openvpn/ssl_openssl.c +31 -0
@@ -133,6 +133,37 @@ bool tls_ctx_initialised(struct tls_root_ctx *ctx)return NULL != ctx->ctx; } +void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +if (session->opt->ekm_size >0 ) + { +#if (OPENSSL_VERSION_NUMBER >=0x10001000 ) +unsigned char ekm[session->opt->ekm_size]; + +if (SSL_export_keying_material (ssl->ssl, ekm,sizeof (ekm), + session->opt->ekm_label, session->opt->ekm_label_size,NULL ,0 ,0 )) + { +const char *ekm_hex =NULL ; +struct gc_arena gc =gc_new (); + + ekm_hex =format_hex_ex (ekm,sizeof (ekm),40 ,0 ,NULL , &gc); +setenv_str (session->opt->es,"exported_keying_material" , ekm_hex); +dmsg (D_TLS_DEBUG_MED ,"%s: exported keying material: %s" , __func__, + ekm_hex); + +gc_free (&gc); + } +else + { +msg (M_WARN ,"WARNING: Export keying material failed!" ); +setenv_del (session->opt->es,"exported_keying_material" ); + } +#endif + } +} +/* * Print debugging information on SSL/TLS session negotiation. */
src/openvpn/ssl_polarssl.c +6 -0
@@ -149,6 +149,12 @@ tls_ctx_initialised(struct tls_root_ctx *ctx) }void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +} + +void tls_ctx_set_options (struct tls_root_ctx *ctx,unsigned int ssl_flags) { }
Signature · 1 line
1.7.1
From a5779c95ace725a6e47200f5ca50a906b1d7f863 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]>
Date: Mon, 2 Mar 2015 00:50:11 +0100
Subject: [PATCH 1/1] Added doc/keying-material-exporter.txt for TLS Keying Material Exporters
--- doc/keying-material-exporter.txt | 137 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 137 insertions(+), 0 deletions(-) create mode 100644 doc/keying-material-exporter.txt
doc/keying-material-exporter.txt new file +137 -0
137 lines not on this page · raw message
Signature · 1 line
1.7.1
Quoted 10 lines · daniel kubec
Greetings Steffan, David and Gert
Thank you very much for your comments.
1) log level switched to
D_TLS_DEBUG_MED
2)ekm_sizeremoved,ekm_size!= 0 condition is used instead.
3) changed to:exported_keying_material
4) minimum set to 16 bytes and maximum set to 4095 bytes.Added 2 patches related to [RFC-5705] (code + docs).
Thanks. This looks good, the extra file in doc/ helps. Still a few remarks though. Really really minor, but let's get it right anyway :)
+.B \-\-keying-material-exporter [label] [len] (min. 16)
I should have spotted this in an earlier patch, but I just noticed the brackets around label and len. In the manpage such brackets indicate optional arguments, i.e. there should be no brackets in this case.
+ to.ekm_size = options->keying_material_exporter_length;
+ if (to.ekm_size < 16 || to.ekm_size > 4095)
+ to.ekm_size = 0;
vs
+ if (ekm_length < 16)
+ {
+ msg (msglevel, "Invalid keying material exporter length");
+ goto err;
+ }
Could you add the upper bound to the check in options.c too?
+channel bindings is straitforward and well-defined mechanism how to
That is spelled "straightforward".
I'll leave the assessment of the docs to Gert, as he can easier judge whether this is clear enough.
David, can you confirm the plugin aspects of this implementation are correct?
Apart from the remaining nits, ACK on the code.
-Steffan
Hi,
Quoted 1 line · daniel kubec
Added 2 patches related to [RFC-5705] (code + docs).
Thanks. TBH, this is all very nice and dandy, but it still doesn't make much sense to me...
Some more real-worldish specific examples ("do *this* and *that*, and then this mechanisms helps you to achive *this* goal!") instead of links to very theoretic documents was more what I had in mind.
The text itself is not bad, but it's still way to crypto-self-centric - if you can explain this to someone who doesn't know crypto but wants to use that feature for something cool, then you've achieved the goal.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi Gert,
There are alot of different use-cases for this standard mechanism and I really thinkin about better explanation in general.
I think that some real example will help alot but it requires alot of client+server code of different protocols (so many of do this and that).
When you got authenticated VPN then you dont need for example to discomfort users with username/password in protocols on top of VPN (Kerberos, HTTP(s), ...)
and you can automatically authenticate "(SSO)" these layers using this exported keying material [RFC-5705].
It is actually well defines mechanism for "crypto/authentication" plugin developers and they should know what they are doing.
Maybe Let's try to discuss that using IRC.
Daniel
Quoted 22 lines · Gert Doering
Hi,
Quoted 1 line · daniel kubec
Added 2 patches related to [RFC-5705] (code + docs).
Thanks. TBH, this is all very nice and dandy, but it still doesn't make much sense to me...
Some more real-worldish specific examples ("do *this* and *that*, and then this mechanisms helps you to achive *this* goal!") instead of links to very theoretic documents was more what I had in mind.
The text itself is not bad, but it's still way to crypto-self-centric - if you can explain this to someone who doesn't know crypto but wants to use that feature for something cool, then you've achieved the goal.
gert
--
USENET is *not* the non-clickable part of WWW!//www.muc.de/~gert/Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
Hi,
Quoted 4 lines · daniel kubec
It is actually well defines mechanism for "
crypto/authentication" plugin developers and they should know what they are doing.Maybe Let's try to discuss that using IRC.
IRC explanation isn't going to help someone who comes across this in a few months or years - a good example in the docs would really be appreciated.
No code needed. Just describe the parts that would be needed to make this work - like "on the server, you need a plugin that talks to foobar service to get a blinkenlight, on the client, you need a plugin that uses EKM to make the light blink, via..."
Right now I see crypto that adds code, seems to not break anything, but the only reason why the extra code is there is "oh, you can do lots of cool things with it" - this should be spelled out better, to make it useful to more people.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
I wanted to discuess (IRC) what exactly I should add to documentation.
It's like adding standard, secure and well defined hash-function for use by plugins and then there are (N) different use-cases.
"\-keying-material-exporter label len
Save Exported Keying Material [RFC5705] of len bytes using label in environment (exported_keying_material) for use by plugins in OPENVPN_PLUGIN_TLS_FINAL callback."
"Keying Material Exporter [RFC-5705] allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes. TLS allows client and server to establish keying material for use in the upper layers between the TLS end-points"
It is nothing more then generating same keying material for client and server plugins (OPENVPN_PLUGIN_TLS_FINAL callback)
without the need of transfer that key throught (D)TLS channel and/or app layer.
Daniel
Quoted 28 lines · Gert Doering
Hi,
Quoted 4 lines · daniel kubec
It is actually well defines mechanism for "
crypto/authentication" plugin developers and they should know what they are doing.Maybe Let's try to discuss that using IRC.
IRC explanation isn't going to help someone who comes across this in a few months or years - a good example in the docs would really be appreciated.
No code needed. Just describe the parts that would be needed to make this work - like "on the server, you need a plugin that talks to foobar service to get a blinkenlight, on the client, you need a plugin that uses EKM to make the light blink, via..."
Right now I see crypto that adds code, seems to not break anything, but the only reason why the extra code is there is "oh, you can do lots of cool things with it" - this should be spelled out better, to make it useful to more people.
gert
--
USENET is *not* the non-clickable part of WWW!//www.muc.de/~gert/Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
Hi,
Quoted 3 lines · daniel kubec
It is nothing more then generating same keying material for client and server plugins (
OPENVPN_PLUGIN_TLS_FINALcallback)
without the need of transfer that key throught (D)TLS channel and/or app layer.
Why is it so hard to describe a good use case along the lines of what I described here?
Quoted 1 line · Gert Doering
[..]
Quoted 4 lines
Quoted 4 lines
No code needed. Just describe the parts that would be needed to make this work - like "on the server, you need a plugin that talks to foobar service to get a blinkenlight, on the client, you need a plugin that uses EKM to make the light blink, via..."
[..]
You have written a lot of crypto speak, and added a bit of handwaving why this is totally useful - but no specific example, how the bits and pieces have to be combined to make it work.
Of course, single-sign-on would be extremely great - but I lack the crypto background (or the imagination) to see how this could be implemented using EKM - so, please explain it to us.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi Gert, Steffan and David
I fixed following:
a) doc/keying-material-exporter.txt ( "straightforward" spelling )
b) used spaces instead of tabs in ssl_openssl.c:key_state_export_keying_material() + some minor code cleanups
Gert
I understand your valid questions and still thinking about some real example with doc/specs based on existing general mechanism and references in doc/keying-material-exporter.txt
Best Regards
Daniel
Quoted 27 lines · Gert Doering
Hi,
Quoted 3 lines · daniel kubec
It is nothing more then generating same keying material for client and server plugins (
OPENVPN_PLUGIN_TLS_FINALcallback)
without the need of transfer that key throught (D)TLS channel and/or app layer.Why is it so hard to describe a good use case along the lines of what I described here?
Quoted 1 line · Gert Doering
[..]
Quoted 4 lines
Quoted 4 lines
No code needed. Just describe the parts that would be needed to make this work - like "on the server, you need a plugin that talks to foobar service to get a blinkenlight, on the client, you need a plugin that uses EKM to make the light blink, via..."
[..]
You have written a lot of crypto speak, and added a bit of handwaving why this is totally useful - but no specific example, how the bits and pieces have to be combined to make it work.
Of course, single-sign-on would be extremely great - but I lack the crypto background (or the imagination) to see how this could be implemented using EKM - so, please explain it to us.
Quoted 7 lines
gert
--
USENET is *not* the non-clickable part of WWW!//www.muc.de/~gert/Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
From b61e4b1eef33fc2806c3d2a60829bdf0b0440734 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]>
Date: Thu, 12 Mar 2015 15:25:42 +0100
Subject: [PATCH 1/1] Added document for TLS Keying Material Exporters [RFC-5705]
--- doc/keying-material-exporter.txt | 137 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 137 insertions(+), 0 deletions(-) create mode 100644 doc/keying-material-exporter.txt
doc/keying-material-exporter.txt new file +137 -0
@@ -0,0 +1,137 @@ +OpenVPN Daniel Kubec <[email protected]> +RFC-5705 February 2015 + + + Added support for TLS Keying Material Exporters + +Keying Material Exporter [RFC-5705] allow additional keying material to be +derived from existing TLS channel. This exported keying material can then be +used for a variety of purposes. TLS allows client and server to establish +keying material for use in the upper layers between the TLS end-points and +channel bindings is straightforward and well-defined mechanism how to +authenticate other layers. + + +OpenVPN Configuration + +-keying-material-exporter label len + +Export Keying Material [RFC-5705] of len bytes (min. 16 bytes) using label in +environment (exported_keying_material) for use by plugins in +OPENVPN_PLUGIN_TLS_FINAL callback. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". +(This option requires OpenSSL 1.0.1 or newer.) + + +Use Cases: + +Secure bindings of AAA information to application layer + + OpenVPN Client <------> OpenVPN Server + [KeyAgreement] [KeyAgreement] + + [TLSExportedKeyingMaterial] [TLSExportedKeyingMaterial] + [AAASessionKey] [AAASessionKey] + Client <------> Server + [Authenticated layer on top of (D)TLS] + + +TLS side channel authentication and straightforward bindings of AAA information +to application layer using well-defined mechanism. + + OpenVPN Client <------> OpenVPN Server + [KeyAgreement] [KeyAgreement] + + [TLSExportedKeyingMaterial] [TLSExportedKeyingMaterial] + [DerivedAAABindingKey] [DerivedAAABindingKey] + [AuthenticateBindingKeys] + Client -------> Server + [Confidental channel] + + +TLS Message flow for a full handshake + + ClientHello --------> + ServerHello + Certificate* + ServerKeyExchange* + CertificateRequest* + <-------- ServerHelloDone + Certificate* + ClientKeyExchange + CertificateVerify* + [ChangeCipherSpec] + Finished --------> + [ChangeCipherSpec] + <-------- Finished + + GenerateTLSBindingKey GenerateTLSBindingKey + + Application Data <-------> Application Data + + +Terminology + + AAA Authentication, Authorization, and Accounting: + functions that are generally required to control + access to a service and support auditing. + + Secure channel a packet, datagram, octet stream connection, or + sequence of connections between two end-points that + affords cryptographic integrity and confidentiality + to data exchanged over it. + + Channel binding the process of establishing that no man-in-the-middle + exists between two end-points that have been + authenticated using secure channel. + + TLS Binding Key Exported Keying Material [RFC5705] + + If no context is provided, it then computes: + PRF(SecurityParameters.master_secret, label, + SecurityParameters.client_random + + SecurityParameters.server_random + )[length] + + If context is provided, it computes: + PRF(SecurityParameters.master_secret, label, + SecurityParameters.client_random + + SecurityParameters.server_random + + context_value_length + context_value + )[length] + + AAA Binding Key TLS side channel authentication based on secure + channel bindings requires one more key derivation. + + SHA1(TLSExportedKeyingMaterial + ServerPublicKey) + +Reference + + [OPENAAA] "TLS side channel authentication and straightforward + bindings of AAA information to application + layer using well-defined mechanism." + Daniel Kubec <[email protected]> March 2013 + https://github.com/n13l/openaaa + + [RFC5705] "Keying Material Exporters for TLS" + E. Rescorla, RFC 5705 March 2010 + http://tools.ietf.org/html/rfc5705 + + [RFC5929] "Channel Bindings for TLS" + J. Altman, N. Williams, L. Zhu, RFC 5929, July 2010 + http://tools.ietf.org/html/rfc5929 + + [RFC4680] "TLS Handshake Message for Supplemental Data" + S. Santesson, RFC 4680, September 2006 + http://tools.ietf.org/html/rfc4680 + + [RFC5878] "TLS Authorization Extension" + M. Brown, R. Housley, RFC 5878, May 2010 + http://tools.ietf.org/html/rfc5878 + + [RFC5746] "TLS Renegotiation Indication Extension" + E. Rescorla, M. Raym, S. Dispensa, N. Oskov + RFC 5746, February 2010 + http://tools.ietf.org/html/rfc5746
Signature · 1 line
1.7.1
From 53a2c7cb7ed1f70633321323a4e733a2c2f18a15 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]>
Date: Thu, 12 Mar 2015 15:14:20 +0100
Subject: [PATCH 1/1] Added support for TLS Keying Material Exporters [RFC-5705]
Keying Material Exporter [RFC-5705] allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
--- doc/openvpn.8 | 11 +++++++++++ src/openvpn/init.c | 16 ++++++++++++++++ src/openvpn/options.c | 27 +++++++++++++++++++++++++++ src/openvpn/options.h | 6 ++++++ src/openvpn/ssl.c | 4 ++++ src/openvpn/ssl_backend.h | 13 +++++++++++++ src/openvpn/ssl_common.h | 5 +++++ src/openvpn/ssl_openssl.c | 33 +++++++++++++++++++++++++++++++++ src/openvpn/ssl_polarssl.c | 6 ++++++ 9 files changed, 121 insertions(+), 0 deletions(-)
doc/openvpn.8 +11 -0
@@ -2685,6 +2685,17 @@ client-connect), then every module and script must return success (0) in order for the connection to be authenticated. .\"********************************************************* +.TP +.B \-\-keying-material-exporter label len +Save Exported Keying Material [RFC5705] of len bytes (min. 16 bytes) using +label in environment (exported_keying_material) for use by plugins in +OPENVPN_PLUGIN_TLS_FINAL callback. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". + +This option requires OpenSSL 1.0.1 or newer. +.\"********************************************************* .SS Server Mode Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is supported, and can be enabled with the
src/openvpn/init.c +16 -0
@@ -2259,6 +2259,22 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.comp_options = options->comp;#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +if (options->keying_material_exporter_label) + { + to.ekm_size = options->keying_material_exporter_length; +if (to.ekm_size <16 || to.ekm_size >4095 ) + to.ekm_size =0 ; + + to.ekm_label = options->keying_material_exporter_label; + to.ekm_label_size =strlen (to.ekm_label); + } +else + { + to.ekm_size =0 ; + } +#endif +/* TLS handshake authentication (--tls-auth) */ if (options->tls_auth_file) {
src/openvpn/options.c +27 -0
@@ -613,6 +613,10 @@ static const char usage_message[] ="--x509-track x : Save peer X509 attribute x in environment for use by\n" " plugins and management interface.\n"#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +"--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n" + " of len bytes (min. 16 bytes) using label in environment for use by plugins.\n" +#endif "--remote-cert-ku v ... : Require that the peer certificate was signed with\n" " explicit key usage, you can specify more than one value.\n" " value should be given in hex format.\n"
@@ -7023,6 +7027,29 @@ add_option (struct options *options, options->use_peer_id = true; options->peer_id =atoi (p[1 ]); } +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 + else if (streq (p[0], "keying-material-exporter") && p[1] && p[2]) + { +int ekm_length =positive_atoi (p[2 ]); + +VERIFY_PERMISSION (OPT_P_GENERAL ); + +if (strncmp (p[1 ],"EXPORTER" ,8 )) + { +msg (msglevel,"Keying material exporter label must begin with " +"\"EXPORTER\"" ); + goto err; + } +if (ekm_length <16 || ekm_length >4095 ) + { +msg (msglevel,"Invalid keying material exporter length" ); + goto err; + } + + options->keying_material_exporter_label = p[1 ]; + options->keying_material_exporter_length = ekm_length; + } +#endif else {int i;
src/openvpn/options.h +6 -0
@@ -597,6 +597,12 @@ struct optionsbool use_peer_id;uint32_t peer_id; + +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +/* Keying Material Exporters [RFC 5705] */ +const char *keying_material_exporter_label; +int keying_material_exporter_length; +#endif };#define streq (x, y) (!strcmp((x), (y)))
src/openvpn/ssl.c +4 -0
@@ -2146,8 +2146,12 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi*/ if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) { +key_state_export_keying_material (&ks->ks_ssl, session); +if (plugin_call (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL ,NULL ,NULL , session->opt->es) !=OPENVPN_PLUGIN_FUNC_SUCCESS ) ks->authenticated = false; + +setenv_del (session->opt->es,"exported_keying_material" ); }/*
src/openvpn/ssl_backend.h +13 -0
@@ -334,6 +334,19 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,*/ void key_state_ssl_free (struct key_state_ssl *ks_ssl); +/** +* Keying Material Exporters [RFC 5705] allows additional keying material to be +* derived from existing TLS channel. This exported keying material can then be +* used for a variety of purposes. +* +* @param ks_ssl The SSL channel's state info +* @param session The session associated with the given key_state +*/ + +void +key_state_export_keying_material (struct key_state_ssl *ks_ssl, +struct tls_session *session) __attribute__((nonnull)); +/**************************************************************************/ /** @addtogroup control_tls * @{ */
src/openvpn/ssl_common.h +5 -0
@@ -316,6 +316,11 @@ struct tls_options/* --gremlin bits */ int gremlin; + +/* Keying Material Exporter [RFC 5705] parameters */ +const char *ekm_label; +size_t ekm_label_size; +size_t ekm_size; };/** @addtogroup control_processor
src/openvpn/ssl_openssl.c +33 -0
@@ -133,6 +133,39 @@ bool tls_ctx_initialised(struct tls_root_ctx *ctx)return NULL != ctx->ctx; } +void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +if (session->opt->ekm_size >0 ) + { +#if (OPENSSL_VERSION_NUMBER >=0x10001000 ) +unsigned int size = session->opt->ekm_size; +unsigned char ekm[size]; + +if (SSL_export_keying_material (ssl->ssl, ekm,sizeof (ekm), + session->opt->ekm_label, session->opt->ekm_label_size,NULL ,0 ,0 )) + { +struct gc_arena gc =gc_new (); +unsigned int len = (size *2 ) +2 ; + +const char *key =format_hex_ex (ekm, size, len,0 ,NULL , &gc); +setenv_str (session->opt->es,"exported_keying_material" , key); + +dmsg (D_TLS_DEBUG_MED ,"%s: exported keying material: %s" , + __func__, key); + +gc_free (&gc); + } +else + { +msg (M_WARN ,"WARNING: Export keying material failed!" ); +setenv_del (session->opt->es,"exported_keying_material" ); + } +#endif + } +} +/* * Print debugging information on SSL/TLS session negotiation. */
src/openvpn/ssl_polarssl.c +6 -0
@@ -149,6 +149,12 @@ tls_ctx_initialised(struct tls_root_ctx *ctx) }void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +} + +void tls_ctx_set_options (struct tls_root_ctx *ctx,unsigned int ssl_flags) { }
Signature · 1 line
1.7.1
Hi Gert, Steffan and David !
There is Sample HTTP (SSO) OpenVPN Plugin with http.client.py and http-server.py scripts based on OpenVPN's RFC-5705 support.
OpenVPN plugin examples. Daniel Kubec <[email protected]...>
Examples provided:
sso.c -- HTTP (SSO) Example based on TLS Keying Material Exporters [RFC-5705]
(openvpn/doc/keying-material-exporter.txt)
Requires:
OpenVPN RFC-5705 Support, OpenSSL >= 1.0.1
Files:
http-server.py -- Example HTTP Server listen 0.0.0.0:8080 http-client.py -- Example HTTP Client connect 10.8.0.1:8080 [GET /$SESSIONID]
server.ovpn -- Example HTTP SSO VPN Server configuration
client.ovpn -- Example HTTP SSO VPN Client configuration
sso.c, sso.so -- Example OpenVPN Client and Server plugin
To build:
./build sso
To use in OpenVPN:
Enter openvpn/sample/sample-plugins/sso directory
$ openvpn --config ./server.ovpn $ openvpn --config ./client.ovpn $ ./http-server.py $ ./http-client.py
Test:
openvpn --config ./server.ovpn
##############################
PLUGIN SSO: app session createdPLUGIN_CALL: POST ./sso.so/PLUGIN_TLS_VERIFY status=0 PLUGIN SSO: app session key: a5885abc84d361803f58ede1ef9c0adf99e720cd PLUGIN SSO: app session file:/tmp/openvpn_sso_a5885abc84d361803f58ede1ef9c0adf99e720cd PLUGIN SSO: app session user: Test-Client
openvpn --config ./client.ovpn
##############################
PLUGIN SSO: app session createdPLUGIN_CALL: POST ./sso.so/PLUGIN_TLS_VERIFY status=0 PLUGIN SSO: app session key: a5885abc84d361803f58ede1ef9c0adf99e720cd PLUGIN SSO: app session file: /tmp/openvpn_sso_userPLUGIN_CALL: POST ./sso.so/PLUGIN_TLS_FINAL status=0
HTTP_SERVER:http-server.py
################
http server started
session file: /tmp/openvpn_sso_a5885abc84d361803f58ede1ef9c0adf99e720cd 10.8.0.1 - - [02/Apr/2015 15:03:33] "GET /a5885abc84d361803f58ede1ef9c0adf99e720cd HTTP/1.1" 200 -
session user: Test-Client session key: a5885abc84d361803f58ede1ef9c0adf99e720cd
HTTP_SERVER:http-client.py
<html><body><h1>Greetings Test-Client. You are authorized</h1></body></html>
Quoted 27 lines · Gert Doering
Hi,
Quoted 3 lines · daniel kubec
It is nothing more then generating same keying material for client and server plugins (
OPENVPN_PLUGIN_TLS_FINALcallback)
without the need of transfer that key throught (D)TLS channel and/or app layer.Why is it so hard to describe a good use case along the lines of what I described here?
Quoted 1 line · Gert Doering
[..]
Quoted 4 lines
Quoted 4 lines
No code needed. Just describe the parts that would be needed to make this work - like "on the server, you need a plugin that talks to foobar service to get a blinkenlight, on the client, you need a plugin that uses EKM to make the light blink, via..."
[..]
You have written a lot of crypto speak, and added a bit of handwaving why this is totally useful - but no specific example, how the bits and pieces have to be combined to make it work.
Of course, single-sign-on would be extremely great - but I lack the crypto background (or the imagination) to see how this could be implemented using EKM - so, please explain it to us.
Quoted 7 lines
gert
--
USENET is *not* the non-clickable part of WWW!//www.muc.de/~gert/Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
From 4ca0e1483d64bde0123a461f575ca78473677725 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]>
Date: Sun, 5 Apr 2015 00:10:37 +0200
Subject: [PATCH] Added Sample HTTP (SSO) Plugin based on TLS Keying Material Exporters [RFC-5705]
--- sample/sample-plugins/sso/README | 62 +++++++ sample/sample-plugins/sso/build | 15 ++ sample/sample-plugins/sso/client.ovpn | 17 ++ sample/sample-plugins/sso/http-client.py | 21 +++ sample/sample-plugins/sso/http-server.py | 41 +++++ sample/sample-plugins/sso/server.ovpn | 19 ++ sample/sample-plugins/sso/sso.c | 269 ++++++++++++++++++++++++++++++ 7 files changed, 444 insertions(+), 0 deletions(-) create mode 100644 sample/sample-plugins/sso/README create mode 100755 sample/sample-plugins/sso/build create mode 100644 sample/sample-plugins/sso/client.ovpn create mode 100755 sample/sample-plugins/sso/http-client.py create mode 100755 sample/sample-plugins/sso/http-server.py create mode 100644 sample/sample-plugins/sso/server.ovpn create mode 100644 sample/sample-plugins/sso/sso.c
sample/sample-plugins/sso/README new file +62 -0
@@ -0,0 +1,62 @@ +OpenVPN plugin examples. Daniel Kubec <[email protected]> + +Examples provided: + +sso.c -- HTTP (SSO) Example based on TLS Keying Material Exporters [RFC-5705] + (openvpn/doc/keying-material-exporter.txt) + +Requires: +OpenVPN RFC-5705 Support, OpenSSL >= 1.0.1 + +Files: + http-server.py -- Example HTTP Server listen 0.0.0.0:8080 + http-client.py -- Example HTTP Client connect 10.8.0.1:8080 [GET /$SESSIONID] + + server.ovpn -- Example HTTP SSO VPN Server configuration + client.ovpn -- Example HTTP SSO VPN Client configuration + + sso.c, sso.so -- Example OpenVPN Client and Server plugin + +To build: + ./build sso + +To use in OpenVPN: + +Enter openvpn/sample/sample-plugins/sso directory + +$ openvpn --config ./server.ovpn +$ openvpn --config ./client.ovpn +$ ./http-server.py +$ ./http-client.py + +Test: + +openvpn --config ./server.ovpn +############################## + +PLUGIN SSO: app session created +PLUGIN_CALL: POST ./sso.so/PLUGIN_TLS_VERIFY status=0 +PLUGIN SSO: app session key: a5885abc84d361803f58ede1ef9c0adf99e720cd +PLUGIN SSO: app session file: /tmp/openvpn_sso_a5885abc84d361803f58ede1ef9c0adf99e720cd +PLUGIN SSO: app session user: Test-Client + +openvpn --config ./client.ovpn +############################## +PLUGIN SSO: app session created +PLUGIN_CALL: POST ./sso.so/PLUGIN_TLS_VERIFY status=0 +PLUGIN SSO: app session key: a5885abc84d361803f58ede1ef9c0adf99e720cd +PLUGIN SSO: app session file: /tmp/openvpn_sso_user +PLUGIN_CALL: POST ./sso.so/PLUGIN_TLS_FINAL status=0 + +HTTP_SERVER: +http-server.py +################ +http server started +session file: /tmp/openvpn_sso_a5885abc84d361803f58ede1ef9c0adf99e720cd +10.8.0.1 - - [02/Apr/2015 15:03:33] "GET /a5885abc84d361803f58ede1ef9c0adf99e720cd HTTP/1.1" 200 - +session user: Test-Client +session key: a5885abc84d361803f58ede1ef9c0adf99e720cd + +HTTP_SERVER: +http-client.py +<html><body><h1>Greetings Test-Client. You are authorized</h1></body></html>
sample/sample-plugins/sso/build new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# +# Build an OpenVPN plugin module on *nix. The argument should +# be the base name of the C source file (without the .c). +# + +# This directory is where we will look for openvpn-plugin.h +CPPFLAGS="${CPPFLAGS:--I../../..}" + +CC="${CC:-gcc}" +CFLAGS="${CFLAGS:--O2 -Wall -g}" + +$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \ +$CC $CFLAGS -fPIC -shared $LDFLAGS -Wl,-soname,$1.so -o $1.so $1.o -lc
sample/sample-plugins/sso/client.ovpn new file +17 -0
@@ -0,0 +1,17 @@ +tls-client + +keying-material-exporter "EXPORTER_SSO_TEST" 16 +reneg-sec 0 + +ca ../../sample-keys/ca.crt +cert ../../sample-keys/client.crt +key ../../sample-keys/client.key + +plugin ./sso.so + +remote 127.0.0.1 1194 +proto udp +dev tun +nobind + +verb 4
sample/sample-plugins/sso/http-client.py new file +21 -0
@@ -0,0 +1,21 @@ +#!/usr/bin/python +import sys +import os +import httplib + +f = '/tmp/openvpn_sso_user' +with open (f, "r") as myfile: + session_key = myfile.read().replace('\n', '') + +conn = httplib.HTTPConnection("10.8.0.1:8080") +conn.request("GET", "/" + session_key) +r1 = conn.getresponse() + +if r1.status == 200: + body = r1.read().rstrip() + print body +elif r1.status == 404: + print "Authentication failed" +else: + print r1.status, r1.reason +
sample/sample-plugins/sso/http-server.py new file +41 -0
41 lines not on this page · raw message
sample/sample-plugins/sso/server.ovpn new file +19 -0
@@ -0,0 +1,19 @@ +tls-server +reneg-sec 0 + +keying-material-exporter "EXPORTER_SSO_TEST" 16 +duplicate-cn + +plugin ./sso.so +ca ../../sample-keys/ca.crt +cert ../../sample-keys/server.crt +key ../../sample-keys/server.key +dh ../../sample-keys/dh2048.pem + +server 10.8.0.0 255.255.255.0 +port 1194 +proto udp +dev tun + +verb 4 +
sample/sample-plugins/sso/sso.c new file +269 -0
269 lines not on this page · raw message
Signature · 1 line
1.7.1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 66 lines · daniel kubec
Greetings Steffan, David and Gert
Thank you very much for your comments.
1) log level switched to
D_TLS_DEBUG_MED2)ekm_sizeremoved,ekm_size!= 0 condition is used instead. 3) changed to:exported_keying_material4) minimum set to 16 bytes and maximum set to 4095 bytes.Added 2 patches related to [RFC-5705] (code + docs).
Regards
Daniel
Quoted 23 lines · David Sommerseth
Quoted 23 lines
Quoted 23 lines · Gert Doering
Quoted 11 lines
Quoted 2 lines · Daniel Kubec
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
There definitely needs to be much(!) more documentation about this, maybe an extra .txt file under doc/ - I still(!) have *no* idea what this is useful for, or how to use it, so right now this is "extra code complexity with no well-explained gain" to me.
Quoted 3 lines
I understand that David understands this, but we really really need to have documentation understandable to non-crypto-geeks about it before it can go in.
Fair enough.
Daniel, would it be possible to add some docs and possibly a very simple tool + plugin which could be used to demonstrate this feature? API docs should go into the docs/ sub-folder and the demo code into sample/sample-plugins/.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I suggest this comes as a separate patch, for patch maintainability. Will probably be a good idea to even split
docs and demo/sample code into separate patches too? (I'm
not too keen on big patches doing several things)Agreed that a bit more documentation would make this patch a lot more useful.
- From a crypto perspective I think the codes is good. I do have a few practicals nits though:
1) Instead of using just
M_DEBUGindmsg(), please add a log level. Since you are printing derived key material, I think a rather high log level likeD_TLS_DEBUG, or perhapsD_TLS_DEBUG_MEDwould make sense.2)
ekm_usedin structtls_optionsis equivalent to (ekm_size> 0). You could just get rid of this extra variable.3)
tls_binding_keymight not be the best env var name. That name hints at the use case you have in mind for this mechanisms, but it does not cover all use cases, nor does it easily match to the 'keying-material-exporter' name of the option you introduce. Something like 'exported_keying_material' might me more appropriate.
Quoted 5 lines
4) We might want to enforce a minimum length for the exported keying material. How about 128 bits / 16 bytes? Just to prevent a user making a typo from ending up with ridiculously small keys.
-Steffan
I have looked at the plug-in side of the code, and code wise it looks good to me. But I wonder if there's an unintended bug here, related to the usage of format_hex_ex().
I have written a very simple plug-in, basically based on sample/sample-plugins/log/log_v3.c. It attaches itself to OPENVPN_PLUGIN_TLS_FINAL, and when this stage happens, it logs the contents of the 'exported_keying_material' environment variable when reaching this state.
The log code looks like this:
- ---------------------------------------------------------------------
const char *keyingmat = NULL;
keyingmat = get_env("exported_keying_material", args->envp);
ovpnlog(PLOG_NOTE, "rfc5705-tester",
"*** Received keying material %s", keyingmat);- ---------------------------------------------------------------------
This all seems to work fine, until I pass a 'len' argument larger than 19, then I see this in my log:
Received keying material 642e0422ed1ea8ed8d93b471bfd258[more...]
If I reduce it to 19, the '[more...]' part disappears. Increasing the lenght of the "EXPORTER" string doesn't seem to help either. As the length is restricted to 4096, I'd expect to go at least a bit further than 20.
I wonder if it is just a misunderstanding how of format_hex_ex() works, where the maxoutput is not a traditional truncation limit. If maxoutput is 0, it will allocate the needed space for the string buffer automatically, based on the input string. The "traditional" truncation limit is set by the 'size' argument.
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEARECAAYFAlT6A4wACgkQDC186MBRfrqsXwCeOY9CC0/UIlUNErcytTcniyVN rwoAn2TcaaoILYjCN2C6mFb59jmqa4Bf
=fdfs
-----END PGP SIGNATURE-----
Hi Steffan, David and Gert,
I fixed bug related to format_hex_ex() for size > 20, removed bracers arround "-keying-material-exporter label len" and added upper bound to the check in options.c.
king regards
Daniel
Quoted 115 lines · David Sommerseth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 66 lines · daniel kubec
Greetings Steffan, David and Gert
Thank you very much for your comments.
1) log level switched to
D_TLS_DEBUG_MED2)ekm_sizeremoved,ekm_size!= 0 condition is used instead. 3) changed to:exported_keying_material4) minimum set to 16 bytes and maximum set to 4095 bytes.Added 2 patches related to [RFC-5705] (code + docs).
Regards
Daniel
Quoted 23 lines · David Sommerseth
Quoted 23 lines
Quoted 23 lines · Gert Doering
Quoted 11 lines
Quoted 2 lines · Daniel Kubec
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
There definitely needs to be much(!) more documentation about this, maybe an extra .txt file under doc/ - I still(!) have *no* idea what this is useful for, or how to use it, so right now this is "extra code complexity with no well-explained gain" to me.
Quoted 3 lines
I understand that David understands this, but we really really need to have documentation understandable to non-crypto-geeks about it before it can go in.
Fair enough.
Daniel, would it be possible to add some docs and possibly a very simple tool + plugin which could be used to demonstrate this feature? API docs should go into the docs/ sub-folder and the demo code into sample/sample-plugins/.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I suggest this comes as a separate patch, for patch maintainability. Will probably be a good idea to even split
docs and demo/sample code into separate patches too? (I'm
not too keen on big patches doing several things)Agreed that a bit more documentation would make this patch a lot more useful.
- From a crypto perspective I think the codes is good. I do have a few practicals nits though:
1) Instead of using just
M_DEBUGindmsg(), please add a log level. Since you are printing derived key material, I think a rather high log level likeD_TLS_DEBUG, or perhapsD_TLS_DEBUG_MEDwould make sense.2)
ekm_usedin structtls_optionsis equivalent to (ekm_size> 0). You could just get rid of this extra variable.3)
tls_binding_keymight not be the best env var name. That name hints at the use case you have in mind for this mechanisms, but it does not cover all use cases, nor does it easily match to the 'keying-material-exporter' name of the option you introduce. Something like 'exported_keying_material' might me more appropriate.Quoted 5 lines
4) We might want to enforce a minimum length for the exported keying material. How about 128 bits / 16 bytes? Just to prevent a user making a typo from ending up with ridiculously small keys.
-Steffan
I have looked at the plug-in side of the code, and code wise it looks good to me. But I wonder if there's an unintended bug here, related to the usage of
format_hex_ex().I have written a very simple plug-in, basically based on
sample/sample-plugins/log/log_v3.c. It attaches itself toOPENVPN_PLUGIN_TLS_FINAL, and when this stage happens, it logs the contents of the 'exported_keying_material' environment variable when reaching this state.The log code looks like this:
- ---------------------------------------------------------------------const char *keyingmat = NULL; keyingmat = get_env("exported_keying_material", args->envp); ovpnlog(PLOG_NOTE, "rfc5705-tester", "*** Received keying material %s", keyingmat);- ---------------------------------------------------------------------
This all seems to work fine, until I pass a 'len' argument larger than 19, then I see this in my log:
Received keying material 642e0422ed1ea8ed8d93b471bfd258[more...]
If I reduce it to 19, the '[more...]' part disappears. Increasing the lenght of the "EXPORTER" string doesn't seem to help either. As the length is restricted to 4096, I'd expect to go at least a bit further than 20.
I wonder if it is just a misunderstanding how of
format_hex_ex()works, where the maxoutput is not a traditional truncation limit. If maxoutput is 0, it will allocate the needed space for the string buffer automatically, based on the input string. The "traditional" truncation limit is set by the 'size' argument.- --
kind regards,
Quoted 8 lines
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1iEYEARECAAYFAlT6A4wACgkQDC186MBRfrqsXwCeOY9CC0/UIlUNErcytTcniyVN rwoAn2TcaaoILYjCN2C6mFb59jmqa4Bf
=fdfs
-----END PGP SIGNATURE-----
From dc88e62df99d772b7d442a82f0ba9d8a4d53f398 Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]>
Date: Mon, 9 Mar 2015 18:58:25 +0100
Subject: [PATCH 1/1] Added support for TLS Keying Material Exporters [RFC-5705]
Keying Material Exporter [RFC-5705] allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
--- doc/openvpn.8 | 11 +++++++++++ src/openvpn/init.c | 16 ++++++++++++++++ src/openvpn/options.c | 27 +++++++++++++++++++++++++++ src/openvpn/options.h | 6 ++++++ src/openvpn/ssl.c | 4 ++++ src/openvpn/ssl_backend.h | 13 +++++++++++++ src/openvpn/ssl_common.h | 5 +++++ src/openvpn/ssl_openssl.c | 32 ++++++++++++++++++++++++++++++++ src/openvpn/ssl_polarssl.c | 6 ++++++ 9 files changed, 120 insertions(+), 0 deletions(-)
doc/openvpn.8 +11 -0
@@ -2685,6 +2685,17 @@ client-connect), then every module and script must return success (0) in order for the connection to be authenticated. .\"********************************************************* +.TP +.B \-\-keying-material-exporter label len +Save Exported Keying Material [RFC5705] of len bytes (min. 16 bytes) using +label in environment (exported_keying_material) for use by plugins in +OPENVPN_PLUGIN_TLS_FINAL callback. + +Note that exporter labels have the potential to collide with existing PRF +labels. In order to prevent this, labels MUST begin with "EXPORTER". + +This option requires OpenSSL 1.0.1 or newer. +.\"********************************************************* .SS Server Mode Starting with OpenVPN 2.0, a multi-client TCP/UDP server mode is supported, and can be enabled with the
src/openvpn/init.c +16 -0
@@ -2259,6 +2259,22 @@ do_init_crypto_tls (struct context *c, const unsigned int flags) to.comp_options = options->comp;#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +if (options->keying_material_exporter_label) + { + to.ekm_size = options->keying_material_exporter_length; +if (to.ekm_size <16 || to.ekm_size >4095 ) + to.ekm_size =0 ; + + to.ekm_label = options->keying_material_exporter_label; + to.ekm_label_size =strlen (to.ekm_label); + } +else + { + to.ekm_size =0 ; + } +#endif +/* TLS handshake authentication (--tls-auth) */ if (options->tls_auth_file) {
src/openvpn/options.c +27 -0
@@ -613,6 +613,10 @@ static const char usage_message[] ="--x509-track x : Save peer X509 attribute x in environment for use by\n" " plugins and management interface.\n"#endif +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +"--keying-material-exporter label len : Save Exported Keying Material (RFC5705)\n" + " of len bytes (min. 16 bytes) using label in environment for use by plugins.\n" +#endif "--remote-cert-ku v ... : Require that the peer certificate was signed with\n" " explicit key usage, you can specify more than one value.\n" " value should be given in hex format.\n"
@@ -7023,6 +7027,29 @@ add_option (struct options *options, options->use_peer_id = true; options->peer_id =atoi (p[1 ]); } +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 + else if (streq (p[0], "keying-material-exporter") && p[1] && p[2]) + { +int ekm_length =positive_atoi (p[2 ]); + +VERIFY_PERMISSION (OPT_P_GENERAL ); + +if (strncmp (p[1 ],"EXPORTER" ,8 )) + { +msg (msglevel,"Keying material exporter label must begin with " +"\"EXPORTER\"" ); + goto err; + } +if (ekm_length <16 || ekm_length >4095 ) + { +msg (msglevel,"Invalid keying material exporter length" ); + goto err; + } + + options->keying_material_exporter_label = p[1 ]; + options->keying_material_exporter_length = ekm_length; + } +#endif else {int i;
src/openvpn/options.h +6 -0
@@ -597,6 +597,12 @@ struct optionsbool use_peer_id;uint32_t peer_id; + +#if defined(ENABLE_CRYPTO_OPENSSL ) &&OPENSSL_VERSION_NUMBER >=0x10001000 +/* Keying Material Exporters [RFC 5705] */ +const char *keying_material_exporter_label; +int keying_material_exporter_length; +#endif };#define streq (x, y) (!strcmp((x), (y)))
src/openvpn/ssl.c +4 -0
@@ -2146,8 +2146,12 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi*/ if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) { +key_state_export_keying_material (&ks->ks_ssl, session); +if (plugin_call (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL ,NULL ,NULL , session->opt->es) !=OPENVPN_PLUGIN_FUNC_SUCCESS ) ks->authenticated = false; + +setenv_del (session->opt->es,"exported_keying_material" ); }/*
src/openvpn/ssl_backend.h +13 -0
@@ -334,6 +334,19 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,*/ void key_state_ssl_free (struct key_state_ssl *ks_ssl); +/** +* Keying Material Exporters [RFC 5705] allows additional keying material to be +* derived from existing TLS channel. This exported keying material can then be +* used for a variety of purposes. +* +* @param ks_ssl The SSL channel's state info +* @param session The session associated with the given key_state +*/ + +void +key_state_export_keying_material (struct key_state_ssl *ks_ssl, +struct tls_session *session) __attribute__((nonnull)); +/**************************************************************************/ /** @addtogroup control_tls * @{ */
src/openvpn/ssl_common.h +5 -0
@@ -316,6 +316,11 @@ struct tls_options/* --gremlin bits */ int gremlin; + +/* Keying Material Exporter [RFC 5705] parameters */ +const char *ekm_label; +size_t ekm_label_size; +size_t ekm_size; };/** @addtogroup control_processor
src/openvpn/ssl_openssl.c +32 -0
@@ -133,6 +133,38 @@ bool tls_ctx_initialised(struct tls_root_ctx *ctx)return NULL != ctx->ctx; } +void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +if (session->opt->ekm_size >0 ) + { +#if (OPENSSL_VERSION_NUMBER >=0x10001000 ) +unsigned char ekm[session->opt->ekm_size]; + +if (SSL_export_keying_material (ssl->ssl, ekm,sizeof (ekm), + session->opt->ekm_label, session->opt->ekm_label_size,NULL ,0 ,0 )) + { +const char *ekm_hex =NULL ; +struct gc_arena gc =gc_new (); +unsigned int len = (session->opt->ekm_size *2 ) +2 ; + + ekm_hex =format_hex_ex (ekm, session->opt->ekm_size, len,0 ,NULL , &gc); +setenv_str (session->opt->es,"exported_keying_material" , ekm_hex); +dmsg (D_TLS_DEBUG_MED ,"%s: exported keying material: %s" , __func__, + ekm_hex); + +gc_free (&gc); + } +else + { +msg (M_WARN ,"WARNING: Export keying material failed!" ); +setenv_del (session->opt->es,"exported_keying_material" ); + } +#endif + } +} +/* * Print debugging information on SSL/TLS session negotiation. */
src/openvpn/ssl_polarssl.c +6 -0
@@ -149,6 +149,12 @@ tls_ctx_initialised(struct tls_root_ctx *ctx) }void +key_state_export_keying_material (struct key_state_ssl *ssl, +struct tls_session *session) +{ +} + +void tls_ctx_set_options (struct tls_root_ctx *ctx,unsigned int ssl_flags) { }
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): [email protected]...
Quoted 7 lines · daniel kubec
---------- Forwarded message ----------
From: Daniel Kubec <[email protected]...>
Date: 23 February 2015 at 16:51
Subject: Add support for Keying Material Exporter [RFC 5705]
To: [email protected]
Quoted 6 lines
Hi David,
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Daniel
Hi,
I've finally had time to do some review. Your patches work, but I have a few comments.
* openvpn-rfc5705-sample.patch
- The client config is missing a 'pull'. I tried running this with a server running in a VM, and the client running outside of the server VM had no IP address or routing configured. Adding 'pull' to the client config solved it.
- You've called the plug-in and 'sso'. I'd try to avoid such a vague name, as it may be misunderstood to do something else. I'd suggest using a more related name, for example 'keying-material-exporter-demo'.
* openvpn-rfc5705-doc-v3.patch
- The 'OpenVPN Configuration' example is missing a leading dash. It now says -keying-material-exporter, but should say --keying-material-exporter.
* openvpn-rfc5705-v3.patch
The code looks good to me, I share the same comment to the man page as Steffan had too, to also document the upper bound of 4095 bytes.
If we can agree on these changes, I'll ensure it gets applied fairly quickly.
Signature · 3 lines
kind regards, David Sommerseth
Hi David,
Thank You for your comments. It makes sense to me. Can you apply your fixes into patches or it's up to me ?
King Regards
Daniel
Quoted 48 lines · David Sommerseth
Quoted 7 lines · daniel kubec
---------- Forwarded message ----------
From: Daniel Kubec <[email protected]...>
Date: 23 February 2015 at 16:51
Subject: Add support for Keying Material Exporter [RFC 5705]
To: [email protected]Quoted 6 lines
Hi David,
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Daniel
Hi,
I've finally had time to do some review. Your patches work, but I have a few comments.
* openvpn-rfc5705-sample.patch
- The client config is missing a 'pull'. I tried running this with a server running in a VM, and the client running outside of the server VM had no IP address or routing configured. Adding 'pull' to the client config solved it.
- You've called the plug-in and 'sso'. I'd try to avoid such a vague name, as it may be misunderstood to do something else. I'd suggest using a more related name, for example 'keying-material-exporter-demo'.* openvpn-rfc5705-doc-v3.patch
- The 'OpenVPN Configuration' example is missing a leading dash. It now says -keying-material-exporter, but should say --keying-material-exporter.* openvpn-rfc5705-v3.patch
The code looks good to me, I share the same comment to the man page as Steffan had too, to also document the upper bound of 4095 bytes.If we can agree on these changes, I'll ensure it gets applied fairly quickly.
--
kind regards,David Sommerseth
Quoted 5 lines · daniel kubec
Hi David,
Thank You for your comments. It makes sense to me. Can you apply your fixes into patches or it's up to me ?
As this has been lingering just way too long, I can do these changes this weekend and get it apply.
Signature · 3 lines
kind regards, David Sommerseth
Quoted 52 lines
Quoted 48 lines · David Sommerseth
Quoted 7 lines · daniel kubec
---------- Forwarded message ----------
From: Daniel Kubec <[email protected]...>
Date: 23 February 2015 at 16:51
Subject: Add support for Keying Material Exporter [RFC 5705]
To: [email protected]Quoted 6 lines
Hi David,
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Daniel
Hi,
I've finally had time to do some review. Your patches work, but I have a few comments.
* openvpn-rfc5705-sample.patch
- The client config is missing a 'pull'. I tried running this with a server running in a VM, and the client running outside of the server VM had no IP address or routing configured. Adding 'pull' to the client config solved it.
- You've called the plug-in and 'sso'. I'd try to avoid such a vague name, as it may be misunderstood to do something else. I'd suggest using a more related name, for example 'keying-material-exporter-demo'.* openvpn-rfc5705-doc-v3.patch
- The 'OpenVPN Configuration' example is missing a leading dash. It now says -keying-material-exporter, but should say --keying-material-exporter.* openvpn-rfc5705-v3.patch
The code looks good to me, I share the same comment to the man page as Steffan had too, to also document the upper bound of 4095 bytes.If we can agree on these changes, I'll ensure it gets applied fairly quickly.
--
kind regards,David Sommerseth
Ok, Thank You for these changes :)
Daniel
Quoted 69 lines · David Sommerseth
Quoted 5 lines · daniel kubec
Hi David,
Thank You for your comments. It makes sense to me. Can you apply your fixes into patches or it's up to me ?
As this has been lingering just way too long, I can do these changes this weekend and get it apply.
--
kind regards,David Sommerseth
Quoted 52 lines
Quoted 48 lines · David Sommerseth
Quoted 7 lines · daniel kubec
---------- Forwarded message ----------
From: Daniel Kubec <[email protected]...>
Date: 23 February 2015 at 16:51
Subject: Add support for Keying Material Exporter [RFC 5705]
To: [email protected]Quoted 6 lines
Hi David,
Keying Material Exporter [RFC 5705] Patch rebased to actual master branch.
Daniel
Hi,
I've finally had time to do some review. Your patches work, but I have a few comments.
* openvpn-rfc5705-sample.patch
- The client config is missing a 'pull'. I tried running this with a server running in a VM, and the client running outside of the server VM had no IP address or routing configured. Adding 'pull' to the client config solved it.
- You've called the plug-in and 'sso'. I'd try to avoid such a vague name, as it may be misunderstood to do something else. I'd suggest using a more related name, for example 'keying-material-exporter-demo'.* openvpn-rfc5705-doc-v3.patch
- The 'OpenVPN Configuration' example is missing a leading dash. It now says -keying-material-exporter, but should say --keying-material-exporter.* openvpn-rfc5705-v3.patch
The code looks good to me, I share the same comment to the man page as Steffan had too, to also document the upper bound of 4095 bytes.If we can agree on these changes, I'll ensure it gets applied fairly quickly.
--
kind regards,David Sommerseth
Quoted 4 lines · Daniel Kubec
Add support for TLS Keying Material Exporters [RFC 5705].
Keying Material Exporter allow additional keying material to be derived from existing TLS channel. This exported keying material can then be used for a variety of purposes.
These patches have been applied to the git master branch:
* openvpn-rfc5705-v3.patch
commit 685e486e8b8f70c25f09590c24762ff734f94a51
Author: Daniel Kubec <[email protected]...> Date: Thu Mar 12 15:14:20 2015 +0100
Added support for TLS Keying Material Exporters [RFC-5705]
Signed-off-by: Daniel Kubec <[email protected]...>
Signed-off-by: David Sommerseth <[email protected]...>
Acked-by: Steffan Karger <[email protected]...
Acked-by: David Sommerseth <[email protected]...>* openvpn-rfc5705-doc-v3.patch
commit 84604e0bae7216b46642d5a1a443b86f712d53aa
Author: Daniel Kubec <[email protected]...> Date: Thu Mar 12 15:25:42 2015 +0100
Added document for TLS Keying Material Exporters [RFC-5705]
[DS: Fixed option prefix from '-' to '--']
Signed-off-by: Daniel Kubec <[email protected]...>
Signed-off-by: David Sommerseth <[email protected]...>
Acked-by: Steffan Karger <[email protected]...
Acked-by: David Sommerseth <[email protected]...>* openvpn-rfc5705-sample.patch
commit f7ef7522f5c7e6d4abfa5a0378c2e2ad265c65ec
Author: Daniel Kubec <[email protected]...> Date: Sun Apr 5 00:10:37 2015 +0200
sample-plugin: TLS Keying Material Exporter [RFC-5705] demonstration plug-in
Signed-off-by: Daniel Kubec <[email protected]...>
Signed-off-by: David Sommerseth <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>Signature · 3 lines
kind regards, David Sommerseth