aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTijl Coosemans <tijl@FreeBSD.org>2023-03-09 09:02:45 +0000
committerTijl Coosemans <tijl@FreeBSD.org>2023-03-09 09:31:39 +0000
commit862aab6281a5e6b5dad89761ac17ca2a0e83ab32 (patch)
tree44e25b60c23d993f9c89b7b70521898690424f6f
parentb61758494286db075d5c6b68a5f2e7522e7be394 (diff)
downloadsrc-862aab6281a5e6b5dad89761ac17ca2a0e83ab32.tar.gz
src-862aab6281a5e6b5dad89761ac17ca2a0e83ab32.zip
hostid: Generate random UUID by default
This way MAC addresses are no longer exposed. Discussed with: bapt MFC after: 3 days
-rw-r--r--libexec/rc/rc.conf1
-rwxr-xr-xlibexec/rc/rc.d/hostid2
2 files changed, 2 insertions, 1 deletions
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 9bb7cf2f3cc1..8a5f69dbef12 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -137,6 +137,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 494e4aba84e1..8db475694090 100755
--- a/libexec/rc/rc.d/hostid
+++ b/libexec/rc/rc.d/hostid
@@ -126,7 +126,7 @@ hostid_generate()
# Generate a random UUID if invalid or not found
if [ -z "${uuid}" ]; then
# If not found, fall back to software-generated UUID.
- uuid=`uuidgen`
+ uuid=`uuidgen ${hostid_uuidgen_flags}`
fi
hostid_set $uuid
}