As an another countermeasure against security threats I wrote a little script that computes MBR and boot checksum and then compare it to the old one. As long as the computer is running this is OK, but when I restart it, the checksum is changed.
QUESTION -- what is the cause of changing and how to prevent it?
Details:
openSUSE 13.2, noatime for /boot
set, boot parition is a separate partition (it is not just a directory in root filesystem), the partition is unmounted right after I log in and it is the first step before the computation of the
checsum.
The script:
#!/bin/sh
sudo umount /boot
# MBR
sudo dd if=/dev/sda bs=512 status=noxfer count=1 | sha1sum | diff bootcheck_mbr.sha1 -
MBR_RES=$?
# boot partition
sudo dd if=/dev/sda1 bs=1M status=noxfer | sha1sum | diff bootcheck_boot.sha1 -
BOOT_RES=$?
if [[ $MBR_RES -ne 0 ]] || [[ $BOOT_RES -ne 0 ]]
then
kdialog --sorry "WARNING:\nBoot disk is changed." --title "BOOT CHECK" --geometry 0x0++300+400
else
kdialog --title "Boot check" --passivepopup "The disk is unchanged." 25 --geometry 0x0++300+400
fi