From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 8BD8D1FF183 for ; Wed, 16 Jul 2025 12:12:55 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A9F51C430; Wed, 16 Jul 2025 12:13:59 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Wed, 16 Jul 2025 12:13:15 +0200 Message-ID: <20250716101320.571502-1-c.heiss@proxmox.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -2.520 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SOMETLD_ARE_BAD_TLD 5 .bar, .beauty, .buzz, .cam, .casa, .cfd, .club, .date, .guru, .link, .live, .monster, .online, .press, .pw, .quest, .rest, .sbs, .shop, .stream, .top, .trade, .wiki, .work, .xyz TLD abuse RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [142.250.181.238] Subject: [pve-devel] [PATCH installer] run env: anchor domain suffix strip regex to end of string 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" While it is very much an edge case, properly anchoring the regex ensures that the local domain only ever gets stripped if it is indeed a suffix of the fully-qualified hostname. Prevents situations where the DHCP server sends the following client configuration: host-name: host.foo.bar domain-name: foo Which would result in `bar.foo` being set as the search domain in the final system without this patch. Fixes: a9c0a44 ("run env: fix dhcp-set hostname containing local domain") Signed-off-by: Christoph Heiss --- Not sure how that one slipped through. Proxmox/Install/RunEnv.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm index 5d932ab..540bec7 100644 --- a/Proxmox/Install/RunEnv.pm +++ b/Proxmox/Install/RunEnv.pm @@ -296,7 +296,7 @@ sub query_installation_environment : prototype() { if (my $fqdn = Proxmox::Sys::Net::get_dhcp_hostname()) { if (defined(my $domain = $output->{network}->{dns}->{domain})) { # strip domain name suffix, if possible - $fqdn =~ s/\.${domain}//; + $fqdn =~ s/\.${domain}$//; } $output->{network}->{hostname} = $fqdn; -- 2.49.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel