From patchwork Tue May 19 12:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1117 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id CFWVMCxXxF7FZgAAIUCqbw for ; Tue, 19 May 2020 18:01:16 -0400 Received: from proxy7.mail.iad3b.rsapps.net ([172.31.255.6]) by director11.mail.ord1d.rsapps.net with LMTP id UAXcLSxXxF6GQAAAvGGmqA ; Tue, 19 May 2020 18:01:16 -0400 Received: from smtp10.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy7.mail.iad3b.rsapps.net with LMTP id GJsuKCxXxF4uIgAAQkQ5tQ ; Tue, 19 May 2020 18:01:16 -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: smtp10.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=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 428848cc-9a1c-11ea-9d51-52540055034d-1-1 Received: from [216.105.38.7] ([216.105.38.7:52324] helo=lists.sourceforge.net) by smtp10.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 22/38-32112-B2754CE5; Tue, 19 May 2020 18:01:16 -0400 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 1jbAHv-0005dG-GW; Tue, 19 May 2020 22:00:39 +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 1jbAHf-0005b4-IO for openvpn-devel@lists.sourceforge.net; Tue, 19 May 2020 22:00:23 +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=jtY8fAC3OCRUM1i6Zdk3gSkyHFEi6XDGPBkLBYNoo7M=; b=QrAlkvlz84nIQYWk9THVlDGwDQ 1KkyMx0AQXKu25iM0Pf41hdlFZOTa6vnn0UG0P1OCFI/+v6a8VMx3I+G34Xr9jtkK7hjLekVnQSKg aofFAGATPSQorJKTuFfGd/jWCv4gn9iUk68e9DrurZZwsA0NL9flLjPmb0GChTdGOI8I=; 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=jtY8fAC3OCRUM1i6Zdk3gSkyHFEi6XDGPBkLBYNoo7M=; b=MTHfw2n3AhDQu5dh2Lgp/ZxqVQ sfeJnQqYxLDA8S+rtTYBODbNBACe9bbPWQDw0emzCR7+OVHAjhJsLrEZ+FL0PvaFKEXNxP8yb1aqJ qHaBXn0Vg94sFJ7qxtSLpXzcUSP4lpcLJ4kyVj403w1vyVO2szl9DqgGJg5+AawgHvko=; 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 1jbAHd-001DR2-Nw for openvpn-devel@lists.sourceforge.net; Tue, 19 May 2020 22:00:23 +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 1jbAHM-000DMQ-Ve for openvpn-devel@lists.sourceforge.net; Wed, 20 May 2020 00:00:04 +0200 Received: (nullmailer pid 25184 invoked by uid 10006); Tue, 19 May 2020 22:00:04 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 20 May 2020 00:00:00 +0200 Message-Id: <20200519220004.25136-2-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519220004.25136-1-arne@rfc2549.org> References: <20200519220004.25136-1-arne@rfc2549.org> 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: 1jbAHd-001DR2-Nw Subject: [Openvpn-devel] [PATCH v3 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 | 32 ++++++++++++++++++++++++++++++++ src/openvpn/push.h | 3 +++ 3 files changed, 43 insertions(+) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index fd08f12d..3b088f87 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 0e58b839..965dd139 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -177,6 +177,38 @@ 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); +} + /** * 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 53deae02..1898f238 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); void clone_push_list(struct options *o);