From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 529BE68F68 for ; Thu, 11 Feb 2021 10:42:35 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4147019D59 for ; Thu, 11 Feb 2021 10:42:05 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 98A1519D51 for ; Thu, 11 Feb 2021 10:42:04 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5EA7041BAE for ; Thu, 11 Feb 2021 10:42:04 +0100 (CET) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 11 Feb 2021 10:42:00 +0100 Message-Id: <20210211094200.20664-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.001 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH storage] storage migration: insecure: improve logging X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Feb 2021 09:42:35 -0000 by including the message/error from the remote side. Some people on the forum [0] ran into 'no tunnel IP received', but without information from the remote side it's hard to tell why. [0]: https://forum.proxmox.com/threads/failed-no-tunnel-ip-received.80172 Signed-off-by: Fabian Ebner --- PVE/Storage.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 22a6ef1..3c03abe 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -758,8 +758,16 @@ sub storage_migrate { or die "receive command failed: $!\n"; close($input); - my ($ip) = <$info> =~ /^($PVE::Tools::IPRE)$/ or die "no tunnel IP received\n"; - my ($port) = <$info> =~ /^(\d+)$/ or die "no tunnel port received\n"; + my $ip = <$info> // ''; + chomp($ip); + die "no tunnel IP received, got '$ip'\n" + if $ip !~ /^$PVE::Tools::IPRE$/; + + my $port = <$info> // ''; + chomp($port); + die "no tunnel port received, got '$port'\n" + if $port !~ /^\d+$/; + my $socket = IO::Socket::IP->new(PeerHost => $ip, PeerPort => $port, Type => SOCK_STREAM) or die "failed to connect to tunnel at $ip:$port\n"; # we won't be reading from the socket -- 2.20.1