summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2009-10-26 12:51:22 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 17:48:06 +0100
commitf47a93a78a4a7d45d3db17184d592895dd913a4d (patch)
tree7565420766c3247b1f30d232c5b3e50744f5ce52 /scripts
parentd2a27717cc6ba6688942fcbfbf49164f01253291 (diff)
downloadlive-boot-f47a93a78a4a7d45d3db17184d592895dd913a4d.tar.gz
live-boot-f47a93a78a4a7d45d3db17184d592895dd913a4d.zip
Adapting a patch from Michael Prokop <mika@grml.org> to set all harddisk devices to read-only mode for forensics investigations.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/live-premount/readonly35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/live-premount/readonly b/scripts/live-premount/readonly
new file mode 100755
index 0000000..8bed733
--- /dev/null
+++ b/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