From patchwork Thu Jun 30 09:05:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2570 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id gCg5BX/0vWK0FwAAIUCqbw (envelope-from ) for ; Thu, 30 Jun 2022 15:07:43 -0400 Received: from proxy14.mail.ord1d.rsapps.net ([172.30.191.6]) by director11.mail.ord1d.rsapps.net with LMTP id yHgABX/0vWKaUAAAvGGmqA (envelope-from ) for ; Thu, 30 Jun 2022 15:07:43 -0400 Received: from smtp30.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy14.mail.ord1d.rsapps.net with LMTPS id mPutBH/0vWKiDQAAtEH5vw (envelope-from ) for ; Thu, 30 Jun 2022 15:07: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: 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=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: ea37fc7a-f8a7-11ec-ba77-5254001e8e38-1-1 Received: from [216.105.38.7] ([216.105.38.7:44316] helo=lists.sourceforge.net) by smtp30.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 8F/ED-05693-D74FDB26; Thu, 30 Jun 2022 15:07:42 -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.94.2) (envelope-from ) id 1o6zUb-0005mN-U3; Thu, 30 Jun 2022 19:06:22 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o6zUU-0005mG-Qv for openvpn-devel@lists.sourceforge.net; Thu, 30 Jun 2022 19:06:15 +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=mfdKnNYxxbf552PdnSDHaoZxsJBrdob0VvIdE5DPBoA=; b=OyzUDrW/767xK+VyhXhqc10ZOY rqts4bKV5u2h5zJLBxB2vJmusLejXp4C1gK2UzDseSVBg5udLKtQt1lHdgA2ZG/5SbTOR43qGJrC3 KJSa+krFu7cQniTUq8m1W7EHlLQXTJkNYYcr44wDJ+QWQPDq628ChN4NVVMAkIE325qE=; 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=mfdKnNYxxbf552PdnSDHaoZxsJBrdob0VvIdE5DPBoA=; b=O m/Pg64vYBXIb8wc95koiUIJPYKPT5QpnJ8+O535ZWoG8Ai2oXMYq9GO7HxDi47E5wcbxLkEvu7F1o hfsWJVFXNAMUVsrtJ02SBECgBRJd8ev1EISBhblsEsr8Ua/LhUs607eW1eieP0xebPCCHT6bBktcw WZ18WzjKG2otubAI=; Received: from mail-qv1-f45.google.com ([209.85.219.45]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1o6zUR-002diV-7x for openvpn-devel@lists.sourceforge.net; Thu, 30 Jun 2022 19:06:15 +0000 Received: by mail-qv1-f45.google.com with SMTP id cu16so600463qvb.7 for ; Thu, 30 Jun 2022 12:06:11 -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=mfdKnNYxxbf552PdnSDHaoZxsJBrdob0VvIdE5DPBoA=; b=V5JcF2/w2po1XZTKhk54XpTnOW8sPSeoSpkmGRLem/TC7kgdKIinji6syci/OX6RAH rbLnMXPoCNzOlC24cebMHi0yHIZpSQQCEvExaBAuOSfe/86tG4CzgaSC8xpD11aEPCj5 /tGmfoWijWZN4BmrWoUl7/oMYgBSduP0tKlHkg/wsin9Jeqeav11eIb5KC/yFALkFnim iqocVe6huJAUzpfp1xVqzChOZbkti9snTETXreNoIZYbo65/HA3tpyHgbmxosokqcHmF zB8neEGg5n/ZPO99IyzO9JTr4s7pRXjxiaaarO74G5PVsKbeb/ce6wH82oXaNe4B1W2b vQmA== 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=mfdKnNYxxbf552PdnSDHaoZxsJBrdob0VvIdE5DPBoA=; b=8QevWQBSlXZDnF4LGFuM+k/J2yQQGpnplvL1lzIgQqw0aoQNWbCJbfO2oFMtqz0ExC p/rRkBxaMF2uH6qX2NgucsqEBd3Tx7AXLMjIV3jJ9OdA/wC3Lz7gdEC06t58RCaZ/Oot Vl9FUFd/vgbaK1rJ+eXdbeE0nlEsZdeBC/cvPvknhhskeG1Lxzs4q8tejgkASwuA/+I9 2PdF0IDCWTkeX0cHZIvNJEX+wIf/DxF8+Y6Gq2LhF1Q4X8bbotBuUtgAswzH3uX9j3tk /FoIA80U+R1qM7iPDgiJSs/bQ6Srg56E/TYBhWeYcUwTBHJIrnIyNqX11P8xf4zXXUEL xrEA== X-Gm-Message-State: AJIora/8/BqIQ0CNKtQCXc2DYdQMwuQTzPUVlr2UIeinRd7u2kAHfaFj 69+gQBa430G/RoBE4hkFqEeTo9ZvgtM= X-Google-Smtp-Source: AGRyM1u5O6DmU8vEKY8Powvw4X+wJtQ+F91UcSwi9Tf6/krk/klKify+MKFiJtc8wAd0UrR8Dj5Ghg== X-Received: by 2002:ac8:5b85:0:b0:31c:b896:fb7d with SMTP id a5-20020ac85b85000000b0031cb896fb7dmr9178728qta.188.1656615965094; Thu, 30 Jun 2022 12:06:05 -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 ey14-20020a05622a4c0e00b002fcb0d95f65sm13070640qtb.90.2022.06.30.12.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 12:06:04 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Thu, 30 Jun 2022 15:05:47 -0400 Message-Id: <20220630190549.16675-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 When the port is specified as zero, log the actual port bound to, instead of 0. Signed-off-by: Selva Nair --- src/openvpn/manage.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 SPF_PASS SPF: sender matches SPF record -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 -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.45 listed in list.dnswl.org] X-Headers-End: 1o6zUR-002diV-7x Subject: [Openvpn-devel] [PATCH 1/3] Log the actual management interface port in use 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 When the port is specified as zero, log the actual port bound to, instead of 0. Signed-off-by: Selva Nair Acked-by: Gert Doering --- src/openvpn/manage.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 50f162a3..21c7ccdd 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1830,8 +1830,22 @@ man_listen(struct management *man) } else #endif - msg(D_MANAGEMENT, "MANAGEMENT: TCP Socket listening on %s", - print_sockaddr(man->settings.local->ai_addr, &gc)); + { + const struct sockaddr *man_addr = man->settings.local->ai_addr; + struct sockaddr_storage addr; + socklen_t addrlen = sizeof(addr); + if (!getsockname(man->connection.sd_top, (struct sockaddr *) &addr, &addrlen)) + { + man_addr = (struct sockaddr *) &addr; + } + else + { + msg(M_WARN|M_ERRNO, + "Failed to get the management socket address"); + } + msg(D_MANAGEMENT, "MANAGEMENT: TCP Socket listening on %s", + print_sockaddr(man_addr, &gc)); + } } #ifdef _WIN32 From patchwork Thu Jun 30 09:05:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2569 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 with LMTP id SLbdN330vWKAFwAAIUCqbw (envelope-from ) for ; Thu, 30 Jun 2022 15:07:41 -0400 Received: from proxy18.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id 6PiWN330vWL3MQAAovjBpQ (envelope-from ) for ; Thu, 30 Jun 2022 15:07:41 -0400 Received: from smtp24.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.ord1d.rsapps.net with LMTPS id GFUzN330vWKUHQAATCaURg (envelope-from ) for ; Thu, 30 Jun 2022 15:07:41 -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: smtp24.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=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: e9bd99bc-f8a7-11ec-90bf-52540091a1c4-1-1 Received: from [216.105.38.7] ([216.105.38.7:42716] helo=lists.sourceforge.net) by smtp24.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 7C/85-19047-D74FDB26; Thu, 30 Jun 2022 15:07: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.94.2) (envelope-from ) id 1o6zV1-0000Vv-2c; Thu, 30 Jun 2022 19:06:47 +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 1o6zUz-0000Vj-Md for openvpn-devel@lists.sourceforge.net; Thu, 30 Jun 2022 19:06:45 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=e9A4dRi8mFn/ufG/EwfZTXydRSytlkPI3uH75Udw5bM=; b=ST5oAnPdw/fDIZX+/86is/KtYb MsiBX9RzhwMb71YqiMHm4e96Ip1JgtbZuwmbe1fhjnos0jIEJj4nL+0X6EhfHrn0Sbx3erXxah/tH H5JYHgI4/Brsvxu44+eshVZxVv0vwGLgU5STjbGbYJ1E4GqjEc1rYoRYGnon2BpiHX9s=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=e9A4dRi8mFn/ufG/EwfZTXydRSytlkPI3uH75Udw5bM=; b=EGdU2aHTDjJZ3G71KVrR9w7tyY RL0OWZ5K8u3HG8Cbm9lLIAoE2oZ8HuWV+rgRD3DMJHv8TsVQAKRKHaUpCVJwzVn+AWAoEDADEIDsa 2cBwWlXqUQHkNynUXJ3zdIHXlt8HB7Tf0g6ehexuEmbMRis8jWLXFq9AYV0aw5Qm/qGk=; Received: from mail-qk1-f177.google.com ([209.85.222.177]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1o6zUu-0000d8-L7 for openvpn-devel@lists.sourceforge.net; Thu, 30 Jun 2022 19:06:44 +0000 Received: by mail-qk1-f177.google.com with SMTP id n10so11732854qkn.10 for ; Thu, 30 Jun 2022 12:06:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=e9A4dRi8mFn/ufG/EwfZTXydRSytlkPI3uH75Udw5bM=; b=hR0P1iSU03eQFavc66WGX3mLnmzGDEvMF4naF8gjB9SVSuhOOBg0u3+TrV26NrIYPD 5QgPvRhJs6CqXojNq3WMJm0Q9okZvxEO0oIIa+6IGQexoiOI8842Oshwjj5i+54A9XSm NTIZib35+bY/Fi9xN6Qy76FDGWgBCWlx60j3JcpU8H1Pdxng/G58N5jyZ9m3Q2yuj1kA x4KltMb2jfODl2khGevevT77OzUEpnZK3JyfMDsm0q8jJqnaRDZiiAjJBbjHo6J2XfMd rj7RDscf8yMb7E+uY4a/EjbbpnEmJrTiYXHuIWqoPD5EAjfviEuDbWUuDzb1Nmvt7p41 DeOA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=e9A4dRi8mFn/ufG/EwfZTXydRSytlkPI3uH75Udw5bM=; b=Cz16YEyQvYhfygcbDmrxgHYQOP0hUFtvg0djIKuU4QByNQQwLzUsAeWYSvUDhxvp6j qBrVCxEyYKQK3WZr9qbM8i5mh/w3uh3TgCMT9UgSUn9EZhDyAGKGyCyykNlT6ESteQSv qcNjhlbuouHmf0Oui15p25A12Mhha9xwE3rDJxX5kETOiV9njqBr5xfUU5pM64LCWRXQ muHEoiWdfPbr/HriQuyIN7jNNj4IRoGsZCoU62IvkEjAp/UC9TH8JFyjJUPQq4Gf5gDo 3r0yO2gFZHGZ4RumfTqZa0zZXXFleDwpA+WkVj5aYiXYML/HPsn8jyj1h9ozhcyWOeHi TPFQ== X-Gm-Message-State: AJIora/HMEI3n0W7I65lhweU1k6oqJ3U2Bv+eAkLCTHlQKen/09jsP8/ 22fo0NgbdQwKftqa1OkHidGqLGJ/Y3I= X-Google-Smtp-Source: AGRyM1s4UNKBjHhY1oPeyyirDE57EUE7qJVHX2ri/mwRR0Syoya5rbvR2rAngJn4mMYwSY4vdGGDmA== X-Received: by 2002:a05:620a:4706:b0:6af:482e:b9eb with SMTP id bs6-20020a05620a470600b006af482eb9ebmr7763702qkb.46.1656615994592; Thu, 30 Jun 2022 12:06:34 -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 ey14-20020a05622a4c0e00b002fcb0d95f65sm13070640qtb.90.2022.06.30.12.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 12:06:34 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Thu, 30 Jun 2022 15:05:48 -0400 Message-Id: <20220630190549.16675-2-selva.nair@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220630190549.16675-1-selva.nair@gmail.com> References: <20220630190549.16675-1-selva.nair@gmail.com> MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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 --management-client has an obscure and undocumented feature to take a file argument where the peer's address and port are recorded. This has become dead code over time. - reactivate the dead code - make it work with v6 addresses as well - do not exit on error in writing the record 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 SPF_PASS SPF: sender matches SPF record -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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.222.177 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.222.177 listed in wl.mailspike.net] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1o6zUu-0000d8-L7 Subject: [Openvpn-devel] [PATCH 2/3] Reactivate record_peer_info in manage.c 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 --management-client has an obscure and undocumented feature to take a file argument where the peer's address and port are recorded. This has become dead code over time. - reactivate the dead code - make it work with v6 addresses as well - do not exit on error in writing the record Signed-off-by: Selva Nair --- Alternatively we could remove this "feature" and related code. src/openvpn/manage.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 21c7ccdd..548d3b9a 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1621,23 +1621,19 @@ man_record_peer_info(struct management *man) if (man->settings.write_peer_info_file) { bool success = false; -#ifdef HAVE_GETSOCKNAME if (socket_defined(man->connection.sd_cli)) { - struct sockaddr_in addr; + struct sockaddr_storage 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)) + if (!status) { - 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); + fprintf(fp, "%s\n", print_sockaddr((struct sockaddr *)&addr, &gc)); if (!fclose(fp)) { success = true; @@ -1645,12 +1641,10 @@ man_record_peer_info(struct management *man) } } } -#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); From patchwork Thu Jun 30 09:05:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2571 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 with LMTP id MJVwJIb0vWLuFwAAIUCqbw (envelope-from ) for ; Thu, 30 Jun 2022 15:07:50 -0400 Received: from proxy14.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id WKM1JIb0vWKyMAAAovjBpQ (envelope-from ) for ; Thu, 30 Jun 2022 15:07:50 -0400 Received: from smtp36.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy14.mail.ord1d.rsapps.net with LMTPS id sIfWI4b0vWKiDQAAtEH5vw (envelope-from ) for ; Thu, 30 Jun 2022 15:07:50 -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: smtp36.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=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: eee304cc-f8a7-11ec-a905-525400c11307-1-1 Received: from [216.105.38.7] ([216.105.38.7:41172] helo=lists.sourceforge.net) by smtp36.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id B3/8E-23213-584FDB26; Thu, 30 Jun 2022 15:07:49 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1o6zV9-0003AM-FU; Thu, 30 Jun 2022 19:06:54 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o6zV8-0003AF-Ai for openvpn-devel@lists.sourceforge.net; Thu, 30 Jun 2022 19:06:53 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4zTKdys7EoG1M9m66c5BI/zgvo2z4HQdKkUpODpO3Qk=; b=NHnTQygiJzR+ItQMVIjpCjOrrX EX5KXy5fsonkmJu41fZZhNnSFJuAZb8ChcCwsT2y/ycVo1un4rPhJjIWAlQrQV8uXLv4+naL9/Qc2 MohUkfghM1ZPtssYe8AuGd05N6podPB3MeEAF4naPcZlnYcIYjDfugCkNkn+GFYtuCHI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4zTKdys7EoG1M9m66c5BI/zgvo2z4HQdKkUpODpO3Qk=; b=YYI3AqJd/Mv8Cu3Q4sd8Wuhdhs PH/4+OGEeDxL3wTpWdiSOndhfbwsWPGaEBK7pimy+GHs5EBr96+SguRjabXwU4S42a+Zckr92InHP H7M2Dd2Cu1h1HhWgSzpqxodmtSSor9OsYL6dKhsmyDYRS/IxwR9sy2iB9G/pCmvUGa6w=; Received: from mail-qv1-f48.google.com ([209.85.219.48]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1o6zV3-002djx-Ha for openvpn-devel@lists.sourceforge.net; Thu, 30 Jun 2022 19:06:52 +0000 Received: by mail-qv1-f48.google.com with SMTP id i17so551836qvo.13 for ; Thu, 30 Jun 2022 12:06:49 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=4zTKdys7EoG1M9m66c5BI/zgvo2z4HQdKkUpODpO3Qk=; b=mXAVGBMfTfZhRub1CRw5tGU4A6pRqCdSjTlCDYLoVnnfFhTZCXybslCL+wfpQEK42C HzZF1CTZixGfRTf8fOCCHDYiHrMigrFq3aufI5YycnysQUsfTuRdCfVl0hU4qbdJFiUO KwX1C/8dstespXfGyn7qIuR/SXL2eQwbsh+6lfDdmq/gHgQqALC59NixCxJOiQ5l3xT4 Z8/aKK19WNt9N/UHCYOB0f72GRvayVKU5E/wvlBxbD1umHwLncDFH2nJ2USuGHzMDlsB 0bEPhNCbfnZy7mqBwMfaRoM4e/n3/XI5uQDEsHoJliUCnBtop/PA9RM6qk8A9tEt65NB krcA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=4zTKdys7EoG1M9m66c5BI/zgvo2z4HQdKkUpODpO3Qk=; b=s9QopWQqqZyPFHy/95GoY/ZJ9HMLA4pAqmI8BKs6r3QKmd1vzxK6hv0yKLeNSnmOBG 0FdrL1S3pS33puHVUi1XV3yJeWuBgx4bKLOgaEcV48mKOiFKku0WKN2T3PS9HyT+nnr7 hYn7594C+wsfFL4LbhjKIjGbytESR4XnIuisEs7dRV+9CEc18X2M8o7QrxdDl+wzlP10 rRslHdBergWrYT/oLAUTPf+An3/Ggi5zZEvtesSW81LF98sX1pAffc1Vaq1JZvd9nHeA NTYzdJe2ueZfe3xCBjWvnBAKOewL8CP63Jm4OptFfJeg4uAuZVLOFjs4dJOuP1Qv72DO ZjnQ== X-Gm-Message-State: AJIora9Tlk1ZebYnY3kLlL4yqWrzhK2xJm09upZ3WcPN6I1WBLR3fpOE KqkGvh5qu5r6hqcPDbNxiZTZGDbvLk4= X-Google-Smtp-Source: AGRyM1tLUihOdHfrKQz8AOxiX9t3fvr9GkSxwRxC+xmLGO/2hG6XFDrlY/rqD5O/AKEdcmDUI49iIA== X-Received: by 2002:a05:622a:114:b0:31d:2388:4df4 with SMTP id u20-20020a05622a011400b0031d23884df4mr8891227qtw.488.1656616003482; Thu, 30 Jun 2022 12:06:43 -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 ey14-20020a05622a4c0e00b002fcb0d95f65sm13070640qtb.90.2022.06.30.12.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 12:06:43 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Thu, 30 Jun 2022 15:05:49 -0400 Message-Id: <20220630190549.16675-3-selva.nair@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220630190549.16675-1-selva.nair@gmail.com> References: <20220630190549.16675-1-selva.nair@gmail.com> MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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 Currently when we are listening on the management interface, the local address/port is logged as that of the connecting client. Fix it. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.48 listed in list.dnswl.org] 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 SPF_PASS SPF: sender matches SPF record -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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.48 listed in wl.mailspike.net] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1o6zV3-002djx-Ha Subject: [Openvpn-devel] [PATCH 3/3] Log address of management client on accept 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 Currently when we are listening on the management interface, the local address/port is logged as that of the connecting client. Fix it. Signed-off-by: Selva Nair Acked-by: Gert Doering --- src/openvpn/manage.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 548d3b9a..7947c906 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1685,9 +1685,27 @@ man_new_connection_post(struct management *man, const char *description) } else #endif - msg(D_MANAGEMENT, "MANAGEMENT: %s %s", - description, - print_sockaddr(man->settings.local->ai_addr, &gc)); + if (man->settings.flags & MF_CONNECT_AS_CLIENT) + { + msg(D_MANAGEMENT, "MANAGEMENT: %s %s", + description, + print_sockaddr(man->settings.local->ai_addr, &gc)); + } + else + { + struct sockaddr_storage addr; + socklen_t addrlen = sizeof(addr); + if (!getpeername(man->connection.sd_cli, (struct sockaddr *) &addr, + &addrlen)) + { + msg(D_MANAGEMENT, "MANAGEMENT: %s %s", description, + print_sockaddr((struct sockaddr *) &addr, &gc)); + } + else + { + msg(D_MANAGEMENT, "MANAGEMENT: %s %s", description, "unknown"); + } + } buffer_list_reset(man->connection.out);