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);