git: a379d5c5efb2 - releng/13.2 - hostid: Generate random UUID by default

From: Tijl Coosemans <tijl_at_FreeBSD.org>
Date: Sun, 12 Mar 2023 21:47:03 UTC
The branch releng/13.2 has been updated by tijl:

URL: https://cgit.FreeBSD.org/src/commit/?id=a379d5c5efb2b606f2a12b94c0bfd450173b7c38

commit a379d5c5efb2b606f2a12b94c0bfd450173b7c38
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2023-03-09 09:02:45 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2023-03-12 21:45:59 +0000

    hostid: Generate random UUID by default
    
    This way MAC addresses are no longer exposed.
    
    Discussed with: bapt
    Approved by:    re (cperciva)
    
    (cherry picked from commit 862aab6281a5e6b5dad89761ac17ca2a0e83ab32)
    (cherry picked from commit baf1e9713969fccdaf7481e3568ca89b7237dafd)
---
 libexec/rc/rc.conf     | 1 +
 libexec/rc/rc.d/hostid | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 6b3aacacda61..23f9406da017 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -134,6 +134,7 @@ extra_netfs_types="NO"	# List of network extra filesystem types for delayed
 hostname=""			# Set this!
 hostid_enable="YES"		# Set host UUID.
 hostid_file="/etc/hostid"	# File with hostuuid.
+hostid_uuidgen_flags="-r"	# Flags to uuidgen.
 nisdomainname="NO"		# Set to NIS domain if using NIS (or NO).
 dhclient_program="/sbin/dhclient"	# Path to dhcp client program.
 dhclient_flags=""		# Extra flags to pass to dhcp client.
diff --git a/libexec/rc/rc.d/hostid b/libexec/rc/rc.d/hostid
index 3cf7dd42eb6c..317b53e06db4 100755
--- a/libexec/rc/rc.d/hostid
+++ b/libexec/rc/rc.d/hostid
@@ -117,7 +117,7 @@ hostid_generate()
 		warn "hostid: unable to figure out a UUID from DMI data, generating a new one"
 		sleep 2
 		# If not found, fall back to software-generated UUID.
-		uuid=`uuidgen`
+		uuid=`uuidgen ${hostid_uuidgen_flags}`
 	fi
 	hostid_set $uuid
 }