Remember if we have seen a push request without async push
PATCH 1/2 Remember if we have seen a push request without async push
The logic if we already have seen a push request is still correct/useful without async push. I am not entirely sure if also deferred management authentication can trigger this code path but it should be able to. The other benefit is removing a number of ifdefs.
--- src/openvpn/multi.c | 4 +--- src/openvpn/openvpn.h | 2 -- src/openvpn/push.c | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-)
src/openvpn/multi.c +1 -3
@@ -824,8 +824,8 @@ multi_create_instance(struct multi_context *m, const struct mroute_addr *real) mi->did_cid_hash = true;#endif -#ifdef ENABLE_ASYNC_PUSH mi->context.c2.push_request_received = false; +#ifdef ENABLE_ASYNC_PUSH mi->inotify_watch =-1 ;#endif
@@ -2074,13 +2074,11 @@ script_failed:/* set context-level authentication flag */ mi->context.c2.context_auth =CAS_SUCCEEDED ; -#ifdef ENABLE_ASYNC_PUSH /* authentication complete, send push reply */ if (mi->context.c2.push_request_received) {process_incoming_push_request (&mi->context); } -#endif }else {
src/openvpn/openvpn.h +0 -2
@@ -432,9 +432,7 @@ struct context_2#if P2MP /* --ifconfig endpoints to be pushed to client */ -#ifdef ENABLE_ASYNC_PUSH bool push_request_received; -#endif bool push_ifconfig_defined;time_t sent_push_reply_expiry;in_addr_t push_ifconfig_local;
src/openvpn/push.c +0 -2
@@ -794,9 +794,7 @@ process_incoming_push_request(struct context *c) {int ret =PUSH_MSG_ERROR ; -#ifdef ENABLE_ASYNC_PUSH c->c2.push_request_received = true; -#endif if (tls_authentication_status (c->c2.tls_multi,0 ) ==TLS_AUTHENTICATION_FAILED || c->c2.context_auth ==CAS_FAILED ) {const char *client_reason =tls_client_reason (c->c2.tls_multi);
Signature · 1 line
2.26.2
PATCH 2/2 merge key_state->authenticated and key_state->auth_deferred
Both are tightly coupled often both are checked at the same time. Merging them into one state makes the code simpler and also brings us closer in the direction of a state machine
--- src/openvpn/ssl.c | 29 ++++++++++++----------------- src/openvpn/ssl_common.h | 9 +++++++-- src/openvpn/ssl_verify.c | 27 ++++++++++++++------------- 3 files changed, 33 insertions(+), 32 deletions(-)
src/openvpn/ssl.c +12 -17
@@ -1930,7 +1930,7 @@ tls_session_generate_data_channel_keys(struct tls_session *session)const struct session_id *server_sid = !session->opt->server ? &ks->session_id_remote : &session->session_id; -if (!ks->authenticated) +if (ks->authenticated ==KS_AUTH_FALSE ) {msg (D_TLS_ERRORS ,"TLS Error: key_state not authenticated" ); goto cleanup;
@@ -2466,7 +2466,7 @@ key_method_2_write(struct buffer *buf, struct tls_session *session)if (session->opt->server && !(session->opt->ncp_enabled && session->opt->mode ==MODE_SERVER && ks->key_id <=0 )) { -if (ks->authenticated) +if (ks->authenticated !=KS_AUTH_FALSE ) {if (!tls_session_generate_data_channel_keys (session)) {
@@ -2536,7 +2536,7 @@ key_method_1_read(struct buffer *buf, struct tls_session *session) &session->opt->key_type,OPENVPN_OP_DECRYPT , "Data Channel Decrypt");secure_memzero (&key,sizeof (key)); - ks->authenticated = true; + ks->authenticated =KS_AUTH_TRUE ;return true; error:
@@ -2594,7 +2594,7 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio goto error; } - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;/* always extract username + password fields from buf, even if not * authenticating for it, because otherwise we can't get at the
@@ -2652,14 +2652,14 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio "TLS Error: Certificate verification failed (key-method 2)"); goto error; } - ks->authenticated = true; + ks->authenticated =KS_AUTH_TRUE ; }/* clear username and password from memory */ secure_memzero (up,sizeof (*up));/* Perform final authentication checks */ -if (ks->authenticated) +if (ks->authenticated !=KS_AUTH_FALSE ) {verify_final_auth_checks (multi, session); }
@@ -2673,7 +2673,7 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessioif (session->opt->ssl_flags &SSLF_OPT_VERIFY ) {msg (D_TLS_ERRORS ,"Option inconsistency warnings triggering disconnect due to --opt-verify" ); - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ; } }#endif
@@ -2684,13 +2684,14 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio* Call OPENVPN_PLUGIN_TLS_FINAL plugin if defined, for final * veto opportunity over authentication decision. */ -if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) +if ((ks->authenticated !=KS_AUTH_FALSE ) + &&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; + ks->authenticated =KS_AUTH_FALSE ; }setenv_del (session->opt->es,"exported_keying_material" );
@@ -3394,10 +3395,7 @@ tls_pre_decrypt(struct tls_multi *multi,*/ if (DECRYPT_KEY_ENABLED (multi, ks) && key_id == ks->key_id - && ks->authenticated -#ifdef ENABLE_DEF_AUTH - && !ks->auth_deferred -#endif + && (ks->authenticated ==KS_AUTH_TRUE ) && (floated ||link_socket_actual_match (from, &ks->remote_addr))) {if (!ks->crypto_options.key_ctx_bi.initialized)
@@ -3946,11 +3944,8 @@ tls_pre_encrypt(struct tls_multi *multi, {struct key_state *ks = multi->key_scan[i];if (ks->state >=S_ACTIVE - && ks->authenticated + && (ks->authenticated ==KS_AUTH_TRUE ) && ks->crypto_options.key_ctx_bi.initialized -#ifdef ENABLE_DEF_AUTH - && !ks->auth_deferred -#endif ) {if (!ks_select)
src/openvpn/ssl_common.h +7 -2
@@ -127,6 +127,12 @@ struct key_source2 {struct key_source server;/**< Random provided by server. */ }; +enum ks_auth_state { +KS_AUTH_FALSE , +KS_AUTH_TRUE , +KS_AUTH_DEFERRED +}; +/** * Security parameter state of one TLS and data channel %key session. * @ingroup control_processor
@@ -185,12 +191,11 @@ struct key_state/* * If bad username/password, TLS connection will come up but 'authenticated' will be false. */ -bool authenticated; +enum ks_auth_state authenticated;time_t auth_deferred_expire;#ifdef ENABLE_DEF_AUTH /* If auth_deferred is true, authentication is being deferred */ -bool auth_deferred;#ifdef MANAGEMENT_DEF_AUTH unsigned int mda_key_id;unsigned int mda_status;
src/openvpn/ssl_verify.c +14 -13
@@ -78,7 +78,7 @@ tls_deauthenticate(struct tls_multi *multi) {for (int j =0 ; j <KS_SIZE ; ++j) { - multi->session[i].key[j].authenticated = false; + multi->session[i].key[j].authenticated =KS_AUTH_FALSE ; } } }
@@ -950,7 +950,7 @@ tls_authentication_status(struct tls_multi *multi, const int latency)if (DECRYPT_KEY_ENABLED (multi, ks)) { active = true; -if (ks->authenticated) +if (ks->authenticated !=KS_AUTH_FALSE ) {#ifdef ENABLE_DEF_AUTH unsigned int s1 =ACF_DISABLED ;
@@ -967,7 +967,7 @@ tls_authentication_status(struct tls_multi *multi, const int latency)case ACF_SUCCEEDED :case ACF_DISABLED : success = true; - ks->auth_deferred = false; + ks->authenticated =KS_AUTH_TRUE ;break ;case ACF_UNDEFINED :
@@ -978,7 +978,7 @@ tls_authentication_status(struct tls_multi *multi, const int latency)break ;case ACF_FAILED : - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;break ;default :
@@ -1308,7 +1308,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,else {wipe_auth_token (multi); - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;msg (M_WARN ,"TLS: Username/auth-token authentication " "failed for username '%s'" , up->username);return ;
@@ -1354,17 +1354,17 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,#endif && tls_lock_username(multi, up->username)) { - ks->authenticated = true; + ks->authenticated =KS_AUTH_TRUE ;#ifdef PLUGIN_DEF_AUTH if (s1 ==OPENVPN_PLUGIN_FUNC_DEFERRED ) { - ks->auth_deferred = true; + ks->authenticated =KS_AUTH_DEFERRED ; }#endif #ifdef MANAGEMENT_DEF_AUTH if (man_def_auth !=KMDA_UNDEF ) { - ks->auth_deferred = true; + ks->authenticated =KS_AUTH_DEFERRED ; }#endif if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ))
@@ -1416,7 +1416,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi, }#ifdef ENABLE_DEF_AUTH msg (D_HANDSHAKE ,"TLS: Username/Password authentication %s for username '%s' %s" , - ks->auth_deferred ?"deferred" :"succeeded" , + (ks->authenticated ==KS_AUTH_DEFERRED ) ?"deferred" :"succeeded" , up->username, (session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) ?"[CN SET]" :"" );#else
@@ -1428,6 +1428,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi, }else { + ks->authenticated =KS_AUTH_FALSE ;msg (D_TLS_ERRORS ,"TLS Auth Error: Auth Username/Password verification failed for peer" ); } }
@@ -1444,7 +1445,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) }/* Don't allow the CN to change once it's been locked */ -if (ks->authenticated && multi->locked_cn) +if (ks->authenticated !=KS_AUTH_FALSE && multi->locked_cn) {const char *cn = session->common_name;if (cn &&strcmp (cn, multi->locked_cn))
@@ -1460,7 +1461,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) }/* Don't allow the cert hashes to change once they have been locked */ -if (ks->authenticated && multi->locked_cert_hash_set) +if (ks->authenticated !=KS_AUTH_FALSE && multi->locked_cert_hash_set) {const struct cert_hash_set *chs = session->cert_hash_set;if (chs && !cert_hash_compare (chs, multi->locked_cert_hash_set))
@@ -1474,7 +1475,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) }/* verify --client-config-dir based authentication */ -if (ks->authenticated && session->opt->client_config_dir_exclusive) +if (ks->authenticated !=KS_AUTH_FALSE && session->opt->client_config_dir_exclusive) {struct gc_arena gc =gc_new ();
@@ -1483,7 +1484,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) cn, &gc);if (!cn || !strcmp (cn,CCD_DEFAULT ) || !platform_test_file (path)) { - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;wipe_auth_token (multi); msg(D_TLS_ERRORS, "TLS Auth Error: --client-config-dir authentication failed for common name '%s' file='%s'", session->common_name,
Signature · 1 line
2.26.2
Re: [Openvpn-devel] [PATCH 2/2] merge key_state->authenticated and key_state->auth_deferred
Hi,
Thanks for taking one more step towards simplifying this state jungle..
Quoted 124 lines · Arne Schwabe
Both are tightly coupled often both are checked at the same time. Merging them into one state makes the code simpler and also brings us closer in the direction of a state machine
Signed-off-by Arne Schwabe <[email protected]...>--- src/openvpn/ssl.c | 29 ++++++++++++----------------- src/openvpn/ssl_common.h | 9 +++++++-- src/openvpn/ssl_verify.c | 27 ++++++++++++++------------- 3 files changed, 33 insertions(+), 32 deletions(-)src/openvpn/ssl.c +12
-17@@ -1930,7 +1930,7 @@ tls_session_generate_data_channel_keys(struct tls_session *session)const struct session_id *server_sid = !session->opt->server ? &ks->session_id_remote : &session->session_id; -if (!ks->authenticated) +if (ks->authenticated ==KS_AUTH_FALSE ) {msg (D_TLS_ERRORS ,"TLS Error: key_state not authenticated" ); goto cleanup;@@ -2466,7 +2466,7 @@ key_method_2_write(struct buffer *buf, struct tls_session *session)if (session->opt->server && !(session->opt->ncp_enabled && session->opt->mode ==MODE_SERVER && ks->key_id <=0 )) { -if (ks->authenticated) +if (ks->authenticated !=KS_AUTH_FALSE ) {if (!tls_session_generate_data_channel_keys (session)) {@@ -2536,7 +2536,7 @@ key_method_1_read(struct buffer *buf, struct tls_session *session) &session->opt->key_type,OPENVPN_OP_DECRYPT , "Data Channel Decrypt");secure_memzero (&key,sizeof (key)); - ks->authenticated = true; + ks->authenticated =KS_AUTH_TRUE ;return true; error:@@ -2594,7 +2594,7 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio goto error; } - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;/* always extract username + password fields from buf, even if not * authenticating for it, because otherwise we can't get at the @@ -2652,14 +2652,14 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio "TLS Error: Certificate verification failed (key-method 2)"); goto error; } - ks->authenticated = true; + ks->authenticated =KS_AUTH_TRUE ; }/* clear username and password from memory */ secure_memzero (up,sizeof (*up));/* Perform final authentication checks */ -if (ks->authenticated) +if (ks->authenticated !=KS_AUTH_FALSE ) {verify_final_auth_checks (multi, session); }@@ -2673,7 +2673,7 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessioif (session->opt->ssl_flags &SSLF_OPT_VERIFY ) {msg (D_TLS_ERRORS ,"Option inconsistency warnings triggering disconnect due to --opt-verify" ); - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ; } }#endif @@ -2684,13 +2684,14 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio* Call OPENVPN_PLUGIN_TLS_FINAL plugin if defined, for final * veto opportunity over authentication decision. */ -if (ks->authenticated &&plugin_defined (session->opt->plugins,OPENVPN_PLUGIN_TLS_FINAL )) +if ((ks->authenticated !=KS_AUTH_FALSE ) + &&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; + ks->authenticated =KS_AUTH_FALSE ; }setenv_del (session->opt->es,"exported_keying_material" );@@ -3394,10 +3395,7 @@ tls_pre_decrypt(struct tls_multi *multi,*/ if (DECRYPT_KEY_ENABLED (multi, ks) && key_id == ks->key_id - && ks->authenticated -#ifdef ENABLE_DEF_AUTH - && !ks->auth_deferred -#endif + && (ks->authenticated ==KS_AUTH_TRUE ) && (floated ||link_socket_actual_match (from, &ks->remote_addr))) {if (!ks->crypto_options.key_ctx_bi.initialized)@@ -3946,11 +3944,8 @@ tls_pre_encrypt(struct tls_multi *multi, {struct key_state *ks = multi->key_scan[i];if (ks->state >=S_ACTIVE - && ks->authenticated + && (ks->authenticated ==KS_AUTH_TRUE ) && ks->crypto_options.key_ctx_bi.initialized -#ifdef ENABLE_DEF_AUTH - && !ks->auth_deferred -#endif ) {if (!ks_select)src/openvpn/ssl_common.h +0
-0
src/openvpn/ssl_common.h struct key_source2 { · line 133
Quoted 7 lines
src/openvpn/ssl_common.h +4
-0@@ -127,6 +127,12 @@ struct key_source2 {struct key_source server;/**< Random provided by server. */ }; +enum ks_auth_state { +KS_AUTH_FALSE , +KS_AUTH_TRUE , +KS_AUTH_DEFERRED
how about wrapping KS_AUTH_DEFERRED within #ifdef ENABLE_DEF_AUTH for now? This way we have a way to make sure this value is not used outside of the ENABLE_DEF_AUTH context.
If the long term goal is to remove this define once and for all, I'd suggest to then have a patch that removes all the instances. Or at least to have a specific patch targeting that aspect.
Quoted 6 lines
src/openvpn/ssl_common.h +2
-0+}; +/** * Security parameter state of one TLS and data channel %key session. * @ingroup control_processor
src/openvpn/ssl_common.h struct key_state · line 198
Quoted 9 lines
src/openvpn/ssl_common.h +1
-1@@ -185,12 +191,11 @@ struct key_state/* * If bad username/password, TLS connection will come up but 'authenticated' will be false. */ -bool authenticated; +enum ks_auth_state authenticated;time_t auth_deferred_expire;#ifdef ENABLE_DEF_AUTH /* If auth_deferred is true, authentication is being deferred */
should this comment also go?
Quoted 84 lines
src/openvpn/ssl_common.h +0
-1-bool auth_deferred;#ifdef MANAGEMENT_DEF_AUTH unsigned int mda_key_id;unsigned int mda_status;src/openvpn/ssl_verify.c +9
-9@@ -78,7 +78,7 @@ tls_deauthenticate(struct tls_multi *multi) {for (int j =0 ; j <KS_SIZE ; ++j) { - multi->session[i].key[j].authenticated = false; + multi->session[i].key[j].authenticated =KS_AUTH_FALSE ; } } }@@ -950,7 +950,7 @@ tls_authentication_status(struct tls_multi *multi, const int latency)if (DECRYPT_KEY_ENABLED (multi, ks)) { active = true; -if (ks->authenticated) +if (ks->authenticated !=KS_AUTH_FALSE ) {#ifdef ENABLE_DEF_AUTH unsigned int s1 =ACF_DISABLED ;@@ -967,7 +967,7 @@ tls_authentication_status(struct tls_multi *multi, const int latency)case ACF_SUCCEEDED :case ACF_DISABLED : success = true; - ks->auth_deferred = false; + ks->authenticated =KS_AUTH_TRUE ;break ;case ACF_UNDEFINED :@@ -978,7 +978,7 @@ tls_authentication_status(struct tls_multi *multi, const int latency)break ;case ACF_FAILED : - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;break ;default :@@ -1308,7 +1308,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,else {wipe_auth_token (multi); - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;msg (M_WARN ,"TLS: Username/auth-token authentication " "failed for username '%s'" , up->username);return ;@@ -1354,17 +1354,17 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,#endif && tls_lock_username(multi, up->username)) { - ks->authenticated = true; + ks->authenticated =KS_AUTH_TRUE ;#ifdef PLUGIN_DEF_AUTH if (s1 ==OPENVPN_PLUGIN_FUNC_DEFERRED ) { - ks->auth_deferred = true; + ks->authenticated =KS_AUTH_DEFERRED ; }#endif #ifdef MANAGEMENT_DEF_AUTH if (man_def_auth !=KMDA_UNDEF ) { - ks->auth_deferred = true; + ks->authenticated =KS_AUTH_DEFERRED ; }#endif if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ))@@ -1416,7 +1416,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi, }#ifdef ENABLE_DEF_AUTH msg (D_HANDSHAKE ,"TLS: Username/Password authentication %s for username '%s' %s" , - ks->auth_deferred ?"deferred" :"succeeded" , + (ks->authenticated ==KS_AUTH_DEFERRED ) ?"deferred" :"succeeded" , up->username, (session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) ?"[CN SET]" :"" );#else
src/openvpn/ssl_verify.c verify_user_pass(struct user_pass *up, struct tls_multi *multi, · line 1431
Quoted 4 lines
src/openvpn/ssl_verify.c +1
-0@@ -1428,6 +1428,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi, }else { + ks->authenticated =KS_AUTH_FALSE ;
Previously there was no code here doing anything like this. Is this line actually fixing a bug? Or why is being added?
Since this patch is just about merging the two members, I'd stick with it and avoid adding other changes that may introduce their own issue, no?
I'd personally keep this line for its own patch, coming with a proper explanation as to why that is needed.
Quoted 32 lines
src/openvpn/ssl_verify.c +3
-3msg (D_TLS_ERRORS ,"TLS Auth Error: Auth Username/Password verification failed for peer" ); } }@@ -1444,7 +1445,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) }/* Don't allow the CN to change once it's been locked */ -if (ks->authenticated && multi->locked_cn) +if (ks->authenticated !=KS_AUTH_FALSE && multi->locked_cn) {const char *cn = session->common_name;if (cn &&strcmp (cn, multi->locked_cn))@@ -1460,7 +1461,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) }/* Don't allow the cert hashes to change once they have been locked */ -if (ks->authenticated && multi->locked_cert_hash_set) +if (ks->authenticated !=KS_AUTH_FALSE && multi->locked_cert_hash_set) {const struct cert_hash_set *chs = session->cert_hash_set;if (chs && !cert_hash_compare (chs, multi->locked_cert_hash_set))@@ -1474,7 +1475,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) }/* verify --client-config-dir based authentication */ -if (ks->authenticated && session->opt->client_config_dir_exclusive) +if (ks->authenticated !=KS_AUTH_FALSE && session->opt->client_config_dir_exclusive) {struct gc_arena gc =gc_new ();
src/openvpn/ssl_verify.c verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) · line 1490
Quoted 8 lines
src/openvpn/ssl_verify.c +1
-1@@ -1483,7 +1484,7 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session) cn, &gc);if (!cn || !strcmp (cn,CCD_DEFAULT ) || !platform_test_file (path)) { - ks->authenticated = false; + ks->authenticated =KS_AUTH_FALSE ;wipe_auth_token (multi); msg(D_TLS_ERRORS, "TLS Auth Error: --client-config-dir authentication failed for common name '%s' file='%s'", session->common_name,
The rest looks good, but can't ACK as it is.
Regards,
Signature · 1 line
Antonio Quartulli
[Openvpn-devel] [PATCH applied] Re: merge key_state->authenticated and key_state->auth_deferred
In reply to Arne SchwabeI merged this somewhat by accident, so apologies for the confusion - I am *not* ignoring Antonio's and Steffan's comments for improvement of this patch, but I had my trees mixed up from testing, and it got pushed out with the "writepid" patch of today by accident.
So:
Stared-at-code (looks very reasonable), ran through the t_server test suite which does "normal" and "async auth" (15s delay in plugin-auth-pam) and it passes all tests.
Your patch has been applied to the master branch.
commit a5e6f2d217309969a835f21b73b4dc0fbc70c4aa
Author: Arne Schwabe Date: Mon Jul 6 18:35:16 2020 +0200
merge key_state->authenticated and key_state->auth_deferred
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg20216.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Gert Doering
NAKHi,
Quoted 5 lines · Arne Schwabe
The logic if we already have seen a push request is still correct/useful without async push. I am not entirely sure if also deferred management authentication can trigger this code path but it should be able to. The other benefit is removing a number of ifdefs.
NAK.
In combination with async-auth (plugin) this triggers some sort of key inconsistency - the client does get the proper PUSH_REPLY, but key state is kaput
...
Jul 6 20:41:30 gentoo openvpn[32657]: PLUGIN AUTH-PAM: BACKGROUND: name match found, query/match-string ['Password: ', 'Password:'] = 'PASSWORD' Jul 6 20:41:30 gentoo openvpn[32657]: PLUGIN AUTH-PAM: BACKGROUND: fbsd-tc-master: deferred auth: PAM succeeded Jul 6 20:41:32 gentoo tun-udp-p2mp-global-authpam[31884]: MULTI_sva: pool returned IPv4=194.97.145.74, IPv6=2001:608:3:814::1000 Jul 6 20:41:32 gentoo tun-udp-p2mp-global-authpam[31884]: OPTIONS IMPORT: reading client specific options from: /tmp/openvpn_cc_6f7cfcfda4cb5ecf1366685a7270c804.tmp Jul 6 20:41:32 gentoo tun-udp-p2mp-global-authpam[31884]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_REPLY,route 10.204.0.0 255.255.0.0,route-ipv6 fd00:abcd:204::/48,tun-ipv6,route-gateway 194.97.145.73,topology subnet,ping 10,ping-restart 30,compress lz4,ifconfig-ipv6 2001:608:3:814::1000/64 2001:608:3:814::1,ifconfig 194.97.145.74 255.255.255.248,peer-id 0,cipher AES-256-GCM' (status=1) Jul 6 20:41:32 gentoo tun-udp-p2mp-global-authpam[31884]: cron2-freebsd-tc-amd64/2001:608:0:814::f000:21 PUSH: Received control message: 'PUSH_REQUEST' Jul 6 20:41:32 gentoo tun-udp-p2mp-global-authpam[31884]: cron2-freebsd-tc-amd64/2001:608:0:814::f000:21 Key [AF_INET6]2001:608:0:814::f000:21:51780 [0] not initialized (yet), dropping packet.
"I was about to ACK-and-merge this"... but it's reproduceable, async auth (without --async-push) is broken with this patch.
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Am 06.07.20 um 20:43 schrieb Gert Doering:
Quoted 9 lines
Hi,
Quoted 5 lines · Arne Schwabe
The logic if we already have seen a push request is still correct/useful without async push. I am not entirely sure if also deferred management authentication can trigger this code path but it should be able to. The other benefit is removing a number of ifdefs.
Quoted 5 lines
NAK.
In combination with async-auth (plugin) this triggers some sort of key inconsistency - the client does get the proper
PUSH_REPLY, but key state is kaput
I will double check the patch but this might be that this code path is broken with async push too, when you do write status to file and do not close but wait for openvpn to pick up the state itself.
Arne