From patchwork Thu Jun 30 14:07:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2572 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.54]) by backend30.mail.ord1d.rsapps.net with LMTP id SHmRNBM7vmL5PwAAIUCqbw (envelope-from ) for ; Thu, 30 Jun 2022 20:08:51 -0400 Received: from proxy15.mail.iad3a.rsapps.net ([172.27.255.54]) by director9.mail.ord1d.rsapps.net with LMTP id sNVjNBM7vmKgawAAalYnBA (envelope-from ) for ; Thu, 30 Jun 2022 20:08:51 -0400 Received: from smtp32.gate.iad3a ([172.27.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy15.mail.iad3a.rsapps.net with LMTPS id 4GvHLRM7vmJcaQAAHi9b9g (envelope-from ) for ; Thu, 30 Jun 2022 20:08:51 -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: smtp32.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; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: fc49da08-f8d1-11ec-a059-5254001741cc-1-1 Received: from [216.105.38.7] ([216.105.38.7:55394] helo=lists.sourceforge.net) by smtp32.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id BF/08-19692-31B3EB26; Thu, 30 Jun 2022 20:08:51 -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.94.2) (envelope-from ) id 1o74CF-0000bl-BM; Fri, 01 Jul 2022 00:07:43 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o74CD-0000bf-Tp for openvpn-devel@lists.sourceforge.net; Fri, 01 Jul 2022 00:07:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=VRQX8Nr4RjZb466mmBMgWW/FXFaCXA3XtN9iVsACmlM=; b=aEe/UTVjIup7wU6HRt7fKIhK5Q uSwuO2CD9CZqZEq9j5L/VNNPAa7H/NVxUH6+RzhjfIrjTcXTPFoEZslNKoufdhiDX1zggNnX+ndDw uhnBGyKXd2igxze64lKrp+tuCne4Fysth2z3WOA0WJNSJpAK+WDwZIiAPA+I5eQQ5jhs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type: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=VRQX8Nr4RjZb466mmBMgWW/FXFaCXA3XtN9iVsACmlM=; b=P RTVJhjOME3uf0Y4g2I3V1IN0yp3NjKUyLlqjYU8cC3YgJKItWmHpfs7CV4Gq2/WWNtAQ4eXI3wuot QDsBX1wRbVCmCo/z2NZHxxS3TSKKSQbTTTQA6Z8mCw6khh2BaBt8quFfgRgzEGFSc6rsJXWwkxA1O bPVyeqLsP9s/iGQ8=; Received: from mail-qk1-f179.google.com ([209.85.222.179]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1o74C8-0005m9-SH for openvpn-devel@lists.sourceforge.net; Fri, 01 Jul 2022 00:07:41 +0000 Received: by mail-qk1-f179.google.com with SMTP id v6so780723qkh.2 for ; Thu, 30 Jun 2022 17:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VRQX8Nr4RjZb466mmBMgWW/FXFaCXA3XtN9iVsACmlM=; b=oTsoWAeFvxf3cPKSvvNlka3vl9rxVAHALVFDYpKX3eGzijbJ0RowdYPJQAhcvhJ89y 4zy9L+thjXtzZhlRJWY4YDFqphCzNtWXEo+Sa5Oji9gZ64WY27FEjb8lG8i5QKN4fJVl 4DmnbYnamrrxmJcyDH+5ictHyVEpvZ4B5ikjV/W4v1K1qi5N7L8PCUp2IbrQQqpJd9LF AruZsxcbb+Vg+PyDZTBd+JvvGOe77cvoQE5zcJb9AGfpMRDRRVS2/EOn1hgWv4OW5H5u rlxmhe07lo7iSoOjrB+ELJulK9FHy28Zjy5fsbtk4b5L7JSBCEB6EhlYFmFnOkOR1RM5 LHzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VRQX8Nr4RjZb466mmBMgWW/FXFaCXA3XtN9iVsACmlM=; b=i/Q91XtZbJCv/D71wlO5NmlN181OxU2/gpJ8Ak4pZU8HrOkyFgC/k4pAdJOXKBelf/ 5o4pZG3DoubpjyrXQzHGoEhzRmMmjkvG9uUoPHR27DYh4JqH5EXGG2RDFTTgEJLa8oBq SR0Ohhvt25EO870iMrSqPjp45jsgr98dVNCR2Hk5cuSXgDOdLuDYGBi+63wf25UFpZX9 WejwPwWg1NdzsCL06vCjdcjXZZoqfQbfj7SA4u8wIch8Zx6TK0mYn+ngCmg/Vf0/b2Un W/q8vAjR5C4YgyZQFKWN8qfLaoUJ1rltaZ7H94fR7igUg0TvhE8yv3kQuEYtqRwTzQUJ ynjA== X-Gm-Message-State: AJIora//vyXLqIrX7ANRKVPJXDr7S219mFdBOQKR6HzwGY9eLco38EQT WSEoNNnPZAyUcpUqreO/4cbtqg09FHk= X-Google-Smtp-Source: AGRyM1sH2KMGsX/4QOSP2nBWHv+U+7uAgz/obO65ylPRCoDyEqlYTV86zp9Uaz4VExytEhynaNNa8w== X-Received: by 2002:a05:620a:254d:b0:6ab:84b8:25eb with SMTP id s13-20020a05620a254d00b006ab84b825ebmr8566149qko.383.1656634050707; Thu, 30 Jun 2022 17:07:30 -0700 (PDT) Received: from uranus.home.sansel.ca (bras-vprn-tnhlon4053w-lp130-02-70-51-223-194.dsl.bell.ca. [70.51.223.194]) by smtp.gmail.com with ESMTPSA id j14-20020ac8440e000000b003176b8f948esm13391387qtn.13.2022.06.30.17.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 17:07:30 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Thu, 30 Jun 2022 20:07:26 -0400 Message-Id: <20220701000726.8198-1-selva.nair@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Selva Nair Use of this has never been documented and the code was dead for a long while now. Signed-off-by: Selva Nair --- Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.222.179 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.222.179 listed in wl.mailspike.net] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1o74C8-0005m9-SH Subject: [Openvpn-devel] [PATCH] Remove management_write_peer_info_file and related code 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: Selva Nair Use of this has never been documented and the code was dead for a long while now. Signed-off-by: Selva Nair Acked-By: Arne Schwabe --- Alternative for [PATCH 2/3] Reactivate record_peer_info in manage.c src/openvpn/init.c | 1 - src/openvpn/manage.c | 49 ------------------------------------------- src/openvpn/manage.h | 2 -- src/openvpn/options.c | 5 +---- src/openvpn/options.h | 1 - 5 files changed, 1 insertion(+), 57 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 03221cbb..1bfbf4eb 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -3862,7 +3862,6 @@ open_management(struct context *c) c->options.management_log_history_cache, c->options.management_echo_buffer_size, c->options.management_state_buffer_size, - c->options.management_write_peer_info_file, c->options.remap_sigusr1, flags)) { diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 50f162a3..19e44221 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1614,48 +1614,6 @@ man_stop_ne32(struct management *man) #endif /* ifdef _WIN32 */ -static void -man_record_peer_info(struct management *man) -{ - struct gc_arena gc = gc_new(); - if (man->settings.write_peer_info_file) - { - bool success = false; -#ifdef HAVE_GETSOCKNAME - if (socket_defined(man->connection.sd_cli)) - { - struct sockaddr_in addr; - socklen_t addrlen = sizeof(addr); - int status; - - CLEAR(addr); - status = getsockname(man->connection.sd_cli, (struct sockaddr *)&addr, &addrlen); - if (!status && addrlen == sizeof(addr)) - { - const in_addr_t a = ntohl(addr.sin_addr.s_addr); - const int p = ntohs(addr.sin_port); - FILE *fp = platform_fopen(man->settings.write_peer_info_file, "w"); - if (fp) - { - fprintf(fp, "%s\n%d\n", print_in_addr_t(a, 0, &gc), p); - if (!fclose(fp)) - { - success = true; - } - } - } - } -#endif /* ifdef HAVE_GETSOCKNAME */ - if (!success) - { - msg(D_MANAGEMENT, "MANAGEMENT: failed to write peer info to file %s", - man->settings.write_peer_info_file); - throw_signal_soft(SIGTERM, "management-connect-failed"); - } - } - gc_free(&gc); -} - static void man_connection_settings_reset(struct management *man) { @@ -1903,7 +1861,6 @@ man_connect(struct management *man) goto done; } - man_record_peer_info(man); man_new_connection_post(man, "Connected to management server at"); done: @@ -2376,7 +2333,6 @@ man_settings_init(struct man_settings *ms, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, - const char *write_peer_info_file, const int remap_sigusr1, const unsigned int flags) { @@ -2416,8 +2372,6 @@ man_settings_init(struct man_settings *ms, ASSERT(ms->client_gid >= 0); } - ms->write_peer_info_file = string_alloc(write_peer_info_file, NULL); - #if UNIX_SOCK_SUPPORT if (ms->flags & MF_UNIX_SOCK) { @@ -2481,7 +2435,6 @@ man_settings_close(struct man_settings *ms) { freeaddrinfo(ms->local); } - free(ms->write_peer_info_file); CLEAR(*ms); } @@ -2584,7 +2537,6 @@ management_open(struct management *man, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, - const char *write_peer_info_file, const int remap_sigusr1, const unsigned int flags) { @@ -2603,7 +2555,6 @@ management_open(struct management *man, log_history_cache, echo_buffer_size, state_buffer_size, - write_peer_info_file, remap_sigusr1, flags); diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index 44a5d964..f46274e6 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -229,7 +229,6 @@ struct man_settings { int log_history_cache; int echo_buffer_size; int state_buffer_size; - char *write_peer_info_file; int client_uid; int client_gid; @@ -351,7 +350,6 @@ bool management_open(struct management *man, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, - const char *write_peer_info_file, const int remap_sigusr1, const unsigned int flags); diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 233c02e0..e9dd6b2c 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1893,7 +1893,6 @@ show_settings(const struct options *o) SHOW_STR(management_user_pass); SHOW_INT(management_log_history_cache); SHOW_INT(management_echo_buffer_size); - SHOW_STR(management_write_peer_info_file); SHOW_STR(management_client_user); SHOW_STR(management_client_group); SHOW_INT(management_flags); @@ -2380,7 +2379,6 @@ options_postprocess_verify_ce(const struct options *options, #ifdef ENABLE_MANAGEMENT if (!options->management_addr && (options->management_flags - || options->management_write_peer_info_file || options->management_log_history_cache != defaults.management_log_history_cache)) { msg(M_USAGE, "--management is not specified, however one or more options which modify the behavior of --management were specified"); @@ -5718,11 +5716,10 @@ add_option(struct options *options, VERIFY_PERMISSION(OPT_P_GENERAL); options->management_flags |= MF_UP_DOWN; } - else if (streq(p[0], "management-client") && !p[2]) + else if (streq(p[0], "management-client") && !p[1]) { VERIFY_PERMISSION(OPT_P_GENERAL); options->management_flags |= MF_CONNECT_AS_CLIENT; - options->management_write_peer_info_file = p[1]; } #ifdef ENABLE_MANAGEMENT else if (streq(p[0], "management-external-key")) diff --git a/src/openvpn/options.h b/src/openvpn/options.h index f7e3f265..1a9d9291 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -421,7 +421,6 @@ struct options int management_log_history_cache; int management_echo_buffer_size; int management_state_buffer_size; - const char *management_write_peer_info_file; const char *management_client_user; const char *management_client_group;