Added new software bundle 'mll_utils'. Currently it contains a disk nuke utility/script which securely wipes partitions/disks.

This commit is contained in:
Ivan Davidov 2016-10-15 19:58:39 +03:00
parent c8c82a1f0d
commit a80d1d07a7
5 changed files with 117 additions and 1 deletions

View File

@ -148,10 +148,11 @@ COPY_SOURCE_ISO=true
# dropbear - SSH server and client. # dropbear - SSH server and client.
# java - installs Oracle's JRE or JDK. Manual preparations are required. # java - installs Oracle's JRE or JDK. Manual preparations are required.
# felix - Apache Felix OSGi framework. # felix - Apache Felix OSGi framework.
# mll_utils - set of executable utilities (mll-*).
# #
# Refer to the README file for more information. # Refer to the README file for more information.
# #
#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix #OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils
# This property enables the standard penguin boot logo in the upper left corner # This property enables the standard penguin boot logo in the upper left corner
# of the screen. The property is used in 'xx_build_kernel.sh'. The default value # of the screen. The property is used in 'xx_build_kernel.sh'. The default value

6
src/overlay_mll_utils.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
time sh overlay_mll_utils_01_prepare.sh
time sh overlay_mll_utils_02_disk_erase.sh
time sh overlay_mll_utils_03_install.sh

View File

@ -0,0 +1,12 @@
#!/bin/sh
SRC_DIR=$(pwd)
echo "Preparing the Minimal Linux Live utilities folder. This may take a while..."
rm -rf work/overlay/mll_utils
mkdir -p work/overlay/mll_utils/sbin
echo "Miminal Linux Live utilities folder has been prepared."
cd $SRC_DIR

View File

@ -0,0 +1,80 @@
#!/bin/sh
SRC_DIR=$(pwd)
if [ ! -d "$SRC_DIR/work/overlay/mll_utils" ] ; then
echo "The directory $SRC_DIR/work/overlay/mll_utils does not exist. Cannot continue."
exit 1
fi
cd work/overlay/mll_utils
# 'mll-disk-erase' BEGIN
# This script erases disks in secure way by overwriting all sectors with random
# data. Data recovery is impossible even for NSA and CIA.
cat << CEOF > sbin/mll-disk-erase
#!/bin/sh
PRINT_HELP=false
if [ "\$1" = "" -o "\$1" = "-h" -o "\$1" = "--help" ] ; then
PRINT_HELP=true
fi
# Put more business logic here (if needed).
if [ "\$PRINT_HELP" = "true" ] ; then
cat << DEOF
This utility wipes disk partitions or entire disks in secure way by
overwriting all sectors with random data. Use the '-h' or '--help' option
to print again this information. Requires root permissions.
Usage: mll-disk-erase DEVICE [loops]
DEVICE The device which will be wiped. Specify only the name, e.g. 'sda'.
The utility will automatically convert this to '/dev/sda' and will
exit with warning message if the actual device does not exist.
loops How many times to wipe the specified partition or disk. The default
value is 1. Use higher value for multiple wipes in order to ensure
that no one can recover your data.
mll-disk-erase sdb 8
The above example wipes '/dev/sdb' 8 times in row.
DEOF
exit 0
fi
if [ ! "$(id -u)" = "0" ] ; then
echo "You need root permissions. Use '-h' or '--help' for more information."
exit 1
fi
if [ ! -e /dev/\$1 ] ; then
echo "Device '/dev/\$1' does not exist. Use '-h' or '--help' for more information."
exit 1
fi
NUM_LOOPS=1
if [ ! "\$2" = "" ] ; then
NUM_LOOPS=\$2
fi
for n in \$(seq \$NUM_LOOPS) ; do
dd if=/dev/urandom of=/dev/\$1 bs=1024b conv=notrunc
done
CEOF
chmod +rx sbin/mll-disk-erase
# 'mll-disk-erase' END
echo "Utility script 'mll-disk-erase' has been generated."
cd $SRC_DIR

View File

@ -0,0 +1,17 @@
#!/bin/sh
SRC_DIR=$(pwd)
if [ ! -d "$SRC_DIR/work/overlay/mll_utils" ] ; then
echo "The directory $SRC_DIR/work/overlay/mll_utils does not exist. Cannot continue."
exit 1
fi
# Copy all generated files to the source overlay folder.
cp -r $SRC_DIR/work/overlay/mll_utils/* \
$SRC_DIR/work/src/minimal_overlay
echo "All utilities have been installed."
cd $SRC_DIR