Restore use of dmidecode in dracut for assettag and uuid

This prevents exposing these values in /proc/cmdline.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-09-05 18:39:31 -04:00
parent c2e4ca5b59
commit e2da5b6d09
5 changed files with 11 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ depends() {
}
install() {
inst_multiple cpio curl
inst_multiple cpio curl dmidecode
inst_hook cmdline 30 "$moddir/parse-wwinit.sh"
inst_hook pre-mount 30 "$moddir/load-wwinit.sh"
}

View File

@@ -6,7 +6,9 @@
if [ "${root}" = "wwinit" ]
then
info "root=${root}"
wwinit_uri="$(getarg wwinit.uri)"
uuid=$(dmidecode -s system-uuid)
assetkey=$(dmidecode -s chassis-asset-tag | sed -E -e 's/(^ +| +$)//g' -e 's/^(Unknown|Not Specified)$//g' -e 's/ /_/g')
wwinit_uri="$(getarg wwinit.uri)?assetkey=${assetkey}&uuid=${uuid}"
export wwinit_container="${wwinit_uri}&stage=container&compress=gz"; info "wwinit_container=${wwinit_container}"
export wwinit_system="${wwinit_uri}&stage=system&compress=gz"; info "wwinit_system=${wwinit_system}"
export wwinit_runtime="${wwinit_uri}&stage=runtime&compress=gz"; info "wwinit_runtime=${wwinit_runtime}"

View File

@@ -42,7 +42,7 @@ menuentry "Network boot node: {{.Id}}" --id ww4 {
menuentry "Network boot node with dracut: {{.Id}}" --id dracut {
initramfs="${uri}&stage=initramfs"
wwinit_uri="http://{{.Ipaddr}}:{{.Port}}/provision/${net_default_mac}?assetkey=${assetkey}"
wwinit_uri="http://{{.Ipaddr}}:{{.Port}}/provision/${net_default_mac}"
{{if .KernelOverride }}
echo "Kernel: {{.KernelOverride}}"

View File

@@ -13,7 +13,8 @@ echo Kernel: {{.ContainerName}} (container default)
echo KernelArgs: {{.KernelArgs}}
echo
set uri http://{{.Ipaddr}}:{{.Port}}/provision/{{.Hwaddr}}?assetkey=${asset}&uuid=${uuid}
set baseuri http://{{.Ipaddr}}:{{.Port}}/provision/{{.Hwaddr}}
set uri ${baseuri}?assetkey=${asset}&uuid=${uuid}
echo Warewulf Controller: {{.Ipaddr}}
echo Downloading Kernel Image:
@@ -29,7 +30,7 @@ echo Downloading initramfs
initrd --name initramfs ${uri}&stage=initramfs || goto reboot
set dracut_net rd.neednet=1 {{range $devname, $netdev := .NetDevs}}{{if and $netdev.Hwaddr $netdev.Device}} ifname={{$netdev.Device}}:{{$netdev.Hwaddr}} {{end}}{{end}}
set dracut_wwinit root=wwinit wwinit.uri=${uri} {{if ne .KernelOverride ""}}wwinit.KernelOverride={{ .KernelOverride }}{{end}} init=/init
set dracut_wwinit root=wwinit wwinit.uri=${baseuri} {{if ne .KernelOverride ""}}wwinit.KernelOverride={{ .KernelOverride }}{{end}} init=/init
echo Booting initramfs
#echo Network KernelArgs: ${dracut_net}

View File

@@ -95,6 +95,7 @@ Requires: dracut-network
%endif
Requires: curl
Requires: cpio
Requires: dmidecode
%description dracut
Warewulf is a stateless and diskless container operating system provisioning
@@ -220,7 +221,7 @@ getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
%changelog
* Tue Jun 18 2024 Josh Burks <jeburks2@asu.edu>
- Add curl, cpio as requires for warewulf-dracut
- Add curl, cpio, and dracut as requires for warewulf-dracut
* Thu Apr 18 2024 Jonathon Anderson <janderson@ciq.com>
- New warewulf-dracut subpackage