all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] run env: anchor domain suffix strip regex to end of string
@ 2025-07-16 10:13 Christoph Heiss
  2025-07-16 23:30 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2025-07-16 10:13 UTC (permalink / raw)
  To: 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 <c.heiss@proxmox.com>
---
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH installer] run env: anchor domain suffix strip regex to end of string
  2025-07-16 10:13 [pve-devel] [PATCH installer] run env: anchor domain suffix strip regex to end of string Christoph Heiss
@ 2025-07-16 23:30 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-07-16 23:30 UTC (permalink / raw)
  To: pve-devel, Christoph Heiss

On Wed, 16 Jul 2025 12:13:15 +0200, Christoph Heiss wrote:
> 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:
> 
> [...]

Applied, thanks!

[1/1] run env: anchor domain suffix strip regex to end of string
      commit: e4c1c06e8742de69095b2d7bafa74942c112a349


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-16 23:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-16 10:13 [pve-devel] [PATCH installer] run env: anchor domain suffix strip regex to end of string Christoph Heiss
2025-07-16 23:30 ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal