From patchwork Sat Nov 9 04:13:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 893 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.27.255.50]) by backend30.mail.ord1d.rsapps.net with LMTP id +GxxFczXxl1kNQAAIUCqbw for ; Sat, 09 Nov 2019 10:14:20 -0500 Received: from proxy3.mail.iad3a.rsapps.net ([172.27.255.50]) by director10.mail.ord1d.rsapps.net with LMTP id OCo6E8zXxl01KwAApN4f7A ; Sat, 09 Nov 2019 10:14:20 -0500 Received: from smtp28.gate.iad3a ([172.27.255.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.iad3a.rsapps.net with LMTP id 6GmbDczXxl1PbwAAYaqY3Q ; Sat, 09 Nov 2019 10:14:20 -0500 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.iad3a.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: 99bdbd30-0303-11ea-8b81-52540000591c-1-1 Received: from [216.105.38.7] ([216.105.38.7:47788] helo=lists.sourceforge.net) by smtp28.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 56/2F-10228-BC7D6CD5; Sat, 09 Nov 2019 10:14:19 -0500 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1iTSQR-0005y2-Hq; Sat, 09 Nov 2019 15:13:19 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iTSQQ-0005xK-4p for openvpn-devel@lists.sourceforge.net; Sat, 09 Nov 2019 15:13:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3KcpU2X2tEPlz+2EgzVv/Tg/im/3KpLz2rN1JcZY1nY=; b=VMUAHhlO9FVK3vIVsQuTfXqlKO Q+960Iq8eD1Qn/VTLG4D5L+xl7pKtHKHFrP5c986g61gZDpxx3SAz8ZuiHa9Y3QQ1jwYxeHxrn0xO P3LXY5nrG7LT1Lo2VqJpczmwmsCRcKPpB2dkXemeUf1mWFJvbifHw/6hXv0rxzazM8vQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3KcpU2X2tEPlz+2EgzVv/Tg/im/3KpLz2rN1JcZY1nY=; b=QK0u3pspUkanAgmBBYTGdqM6t6 wRB0tllA8hVA2qgIveZFamZwGkVwVMGBt02hL5TE5PpqN0HCz9PK7suHvfVrZHhKg86X214sTAqox /Qyz4Mogf2gPmkM/OI1qIJnjKcWrSN3uJ7RATNcn/rRYfXPPb9Fmv/d4Os0AxXKzkAcg=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1iTSQL-009bCa-EU for openvpn-devel@lists.sourceforge.net; Sat, 09 Nov 2019 15:13:18 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1iTSQE-000Q02-Pn for openvpn-devel@lists.sourceforge.net; Sat, 09 Nov 2019 16:13:06 +0100 Received: (nullmailer pid 18644 invoked by uid 10006); Sat, 09 Nov 2019 15:13:06 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Sat, 9 Nov 2019 16:13:02 +0100 Message-Id: <20191109151306.18597-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 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 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1iTSQL-009bCa-EU Subject: [Openvpn-devel] [PATCH v2 1/5] Implement parsing and sending INFO and INFO_PRE control messages 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 OpenVPN 3 implements these messages to send information during the authentication to the UI, implement these message also in OpenVPN 2.x Signed-off-by: Arne Schwabe Acked-By: David Sommerseth --- src/openvpn/forward.c | 8 ++++++++ src/openvpn/push.c | 33 +++++++++++++++++++++++++++++++++ src/openvpn/push.h | 3 +++ 3 files changed, 44 insertions(+) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 8451706b..0f735384 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -395,6 +395,14 @@ check_incoming_control_channel_dowork(struct context *c) { server_pushed_signal(c, &buf, false, 4); } + else if (buf_string_match_head_str(&buf, "INFO_PRE")) + { + server_pushed_info(c, &buf, 8); + } + else if (buf_string_match_head_str(&buf, "INFO")) + { + server_pushed_info(c, &buf, 4); + } else { msg(D_PUSH_ERRORS, "WARNING: Received unknown control message: %s", BSTR(&buf)); diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 368b6920..ee1cb980 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -178,6 +178,39 @@ server_pushed_signal(struct context *c, const struct buffer *buffer, const bool } } +void +server_pushed_info(struct context *c, const struct buffer *buffer, + const int adv) +{ + const char *m = ""; + struct buffer buf = *buffer; + + if (buf_advance(&buf, adv) && buf_read_u8(&buf) == ',' && BLEN(&buf)) + { + m = BSTR(&buf); + } + +#ifdef ENABLE_MANAGEMENT + struct gc_arena gc; + if (management) + { + gc = gc_new(); + + /* + * We use >INFOMSG here instead of plain >INFO since INFO is used to + * for management greeting and we don't want to confuse the client + */ + struct buffer out = alloc_buf_gc(256, &gc); + buf_printf(&out, ">%s:%s", "INFOMSG", m); + management_notify_generic(management, BSTR(&out)); + + gc_free(&gc); + } + #endif + msg(D_PUSH, "Info command was pushed by server ('%s')", m); +} + + #if P2MP_SERVER /** * Add an option to the given push list by providing a format string. diff --git a/src/openvpn/push.h b/src/openvpn/push.h index 070782dd..9cf8fb34 100644 --- a/src/openvpn/push.h +++ b/src/openvpn/push.h @@ -50,6 +50,9 @@ void receive_auth_failed(struct context *c, const struct buffer *buffer); void server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart, const int adv); +void server_pushed_info(struct context *c, const struct buffer *buffer, + const int adv); + void incoming_push_message(struct context *c, const struct buffer *buffer); #if P2MP_SERVER