From 246f6626d6c22220c1a9fb5410ea1ee649556b1e Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Wed, 2 Sep 2026 07:46:47 -0500 Subject: [PATCH] Send all four firmware fields with a registration (fogproject #198) Both registration scripts sent the system UUID, and the auto path the system serial. FOG 1.6 now identifies a machine by four SMBIOS fields -- UUID, system serial, baseboard serial, chassis asset tag -- and its registration path (fogproject #1674) scores whatever arrives, so a machine whose NIC was replaced is recognized as its existing host instead of registering a duplicate. One field scores one point; sending all four is what makes the match unambiguous on hardware where the UUID is a placeholder. The values are read, lowercased and base64-encoded exactly as sysuuid already was, and are sent on the hostexists check as well as the register call, since the manual path stops at the check. doInventory() overwrites every one of these variables from dmidecode afterward, so nothing here reaches the inventory POST. A server that does not know the fields ignores them. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01LVm9aM4BHJywMoh1eaJMpZ --- .../FOG/FOS/rootfs_overlay/bin/fog.auto.reg | 11 ++++++++++- .../board/FOG/FOS/rootfs_overlay/bin/fog.man.reg | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.auto.reg b/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.auto.reg index 3ec9264..4743fe3 100755 --- a/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.auto.reg +++ b/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.auto.reg @@ -65,6 +65,15 @@ sysuuid=$(echo $sysuuid | base64) sysserial=$(dmidecode -s system-serial-number) sysserial=${sysserial,,} sysserial=$(echo $sysserial | base64) +# The board serial and chassis asset tag join the UUID and system serial +# so the server can identify this machine by firmware, not only by MAC +# (fogproject #198). A server that does not know the fields ignores them. +mbserial=$(dmidecode -s baseboard-serial-number) +mbserial=${mbserial,,} +mbserial=$(echo $mbserial | base64) +caseasset=$(dmidecode -s chassis-asset-tag) +caseasset=${caseasset,,} +caseasset=$(echo $caseasset | base64) dots "Attempting to register host" count=0 res="" @@ -73,7 +82,7 @@ if [[ -f /sys/firmware/acpi/tables/MSDM ]]; then productKey=$(tail -c+57 /sys/firmware/acpi/tables/MSDM | base64) fi while [[ -z $res ]]; do - callServer "${web}service/auto.register.php" "sysserial=${sysserial}&sysuuid=${sysuuid}&mac=$mac&productKey=${productKey}" + callServer "${web}service/auto.register.php" "sysserial=${sysserial}&sysuuid=${sysuuid}&mbserial=${mbserial}&caseasset=${caseasset}&mac=$mac&productKey=${productKey}" res="$serverBody" case $count in [0-8]) diff --git a/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.man.reg b/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.man.reg index d29594d..55adf58 100755 --- a/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.man.reg +++ b/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.man.reg @@ -61,7 +61,19 @@ mac=$(getMACAddresses | base64) sysuuid=$(dmidecode -s system-uuid) sysuuid=${sysuuid,,} sysuuid=$(echo $sysuuid | base64) -callServer "${web}service/man.hostexists.php" "sysuuid=${sysuuid}&mac=$mac" +sysserial=$(dmidecode -s system-serial-number) +sysserial=${sysserial,,} +sysserial=$(echo $sysserial | base64) +# The board serial and chassis asset tag join the UUID and system serial +# so the server can identify this machine by firmware, not only by MAC +# (fogproject #198). A server that does not know the fields ignores them. +mbserial=$(dmidecode -s baseboard-serial-number) +mbserial=${mbserial,,} +mbserial=$(echo $mbserial | base64) +caseasset=$(dmidecode -s chassis-asset-tag) +caseasset=${caseasset,,} +caseasset=$(echo $caseasset | base64) +callServer "${web}service/man.hostexists.php" "sysuuid=${sysuuid}&sysserial=${sysserial}&mbserial=${mbserial}&caseasset=${caseasset}&mac=$mac" exists="$serverBody" checkAndSet() { local testvar="$1" @@ -382,7 +394,7 @@ res="" # two seconds when the server was unreachable, so the operator watched a blank # console with no idea anything was wrong. while [[ -z $res ]]; do - callServer "${web}service/auto.register.php" "sysuuid=${sysuuid}&mac=$mac&advanced=$(echo -n 1 | base64)&host=$host&imageid=$imageid&primaryuser=$primaryuser&other1=$other1&other2=$other2&doimage=$realdoimage&doad=$blDoAD&location=$location64&ou=$ou64&username=$user64&password=$pass64&groupid=$group64&snapinid=$snapin64&productKey=$productKey" + callServer "${web}service/auto.register.php" "sysuuid=${sysuuid}&sysserial=${sysserial}&mbserial=${mbserial}&caseasset=${caseasset}&mac=$mac&advanced=$(echo -n 1 | base64)&host=$host&imageid=$imageid&primaryuser=$primaryuser&other1=$other1&other2=$other2&doimage=$realdoimage&doad=$blDoAD&location=$location64&ou=$ou64&username=$user64&password=$pass64&groupid=$group64&snapinid=$snapin64&productKey=$productKey" res="$serverBody" echo "${serverReason:-$res}" usleep 2000000