| Message ID | 20221010071229.7935-1-gert@greenie.muc.de |
|---|---|
| State | Rejected |
| Delegated to: | Arne Schwabe |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director14.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 6P4NJCvGQ2MtDwAAIUCqbw (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Mon, 10 Oct 2022 03:13:47 -0400 Received: from proxy1.mail.iad3b.rsapps.net ([172.31.255.6]) by director14.mail.ord1d.rsapps.net with LMTP id aEbOIyvGQ2PvDgAAeJ7fFg (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Mon, 10 Oct 2022 03:13:47 -0400 Received: from smtp28.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.iad3b.rsapps.net with LMTPS id 2BbvHCvGQ2MTJQAALM5PBw (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Mon, 10 Oct 2022 03:13:47 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp28.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=greenie.muc.de X-Suspicious-Flag: YES X-Classification-ID: 14a36806-486b-11ed-96ce-525400c8cd63-1-1 Received: from [216.105.38.7] ([216.105.38.7:52596] helo=lists.sourceforge.net) by smtp28.gate.iad3b.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id D8/FC-19282-A26C3436; Mon, 10 Oct 2022 03:13:47 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1ohmxz-00085D-CN; Mon, 10 Oct 2022 07:12:47 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from <gert@gentoo.ov.greenie.net>) id 1ohmxx-000857-1T for openvpn-devel@lists.sourceforge.net; Mon, 10 Oct 2022 07:12:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WkXjUit3lVIyPmrqLU4tYM5HzlbH/EBz6qu6fEPMdLg=; b=XxIuc4ogoOI0nXTWKFgURZQ7GF biJjMdNHDwCXqLP9IdGZbjA3Kv+7PC31+lheZ2HoEP36F0R+FhlfGBsJPDFihlo3Q2xSVssXq9fVr gFgpUxIQ+XKsR/3WmuxCxjdSWtwyM6QjcEHo7MoS2LDnsvkX2RAI+WyeMOXLfGnPnkOU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=WkXjUit3lVIyPmrqLU4tYM5HzlbH/EBz6qu6fEPMdLg=; b=Q nsuqgEJCWPGsRSAhExxSsE2/7vYtDQv2LO5xL74x8QyiHWgVPE0EweVMD0GN/3rEH8nUa4HTxtz0d T59Ms0XnBzhlyXFi+yCsZ1hGBGTQLgym4CmXLsffc0YmHUyhxkO5N8RQaRww/GQ7tbDH2oD1/ApCg oGvNo2L17dP2pVY4=; Received: from vmail1.greenie.net ([195.30.8.66]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1ohmxr-0000EK-8p for openvpn-devel@lists.sourceforge.net; Mon, 10 Oct 2022 07:12:44 +0000 Received: from gentoo.ov.greenie.net (gentoo.ov.greenie.net [IPv6:2001:608:0:814:0:0:f000:11]) by vmail1.greenie.net (8.17.1/8.16.1) with SMTP id 29A7CTLh084288 for <openvpn-devel@lists.sourceforge.net>; Mon, 10 Oct 2022 09:12:29 +0200 (CEST) Received: (nullmailer pid 7944 invoked by uid 1000); Mon, 10 Oct 2022 07:12:29 -0000 From: Gert Doering <gert@greenie.muc.de> To: openvpn-devel@lists.sourceforge.net Date: Mon, 10 Oct 2022 09:12:29 +0200 Message-Id: <20221010071229.7935-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.4 (vmail1.greenie.net [IPv6:2001:608:1:995a:20c:29ff:feb8:10eb]); Mon, 10 Oct 2022 09:12:29 +0200 (CEST) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We do not permit username changes on renegotiation (= username is "locked" after successful initial authentication). Unfortunately the way this is written this gets in the way of using auth-user-pass-optional + pushing "auth-token-user" from client-connect (and most likely also "from management") because we'll lock [...] Content analysis details: (-2.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.30.8.66 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-Headers-End: 1ohmxr-0000EK-8p Subject: [Openvpn-devel] [PATCH] TLS: do not lock empty usernames X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] TLS: do not lock empty usernames
|
|
Commit Message
Gert Doering
Oct. 9, 2022, 8:12 p.m. UTC
We do not permit username changes on renegotiation (= username is
"locked" after successful initial authentication).
Unfortunately the way this is written this gets in the way of using
auth-user-pass-optional + pushing "auth-token-user" from client-connect
(and most likely also "from management") because we'll lock an empty
username, and on renegotiation, refuse the client with
TLS Auth Error: username attempted to change from
'' to 'MyTokenUser' -- tunnel disabled
Fix: extend "is username a valid pointer" to "... and points to a
non-empty string" before locking.
---
src/openvpn/ssl_verify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi, On 10/10/2022 09:12, Gert Doering wrote: > We do not permit username changes on renegotiation (= username is > "locked" after successful initial authentication). > > Unfortunately the way this is written this gets in the way of using > auth-user-pass-optional + pushing "auth-token-user" from client-connect > (and most likely also "from management") because we'll lock an empty > username, and on renegotiation, refuse the client with > > TLS Auth Error: username attempted to change from > '' to 'MyTokenUser' -- tunnel disabled > > Fix: extend "is username a valid pointer" to "... and points to a > non-empty string" before locking. > --- > src/openvpn/ssl_verify.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c > index 76cb9f19..4206cf9c 100644 > --- a/src/openvpn/ssl_verify.c > +++ b/src/openvpn/ssl_verify.c > @@ -166,7 +166,7 @@ tls_lock_username(struct tls_multi *multi, const char *username) > } > else > { > - if (username) > + if (username && *username) super uber nitpick (bike shadding level): I think in other places we perform the very same check using the format: username[0] instead of *username. That's because username is a sequence of chars, therefore it is a bit more logical for our brains to "check the first character in the sequence" rather than "dereference this pointer". [or if we want to go the clean way, we should use strlen() == 0, but I understand that may be overkill] my 3 cents. Cheers, > { > multi->locked_username = string_alloc(username, NULL); > }
Hi, On Mon, Oct 10, 2022 at 10:00:37AM +0200, Antonio Quartulli wrote: > > - if (username) > > + if (username && *username) > > super uber nitpick (bike shadding level): > > I think in other places we perform the very same check using the format: > username[0] instead of *username. I can adjust that in a v2, but first I need to hear what Arne thinks about this - it's all his code, so I want to be sure that this is not introducing unexpected side effects. gert
Hi, On Mon, Oct 10, 2022 at 3:14 AM Gert Doering <gert@greenie.muc.de> wrote: > We do not permit username changes on renegotiation (= username is > "locked" after successful initial authentication). > > Unfortunately the way this is written this gets in the way of using > auth-user-pass-optional + pushing "auth-token-user" from client-connect > (and most likely also "from management") because we'll lock an empty > username, and on renegotiation, refuse the client with > Why is it not okay to support change of username?. I have a situation where username change looks legitimate: With our new PLAP (start from login screen) and "persistent connection" support on Windows, a connection may be started by one user and then "renegotiated" by another who may enter a different username and password from the initial connection (say auth-nocache or 2FA is in use). In this case, the server will disable the tunnel (username tried to change), the client will retry asking the user for username/password input again. On inputting the same credentials a second time, the connection will succeed. This leads to poor UX. If we can conjure up usernames (like with empty --> token-user) why not allow other username changes too? Selva
Am 19.10.2022 um 01:01 schrieb Selva Nair: > Hi, > > On Mon, Oct 10, 2022 at 3:14 AM Gert Doering <gert@greenie.muc.de> wrote: > > We do not permit username changes on renegotiation (= username is > "locked" after successful initial authentication). > > Unfortunately the way this is written this gets in the way of using > auth-user-pass-optional + pushing "auth-token-user" from > client-connect > (and most likely also "from management") because we'll lock an empty > username, and on renegotiation, refuse the client with > > > Why is it not okay to support change of username?. I have a situation > where username change looks legitimate: > > With our new PLAP (start from login screen) and "persistent > connection" support on Windows, > a connection may be started by one user and then "renegotiated" by > another who may enter > a different username and password from the initial connection (say > auth-nocache or 2FA > is in use). > > In this case, the server will disable the tunnel (username tried to > change), the client will retry > asking the user for username/password input again. On inputting the > same credentials a > second time, the connection will succeed. This leads to poor UX. > > If we can conjure up usernames (like with empty --> token-user) why > not allow other username > changes too? In general the current authentication system in OpenVPN is ill equipped to handle them. On renegotiation we only do auth but no read in ccd or other other user specific data. So allowing a username change could in many instances give the new user the permissions/IP etc of the old user. There can be situations where this is okay and we can add options or auth results that explicitly allow. In general a username change probably leads authorisation problems. For the auth-token-user the idea there is that you get a username on the first auth assigned that you should use in the future but no actual user change. Arne
On Wed, Oct 19, 2022 at 1:05 AM Arne Schwabe <arne@rfc2549.org> wrote: > > > If we can conjure up usernames (like with empty --> token-user) why not > allow other username > changes too? > > In general the current authentication system in OpenVPN is ill equipped to > handle them. On renegotiation we only do auth but no read in ccd or other > other user specific data. So allowing a username change could in many > instances give the new user the permissions/IP etc of the old user. There > can be situations where this is okay and we can add options or auth results > that explicitly allow. In general a username change probably leads > authorisation problems. For the auth-token-user the idea there is that you > get a username on the first auth assigned that you should use in the future > but no actual user change. > That makes a lot of sense. Even I have setups where what is pushed to the client depends on the username in addition to the commonname. This has implications when we have interactively authenticated, but long running connections which multiple users may be able to use though it will appear to be associated with one user from the server's pov (so-called Persistent connections in Windows GUI). Same with PLAP. Requiring a new tunnel on user name change alleviates this a bit, but still there will be a duration until next reauth or token expiry when userA is using a tunnel started by userB. Instead of wading into an OT discussion, I will raise this issue elsewhere / a new thread Selva
Hi, On Mon, Oct 10, 2022 at 09:12:29AM +0200, Gert Doering wrote: > We do not permit username changes on renegotiation (= username is > "locked" after successful initial authentication). > > Unfortunately the way this is written this gets in the way of using > auth-user-pass-optional + pushing "auth-token-user" from client-connect > (and most likely also "from management") because we'll lock an empty > username, and on renegotiation, refuse the client with > > TLS Auth Error: username attempted to change from > '' to 'MyTokenUser' -- tunnel disabled > > Fix: extend "is username a valid pointer" to "... and points to a > non-empty string" before locking. FTR, this patch was superseded by Arne's "--override-username" patch which just now landed in master. commit ebd433bd1e40917793903f76883d114d820e992d Author: Arne Schwabe <arne@rfc2549.org> Date: Tue Mar 11 16:59:04 2025 +0100 Implement override-username Also FTR, this is also https://github.com/OpenVPN/openvpn/issues/299 gert
diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index 76cb9f19..4206cf9c 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -166,7 +166,7 @@ tls_lock_username(struct tls_multi *multi, const char *username) } else { - if (username) + if (username && *username) { multi->locked_username = string_alloc(username, NULL); }