#!/bin/sh
+# systemd lets stdout go to journal only, but the system
+# has to halt when the integrity check fails to satisfy FIPS.
+if [ -z "$DRACUT_SYSTEMD" ]; then
+ fips_info() {
+ info "$*"
+ }
+else
+ fips_info() {
+ echo "$*" >&2
+ }
+fi
+
mount_boot()
{
boot=$(getarg boot=)
[ -e "$boot" ] || return 1
mkdir /boot
- info "Mounting $boot as /boot"
+ fips_info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
elif [ -d "$NEWROOT/boot" ]; then
rm -fr -- /boot
warn "HMAC sum mismatch"
return 1
fi
- info "rhevh_check OK"
+ fips_info "rhevh_check OK"
return 0
}
{
FIPSMODULES=$(cat /etc/fipsmodules)
- info "Loading and integrity checking all crypto modules"
+ fips_info "Loading and integrity checking all crypto modules"
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
- info "Self testing crypto algorithms"
+ fips_info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt
}
KERNEL=$(uname -r)
- info "Checking integrity of kernel"
+ fips_info "Checking integrity of kernel"
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
fi
- info "All initrd crypto checks done"
+ fips_info "All initrd crypto checks done"
> /tmp/fipsdone