From: Selva Nair Date: Wed, 26 Oct 2022 18:55:43 +0000 (-0400) Subject: Purge auth-token as well while purging passwords X-Git-Tag: v2.6_beta1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecad4839caf4c2fab9c6627ceeca9b9cb32e8929;p=thirdparty%2Fopenvpn.git Purge auth-token as well while purging passwords Starting from commit e61b401a auth-token is saved in a separate struct from auth-user-pass and is not cleared when ssl_purge_auth() is called. This makes "forget-passwords" sent to the management interface or "--management-forget-disconnect" option not to work as expected. Purging caused by --auth-nocache is not affected (auth-token is retained in that case as it should be). Use case: For Pre-Logon access and persistent connections on Windows, use of "forget-passwords" before disconnect is probably the only way to ensure that no credentials are left behind. Note that openvpn.exe continues to run after disconnect in these cases. Also, the original intent of "forget-passwords" appears to be to clear all "passwords" that can be used to reconnect. v2: - call ssl_clean_auth_token() directly from manage.c instead of amending ssl_purge_auth() - Add a comment that ssl_purge_auth() does not clear auth-token Signed-off-by: Selva Nair Acked-by: Gert Doering Message-Id: <20221026185543.5378-1-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25460.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 5670e594e..5b288eab8 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -762,6 +762,7 @@ static void man_forget_passwords(struct management *man) { ssl_purge_auth(false); + (void)ssl_clean_auth_token(); msg(M_CLIENT, "SUCCESS: Passwords were forgotten"); } @@ -1922,6 +1923,7 @@ man_reset_client_socket(struct management *man, const bool exiting) if (man->settings.flags & MF_FORGET_DISCONNECT) { ssl_purge_auth(false); + (void)ssl_clean_auth_token(); } if (man->settings.flags & MF_SIGNAL) diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index 96de9ccc8..02046b7fa 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -390,6 +390,7 @@ void ssl_set_auth_nocache(void); /* * Purge any stored authentication information, both for key files and tunnel * authentication. If PCKS #11 is enabled, purge authentication for that too. + * Note that auth_token is not cleared. */ void ssl_purge_auth(const bool auth_user_pass_only);