mkimage-profiles/features.in/syslinux/scripts.d/20-propagator-rescue-hash
Michael Shigorin a2fcc601c9 syslinux: process @rescue_hash@ (forensic mode)
This value is used to authenticate rescue rootfs image
by verifying the squashfs file's sha256sum before use
(propagator-20140419+).

Looks like this check might be useful for other stage2
images as well but let's get started with this one.

Thanks Maxim Suhanov <suhanov/group-ib.ru> for both
http://www.forensicswiki.org/wiki/Forensic_Live_CD_issues
and propagator patches.
2014-04-19 13:48:11 +04:00

15 lines
364 B
Bash
Executable File

#!/bin/sh
# postprocess isolinux configuration
# to add rescue image hash, if any
# (for propagator in forensic mode)
cd "$WORKDIR"
grep -qs "@rescue_hash@" syslinux/*.cfg || exit 0
find -maxdepth 1 -type f -name rescue \
| while read image; do
rescue_hash="$(sha256sum -b "$image" | cut -f1 -d' ')"
sed -i "s,@rescue_hash@,$rescue_hash," syslinux/*.cfg
done