From patchwork Thu Jun 13 04:41:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 752 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id +A67LuNgAl0QdgAAIUCqbw for ; Thu, 13 Jun 2019 10:42:43 -0400 Received: from proxy4.mail.ord1c.rsapps.net ([172.28.255.1]) by director8.mail.ord1d.rsapps.net with LMTP id SG+NLuNgAl2tWwAAfY0hYg ; Thu, 13 Jun 2019 10:42:43 -0400 Received: from smtp39.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.ord1c.rsapps.net with LMTP id WP89LuNgAl3jbwAAjcXvpA ; Thu, 13 Jun 2019 10:42:43 -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: smtp39.gate.ord1c.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: 7f2ce46c-8de9-11e9-9202-5452006c005a-1-1 Received: from [216.105.38.7] ([216.105.38.7:48190] helo=lists.sourceforge.net) by smtp39.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 5C/70-11209-1E0620D5; Thu, 13 Jun 2019 10:42:41 -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 1hbQv1-00047f-I9; Thu, 13 Jun 2019 14:41:35 +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 1hbQv0-000473-6F for openvpn-devel@lists.sourceforge.net; Thu, 13 Jun 2019 14:41:34 +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=LYpTYbGyFb3FHrum5RMLuXSfbnqZJnX71krWGJpsZcY=; b=lKK4mtIoGOq4IYfWywDxLgn99t AMcqkJ51BAGORLkr7lOAAhd0rFsS4AybsIrx8yhmYO8OxCjP81Sy+MYZPljf+0wDxA+CmhZiC1eQU hfKHIA8AQPHgtpcIvq3UnosTalUXOForMQ1Ll1beKm/jNy8Vi1z+VFCV6XiN3YBLCxqw=; 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=LYpTYbGyFb3FHrum5RMLuXSfbnqZJnX71krWGJpsZcY=; b=TJms3uJ2uVYqsChnbcqkuRe6qw QvGOvWUa8l/ATMb/Zw1dgnEQsiSo6YNr9dTBoFAKTeZadykWPqTB3rsb8l9UgENCApSuAqoxntkfW 2V42/hXCNcMHHl8rByPeEQoAPoDKvhgKfJ3u1gBBtHLGdWKuWAPg1Px0XbEN7Y6jLvOU=; Received: from [192.26.174.232] (helo=mail.blinkt.de) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hbQuw-00C2DZ-EY for openvpn-devel@lists.sourceforge.net; Thu, 13 Jun 2019 14:41:33 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hbQuf-000OBK-UV for openvpn-devel@lists.sourceforge.net; Thu, 13 Jun 2019 16:41:13 +0200 Received: (nullmailer pid 6466 invoked by uid 10006); Thu, 13 Jun 2019 14:41:13 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 13 Jun 2019 16:41:09 +0200 Message-Id: <20190613144113.6418-2-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190613144113.6418-1-arne@rfc2549.org> References: <20190613144113.6418-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.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 1.0 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1hbQuw-00C2DZ-EY Subject: [Openvpn-devel] [PATCH 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 out of band and auth pending authentication implements these messages to send information during the authentication to the UI, implement these message also in OpenVPN 2.x to be able to be piked up by the UI Signed-off-by: Arne Schwabe --- 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 35df089a..3803479f 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 8befc6f5..8632a9bb 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -176,6 +176,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 5f6181e7..750a9800 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