From patchwork Wed Sep 30 03:13:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1498 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id wI5rExqLdF++RwAAIUCqbw (envelope-from ) for ; Wed, 30 Sep 2020 09:41:46 -0400 Received: from proxy2.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id WEJDExqLdF+0HgAApN4f7A (envelope-from ) for ; Wed, 30 Sep 2020 09:41:46 -0400 Received: from smtp1.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.ord1d.rsapps.net with LMTPS id sCfPEhqLdF/LNAAAfawv4w (envelope-from ) for ; Wed, 30 Sep 2020 09:41:46 -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: smtp1.gate.ord1d.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=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: ae0f0a44-0322-11eb-bc8f-5254002d775b-1-1 Received: from [216.105.38.7] ([216.105.38.7:41852] helo=lists.sourceforge.net) by smtp1.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id AF/47-23346-91B847F5; Wed, 30 Sep 2020 09:41:45 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kNcLo-0002qa-Uj; Wed, 30 Sep 2020 13:40:56 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNcLm-0002qL-6B for openvpn-devel@lists.sourceforge.net; Wed, 30 Sep 2020 13:40:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=R2QQqX7QO5r53BBJDAKgW+EaDc0L7DMUOzoso5JOtiE=; b=FrzeX+iVi1X6+yTu38PYywg2Aw BGp9NDCd39mG9fFoqKXCyVho9/pVP4QkAQu1DOHbPtGpaydDFwqeSEL9k/FZ7jA2IBMBWKj6wV1Af 2qN20lBPmF7IpTv5Y9uhoEISxYdD+eMRFtOOFBdsS4gohqYCx36Gp6+2ihXlTBhgL3iY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=R2QQqX7QO5r53BBJDAKgW+EaDc0L7DMUOzoso5JOtiE=; b=BS5BxhftVIRrgPnuH5sQ3/y4bV gFEeeSP4n3+eKbLbYr+2AcMgI5cEXcCjSuCEQMqmD5tZ8tJuYF4udSz2+R+P0Q9JKsznQsdi7Qr51 tmkQiWfpEToOixups85BU4avMG3JpMYBR1qo3EZvMIyIRqNkCeo6YGVdafPRZkBCzaZ4=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kNcLd-00EQEQ-2U for openvpn-devel@lists.sourceforge.net; Wed, 30 Sep 2020 13:40:54 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1kNbv4-0003nx-Ey for openvpn-devel@lists.sourceforge.net; Wed, 30 Sep 2020 15:13:18 +0200 Received: (nullmailer pid 1364 invoked by uid 10006); Wed, 30 Sep 2020 13:13:18 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 30 Sep 2020 15:13:10 +0200 Message-Id: <20200930131317.1299-6-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200930131317.1299-1-arne@rfc2549.org> References: <20200930131317.1299-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 0.0 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 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1kNcLd-00EQEQ-2U Subject: [Openvpn-devel] [PATCH 04/11] Introduce management client state for AUTH_PENDING notifications X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox This allows a UI client to display the correct state. Technically the client is still waiting for PUSH_REPLY but for every practical concern this is a different state as we are waiting for the pending authentication to finish. Signed-off-by: Arne Schwabe Acked-by: Lev Stipakov --- src/openvpn/manage.c | 3 +++ src/openvpn/manage.h | 2 ++ src/openvpn/push.c | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 8df60d7a..58ff0155 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -171,6 +171,9 @@ man_state_name(const int state) case OPENVPN_STATE_TCP_CONNECT: return "TCP_CONNECT"; + case OPENVPN_STATE_AUTH_PENDING: + return "AUTH_PENDING"; + default: return "?"; } diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index 1c497427..1681e141 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -506,6 +506,8 @@ management_enable_def_auth(const struct management *man) #define OPENVPN_STATE_GET_CONFIG 9 /* Downloading configuration from server */ #define OPENVPN_STATE_RESOLVE 10 /* DNS lookup */ #define OPENVPN_STATE_TCP_CONNECT 11 /* Connecting to TCP server */ +#define OPENVPN_STATE_AUTH_PENDING 12 /* Waiting in auth-pending mode + * techhnically variant of GET_CONFIG */ #define OPENVPN_STATE_CLIENT_BASE 7 /* Base index of client-only states */ diff --git a/src/openvpn/push.c b/src/openvpn/push.c index ece63650..59f8f33c 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -248,12 +248,30 @@ parse_auth_pending_keywords(const struct buffer *buffer, if (!buf_advance(&buf, strlen("AUTH_PENDING")) || !(buf_read_u8(&buf) == ',') || !BLEN(&buf)) { +#ifdef ENABLE_MANAGEMENT + if (management) + { + management_set_state(management, OPENVPN_STATE_AUTH_PENDING, + "", NULL, NULL, NULL, NULL); + } +#endif + return; } /* parse the keywords in the same way that push options are parsed */ char line[OPTION_LINE_SIZE]; +#ifdef ENABLE_MANAGEMENT + /* Need to do the management notification with the keywords before + * buf_parse is called, as it will insert \0 bytes into the buffer */ + if (management) + { + management_set_state(management, OPENVPN_STATE_AUTH_PENDING, + BSTR(&buf), NULL, NULL, NULL, NULL); + } +#endif + while (buf_parse(&buf, ',', line, sizeof(line))) { if (sscanf(line, "timeout %u", server_timeout) == 1)