Skip to content

Commit 4cdb9b6

Browse files
qemu-secex: drop hardcoded 'secex-hostkey' name and inject user-provided file instead
1 parent 979c3f4 commit 4cdb9b6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/cmd-osbuild

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,20 @@ postprocess_qemu_secex() {
8686
if [ ! -f "${hostkey}" ]; then
8787
fatal "No hostkey and no genprotimgvm provided"
8888
fi
89-
ignition=$(mktemp -p "${tmp_builddir}")
90-
butane -p -d "$(dirname "${hostkey}")" /usr/lib/coreos-assembler/secex-genprotimgvm-scripts/genprotimg.bu -o "${ignition}"
89+
echo "Injecting user-provided hostkey into config"
90+
ignition_cfg=$(mktemp -p "${tmp_builddir}")
91+
butane_cfg=$(mktemp -p "${tmp_builddir}")
92+
hostkey_name=$(basename "${hostkey}")
93+
hostkey_path=$(dirname "${hostkey}")
94+
cp /usr/lib/coreos-assembler/secex-genprotimgvm-scripts/genprotimg.bu "${butane_cfg}"
95+
sed -i 's/HOSTKEY-FILE/'"${hostkey_name}"'/g' "${butane_cfg}"
96+
butane -p -d "${hostkey_path}" "${butane_cfg}" -o "${ignition_cfg}"
9197

9298
cp "/srv/builds/latest/${basearch}/${name}-${build}-qemu.${basearch}.${suffix}" "${genprotimgvm}"
9399
chmod +w "${genprotimgvm}"
94100
genvm_args=("-drive" "if=none,id=hda,format=qcow2,file=${genprotimgvm},auto-read-only=off,cache=unsafe" \
95101
"-device" "virtio-blk,drive=hda,bootindex=1")
96-
kola qemuexec -i "${ignition}" -- "${genvm_args[@]}"
102+
kola qemuexec -i "${ignition_cfg}" -- "${genvm_args[@]}"
97103
fi
98104
fi
99105

src/secex-genprotimgvm-scripts/genprotimg.bu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ storage:
1313
- path: /etc/se-hostkeys/ibm-z-hostkey-1
1414
overwrite: true
1515
contents:
16-
local: secex-hostkey
16+
local: HOSTKEY-FILE
1717
- path: /usr/local/bin/do_genprotimg
1818
overwrite: true
1919
mode: 0755

0 commit comments

Comments
 (0)