From patchwork Fri Apr 13 07:23:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Micah Morton X-Patchwork-Id: 302 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id DP4nKlzu0Fo5JwAAIUCqbw for ; Fri, 13 Apr 2018 13:52:28 -0400 Received: from proxy20.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net (Dovecot) with LMTP id wShiHFzu0FrqbwAAovjBpQ ; Fri, 13 Apr 2018 13:52:28 -0400 Received: from smtp30.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy20.mail.ord1d.rsapps.net with LMTP id mNgHMlzu0Fr2BwAAsk8m8w ; Fri, 13 Apr 2018 13:52:28 -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: smtp30.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; dkim=fail (signature verification failed) header.d=chromium.org; dmarc=fail (p=none; dis=none) header.from=chromium.org X-Suspicious-Flag: YES X-Classification-ID: 6e1ec938-3f43-11e8-9165-5254001e8e38-1-1 Received: from [216.105.38.7] ([216.105.38.7:4529] helo=lists.sourceforge.net) by smtp30.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 45/43-05489-C5EE0DA5; Fri, 13 Apr 2018 13:52:28 -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.90_1) (envelope-from ) id 1f72r3-0005M3-VK; Fri, 13 Apr 2018 17:51:21 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1f72r2-0005Lv-Pr for openvpn-devel@lists.sourceforge.net; Fri, 13 Apr 2018 17:51:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:To:Subject:Message-ID:Date:From: MIME-Version:Sender:Reply-To:Cc: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=9DuSWbOk616RCRFJXM8IS1JNa8XgcKDabryc3eW5mNo=; b=kBTUcFUNVljp6Q3RpTRbx4r43Q jjmKkwl7u476vqC6DtXm5YoqMJHyQYYp3Gsdu3RzA/NJBwISPqXdQMx1abjwtm247/z7VSfSLKsBm kfhp2VqGQCBN08b5EmfnTCIUXRqFnwUpgbuN4rdb5SvbVJr3c1pt4UtH/5zLjn/eMFSc=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:To:Subject:Message-ID:Date:From:MIME-Version:Sender:Reply-To :Cc: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=9DuSWbOk616RCRFJXM8IS1JNa8XgcKDabryc3eW5mNo=; b=a 0PEn021tk3EJyJeRkUcbEwVgNf5kqnpUVzalGWAaLsrSJVRdckYBAScXroM3bblq41hGUt5A+n1/X vgF0F3ie1MbjBm8SlLmBjPR1GB4lA/No5VaDXXC1O3jx35txc5jZXxXWx0hcjSmkUt1lVtit9ZdcI x5zRItgRhhtueOw8=; Received: from mail-qk0-f179.google.com ([209.85.220.179]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1f72r0-00FJEb-V7 for openvpn-devel@lists.sourceforge.net; Fri, 13 Apr 2018 17:51:20 +0000 Received: by mail-qk0-f179.google.com with SMTP id b198so9943125qkg.9 for ; Fri, 13 Apr 2018 10:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=9DuSWbOk616RCRFJXM8IS1JNa8XgcKDabryc3eW5mNo=; b=FcA74BfpTMtA42u5GZKwW4WfwIfisNAYz6dgcb7iB8/1uF4Ed8M6+2Jn4/k+J4Cuo/ OaQiBx9Fyul7bjnVEAoFzYwAJAC2jNU2o+Y8Vm0YnmroHopCLZqDB217KDuTm9s53kBi 1Fy0OcTX5XvgtOkS4cfj5rmu83A35FOYEocoE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=9DuSWbOk616RCRFJXM8IS1JNa8XgcKDabryc3eW5mNo=; b=X2T42TI5ZFMQfUbEiBFYvVzDwOLTax5ugqSO8TLXXPRAXxM+Wj+8caBqw0J412fh09 dg7HBe+kqeOY6Zi8RQ/6UMa8KN3a1hcQEO1+E/K85ieH3HOyPDTseByqnB2ZNpOSTK95 dfaOti7SZ+qotUpXYlaea4GupgiU8yxiewERN4JDRPDe3UfPzXmqgC/X1yTxfC7XhnJU mpQ8lboS63z8EIEdOhVmUgfdw0NC81Agb1Lq2KdPqdohAIOpIJLZaLn+hge6/sPivsra FjU9uQdJxLqAGbmBqJc5JV6EluyPF6u0YDR1fGJ2wK1JzPJ2PSs4CHFIvBtrQbllq3Wh rvig== X-Gm-Message-State: ALQs6tAyyuqvkRNb3pp1ulBr/xrox3FFv7hUdOG1xSO4oeupxrjfEwsX w91+Uz4bLuemMSc8C1tt4DmXExWBIKZ8feuwRH48V3zeV4s= X-Google-Smtp-Source: AIpwx49eL5S5U+5MEjqJ6A2wzwakhpfuj54mScg8lfk2R7V4fQKn/GXZxKVecPseUST2gDh00TLG4PTuMyNSeF/ayV0= X-Received: by 10.55.118.4 with SMTP id r4mr5504507qkc.211.1523640184666; Fri, 13 Apr 2018 10:23:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.36.50 with HTTP; Fri, 13 Apr 2018 10:23:03 -0700 (PDT) From: Micah Morton Date: Fri, 13 Apr 2018 10:23:03 -0700 Message-ID: To: openvpn-devel@lists.sourceforge.net X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.220.179 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.179 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 1.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Headers-End: 1f72r0-00FJEb-V7 Subject: [Openvpn-devel] [PATCH] Specify platform and version on command line. 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From 557d2e73bf21ddb9d07b43f716c7914d610e7392 Mon Sep 17 00:00:00 2001 From: Micah Morton Date: Fri, 13 Apr 2018 09:55:22 -0700 Subject: [PATCH] Specify platform and version on command line. Add --iv-plat and --iv-plat-rel command line args, and use the values passed to these args to set IV_PLAT and IV_PLAT_REL info that is pushed to the server. IV_PLAT (platform type) is normally inferred from the build target, but it would be useful to be able to override this from the command line (e.g. for client to set platform as ChromeOS instead of Linux). IV_PLAT_REL (platform release version) would allow for pushing the platform (e.g. ChromeOS) release version to the server. This patch is written against openvpn-2.4.4. Signed-off-by: Micah Morton --- src/openvpn/init.c | 8 ++++++++ src/openvpn/options.c | 18 ++++++++++++++++++ src/openvpn/options.h | 2 ++ src/openvpn/ssl.c | 9 +++++++++ src/openvpn/ssl_common.h | 2 ++ 5 files changed, 39 insertions(+) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 133a9f5..1cb76ad 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2723,6 +2723,14 @@ do_init_crypto_tls(struct context *c, const unsigned int flags) { to.push_peer_info_detail = 0; } + if (options->iv_plat) + { + to.iv_plat = options->iv_plat; + } + if (options->iv_plat_rel) + { + to.iv_plat_rel = options->iv_plat_rel; + } #endif /* should we not xmit any packets until we get an initial diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 8dee5d1..d9559a0 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -229,6 +229,8 @@ static const char usage_message[] = "--client-nat snat|dnat network netmask alias : on client add 1-to-1 NAT rule.\n" #ifdef ENABLE_PUSH_PEER_INFO "--push-peer-info : (client only) push client info to server.\n" + "--iv-plat: (client only) platform type.\n" + "--iv-plat-rel: (client only) platform release version.\n" #endif "--setenv name value : Set a custom environmental variable to pass to script.\n" "--setenv FORWARD_COMPATIBLE 1 : Relax config file syntax checking to allow\n" @@ -1781,6 +1783,8 @@ show_settings(const struct options *o) SHOW_BOOL(single_session); #ifdef ENABLE_PUSH_PEER_INFO SHOW_BOOL(push_peer_info); + SHOW_STR(iv_plat); + SHOW_STR(iv_plat_rel); #endif SHOW_BOOL(tls_exit); @@ -7837,6 +7841,20 @@ add_option(struct options *options, VERIFY_PERMISSION(OPT_P_GENERAL); options->push_peer_info = true; } + + else if (streq(p[0], "iv-plat") && p[1] && !p[2]) + { + VERIFY_PERMISSION(OPT_P_GENERAL); + options->iv_plat = p[1]; + } + + else if (streq(p[0], "iv-plat-rel") && p[1] && !p[2]) + { + VERIFY_PERMISSION(OPT_P_GENERAL); + options->iv_plat_rel = p[1]; + } + + #endif else if (streq(p[0], "tls-exit") && !p[1]) { diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 01a7b26..9da4058 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -575,6 +575,8 @@ struct options #ifdef ENABLE_PUSH_PEER_INFO bool push_peer_info; + const char *iv_plat; + const char *iv_plat_rel; #endif bool tls_exit; diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 0739cf7..1265177 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2245,6 +2245,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session) buf_printf(&out, "IV_VER=%s\n", PACKAGE_VERSION); /* push platform */ + if (session->opt->iv_plat == NULL) { #if defined(TARGET_LINUX) buf_printf(&out, "IV_PLAT=linux\n"); #elif defined(TARGET_SOLARIS) @@ -2262,6 +2263,14 @@ push_peer_info(struct buffer *buf, struct tls_session *session) #elif defined(_WIN32) buf_printf(&out, "IV_PLAT=win\n"); #endif + } else { + buf_printf(&out, "IV_PLAT=%s\n", session->opt->iv_plat); + } + + if (session->opt->iv_plat_rel != NULL) + { + buf_printf(&out, "IV_PLAT_REL=%s\n", session->opt->iv_plat_rel); + } /* support for P_DATA_V2 */ buf_printf(&out, "IV_PROTO=2\n"); diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h index 25bffd5..d95c2ef 100644 --- a/src/openvpn/ssl_common.h +++ b/src/openvpn/ssl_common.h @@ -251,6 +251,8 @@ struct tls_options bool pull; #ifdef ENABLE_PUSH_PEER_INFO int push_peer_info_detail; + const char *iv_plat; + const char *iv_plat_rel; #endif int transition_window; int handshake_window;