Skip to content

Commit

Permalink
Adapting a patch from Michael Prokop <mika@grml.org> to set all hardd…
Browse files Browse the repository at this point in the history
…isk devices to read-only mode for forensics investigations.
  • Loading branch information
daniel-baumann committed Jan 31, 2010
1 parent 0b23566 commit 97846cf
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hooks/live
Expand Up @@ -174,6 +174,12 @@ then
copy_exec /usr/bin/wget /bin
fi

# Program: blockdev
if [ -x /sbin/blockdev ]
then
copy_exec /sbin/blockdev /sbin
fi

# FUSE kernel module
manual_add_modules fuse

Expand Down
35 changes: 35 additions & 0 deletions scripts/live-premount/readonly
@@ -0,0 +1,35 @@
#!/bin/sh

#set -e

# initramfs-tools header

PREREQ="udev"

prereqs()
{
echo "${PREREQ}"
}

case "${1}" in
prereqs)
prereqs
exit 0
;;
esac

# live-initramfs script

# make sure all harddisk devices are read-only
# this is important for forensic investigations
if grep -qe forensic -qe readonly /proc/cmdline
then
for device in /dev/hd* /dev/sd* /dev/vd*
do
if [ -b "$device" ]
then
printf " * Setting device %-9s to read-only mode: " $device >/dev/console
blockdev --setro $device && printf "done [ execute \"blockdev --setrw %-9s\" to unlock]\n" $device >/dev/console || printf "failed\n" >/dev/console
fi
done
fi

0 comments on commit 97846cf

Please sign in to comment.