Warning: file_get_contents(/home/sechome/www/git/repositories): failed to open stream: No such file or directory in /home/brad/bcable.net/includes/proj_vars.php on line 166
primary partition 1 - FAT32 - ~7GB primary partition 2 - FAT32 - ~750MB - boot flag logical partition 5 - FAT32 - ~3MB logical partition 6 - AES-256 ENCRYPTED ext2 - ~300MB
drwxr-xr-x 2 root root 2048 2009-10-06 05:20 scripts/ -rwxr-xr-x 1 root root 1048576 2008-03-10 20:22 .ss
-rwxr-xr-x 1 root root 798 2009-10-06 00:17 grml.shThe "myconfig" boot-option is provided by Primary Partition 2, and GRML executes "scripts/grml.sh" in the partition specified (this one).
#!/bin/bash
echo loading grml.sh
echo ran grml.sh > /tmp/grml.sh
# rtc
echo 1024 > /proc/sys/dev/rtc/max-user-freq
# get running grml partition
grml_part="`mount | grep " on /mnt/grml " | cut -d ' ' -f1`"
grml_partnum="`echo $grml_part | sed -r "s/.*([0-9]+)/\1/g"`"
grml_dev="`echo $grml_part | sed -r "s/(.*)[0-9]+/\1/g"`"
grml_part="$grml_dev$grml_partnum"
# get the device partition plus X
function grml_devplus(){
new="$grml_partnum"
let new+=$1
echo $grml_dev$new
}
# mount secure home
clear
bash /mnt/grml/smount /mnt/grml/.ss "`grml_devplus 1`" /home/sechome 0
# /etc/fstab fixer
mv /etc/fstab /etc/fstab.old
cat /etc/fstab.old | grep -v "`grml_devplus 0`" > /etc/fstab
rm /etc/fstab.old
# system-work
echo "bash /home/sechome/grml/system-work "`grml_devplus 0` > /root/.zshrc
# disable grml-quickconfig
echo > /usr/sbin/grml-quickconfig
The "smount" file is used to mount a helper file/partition, then use the files within to mount a secure partition. This, as described earlier, ensures that the real password is not stored in RAM or DRAM, and makes a harder to crack main partition (in theory, anyway).
"smount" takes three or four arguments. The first is the helper file, the second is the data partition, and the third is the destination mount point. An optional fourth argument can be specified which tells the script how many times the use has to guess the correct password before failing. The default is 4, and 0 means try forever (0 is passed in from grml.sh).
#!/bin/bash
# these aren't the values I use
LO_ICK_UNLOCK=1234
LO_ICK_REAL=5678
unlock_source="$1"
data_source="$2"
destination="$3"
# total tries
if [ -z "$4" ]; then tottries="4"; else tottries="$4"; fi
if [ "$4" = "0" ]; then tottries=""; fi
# get new loopback device
function get_loopdev(){
loop_devs=`ls -d /dev/loop*`
for loop_dev in $loop_devs; do
[ ! -b "$loop_dev" ] && continue
ret="`losetup $loop_dev 2> /dev/null`"
[ -z "$ret" ] && echo $loop_dev && break
done
}
# quit cleanly
function quit_clean(){
umount /tmp/usbtemp &> /dev/null
losetup -d $unlock_loop &> /dev/null
rmdir /tmp/usbtemp
exit
}
# secure home
if [ -e "$unlock_source" ] && [ -e "$data_source" ]; then
# modules
modprobe cryptoloop
modprobe aes
# home-setup
unlock_loop="`get_loopdev`"
mkdir /tmp/usbtemp
tries=0
while
[ ! -e "/tmp/usbtemp/pwfile" ] &&
([ -z "$tottries" ] || [ "$tottries" -gt "$tries" ])
do
losetup -d $unlock_loop &> /dev/null
losetup -e aes-256 -C $LO_ICK_UNLOCK $unlock_loop $unlock_source
mount $unlock_loop /tmp/usbtemp &> /dev/null
let tries+=1
done
if [ ! -e "/tmp/usbtemp/pwfile" ]; then quit_clean; fi
home_loop="`get_loopdev`"
[ ! -d "$destination" ] && mkdir "$destination"
cat /tmp/usbtemp/pwfile | \
losetup -e aes-256 -C $LO_ICK_REAL -p 0 -S "`cat /tmp/usbtemp/seedfile`" \
$home_loop $data_source
mount $home_loop "$destination"
chown root.root "$destination"
chmod 755 "$destination"
quit_clean
fi
The ".ss" file is the encrypted helper file. grml.sh calls smount with this file as a parameter, using it to mount the actual partition. ".ss" is read using it as an encrypted loopback file (Linux cryptoloop module), then has it's own encrypted FAT32 filesystem within it. This can be seen by examining grml.sh and smount in detail.
-rwxr-xr-x 1 root root 73 2006-03-18 16:32 pwfile -rwxr-xr-x 1 root root 73 2006-03-18 16:34 seedfile
What, do you think I'm stupid? I'm not giving you this!
drwxr-xr-x 2 root root 1024 2008-03-09 13:34 addons/ drwx------ 5 grml grml 2048 2008-02-04 16:52 docs/ drwxr-xr-x 3 root root 1024 2008-03-09 13:56 grml/ drwxr-xr-x 5 grml grml 4096 2009-08-14 21:34 mail/ drwxr-xr-t 17 grml grml 1024 2008-01-06 08:39 proj/ drwxr-xr-t 4 grml grml 2048 2007-10-25 11:12 scripts/ drwx------ 6 root root 1024 2006-08-06 08:53 .staticfs/ drwx-----T 19 root root 1024 2008-03-10 20:13 .statichome/ drwx-----T 6 root root 1024 2008-03-09 14:24 .staticroot/ drwxr-xr-x 23 grml grml 3072 2008-02-13 18:27 www/
lrwxrwxrwx 1 root root 27 2009-10-24 13:07 amd64 -> /home/sechome/addons/x86_64/ lrwxrwxrwx 1 root root 24 2009-10-24 13:07 i386 -> /home/sechome/addons/x86/ lrwxrwxrwx 1 root root 24 2009-10-24 13:07 i686 -> /home/sechome/addons/x86/ drwx------ 3 root root 4096 2009-10-30 15:57 x86/ drwx------ 6 root root 4096 2009-10-25 02:05 x86_64/
-rwx------ 1 root root 21864448 2009-10-30 09:43 addons.fs -rw-r--r-- 1 root root 900 2009-10-30 09:43 addons.list.txt -rw-r--r-- 1 root root 334 2009-10-28 11:01 addons.txt drwxr-xr-x 8 root root 4096 2009-10-30 09:43 dpkg/
-rwx------ 1 root root 151588864 2009-10-25 02:06 addons.fs -rw-r--r-- 1 root root 3849 2009-10-25 02:05 addons.list.txt -rw-r--r-- 1 root root 62 2009-10-25 02:06 addons.pkgs0.txt -rw-r--r-- 1 root root 452 2009-10-25 02:06 addons.pkgs1.txt -rw-r--r-- 1 root root 169 2009-10-25 02:06 addons.pkgs2.txt -rw-r--r-- 1 root root 952 2009-10-28 11:01 addons.txt drwxr-xr-x 8 root root 4096 2009-10-25 02:05 dpkg/ drwxr-xr-x 2 root root 4096 2009-10-25 01:29 pkgs0/ drwxr-xr-x 2 root root 4096 2009-10-25 01:29 pkgs1/ drwxr-xr-x 2 root root 4096 2009-11-01 12:56 pkgs2/
#!/bin/bash
# see if tmp path was specified
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "tmp paths and/or debug mode info required"
exit 1
fi
# debug mode doesn't clear out /var/cache/apt/archives/*deb
if [ "$4" = "-d" ]; then
DEBUG_MODE="1"
SLIM="$5"
else
DEBUG_MODE=""
SLIM="$4"
fi
# slim mode
if [ -z "$SLIM" ]; then
ADDONS_DIR="/home/sechome/addons/`arch`"
else
ADDONS_DIR="/home/sechome/addons/slim"
fi
MKFS="/usr/bin/mksquashfs-lzma"
DEB_STORE="$1" # /var/cache/apt/archives
FSROOT="$2" # for installation method 1
FSROOT_2="$3" # for installation method 2
FSFILE="$ADDONS_DIR/addons.fs"
DPKG_DIR="$ADDONS_DIR/dpkg"
PACKAGES_FILE="$ADDONS_DIR/addons.txt"
PACKAGES_FORCE="$ADDONS_DIR/addons.force.txt"
PACKAGES_HOLD="$ADDONS_DIR/addons.hold.txt"
PACKAGES_LIST="$ADDONS_DIR/addons.list.txt"
# enable slim mode
if [ ! -z "$SLIM" ]; then
ADDONS_DIR="$ADDONS_DIR_SLIM"
fi
# create root directory
rm -rf $FSROOT
mkdir $FSROOT
rm -rf $FSROOT_2
mkdir $FSROOT_2
# remove existing debian archives in cache
if [ -z "$DEBUG_MODE" ]; then
# mount place to store debian packages (saves space on the 2GB rootfs)
mkdir $DEB_STORE
rm -rf /var/cache/apt/archives/*
mount --bind $DEB_STORE /var/cache/apt/archives
mkdir /var/cache/apt/archives/partial
fi
# pkgs0 has packages that affect 'apt-get update'
dpkg -i $ADDONS_DIR/pkgs0/*.deb
# cmds0 has commands that affect 'apt-get update'
bash $ADDONS_DIR/cmds0/*.sh
# run apt-get on the packages to install
apt-get update
wajig hold `cat $PACKAGES_HOLD | grep -vE "^#"`
apt-get -d -y --force-yes install `cat $PACKAGES_FILE | grep -vE "^#"`
cd /var/cache/apt/archives
aptitude download `cat $PACKAGES_FILE | grep -vE "^#"`
aptitude download `cat $PACKAGES_FORCE | grep -vE "^#"`
# doing it in this two method install ensures that all packages are accounted
# for
# chroot method 1: setup chroot dpkg directories
if [ -z "$SLIM" ]; then
mkdir -p $FSROOT/var/lib/dpkg/info
mkdir -p $FSROOT/var/lib/dpkg/updates
mkdir -p $FSROOT/usr/share
cp /var/lib/dpkg/* $FSROOT/var/lib/dpkg
cp -r /var/lib/dpkg/info $FSROOT/var/lib/dpkg
cp -r /var/lib/dpkg/updates $FSROOT/var/lib/dpkg
cp -r /usr/share/debconf $FSROOT/usr/share
fi
# install method 1: do the install on the current root partition, ensuring all
# files get copied
dpkg --force-all --abort-after=999999999 -i /var/cache/apt/archives/*deb
# create list
cd /var/cache/apt/archives
ls -1 *deb > $PACKAGES_LIST
# create file list
rm -f /tmp/file_list
echo > /tmp/file_list
cat $PACKAGES_LIST | while read debpkg; do
pkg="`echo "$debpkg" | sed -r "s/^([^_]+).*?$/\\1/g"`"
cat /var/lib/dpkg/info/$pkg.list | while read line; do
echo "$line" >> /tmp/file_list
done
done
# copy the files locally to the new filesystem
cat /tmp/file_list | sort | uniq | while read line; do
if [ -d "$line" ]; then
mkdir "$FSROOT/$line"
else
cp -aP "$line" "$FSROOT/$line"
fi
done
# remove excess baggage
rm $FSROOT/var/lib/dpkg/*-old
# dpkg method 1: update dpkg database
rm -rf $DPKG_DIR
if [ -z "$SLIM" ]; then
cp -aP /var/lib/dpkg $DPKG_DIR
dpkg --merge-avail $DPKG_DIR/available
fi
# chroot method 2: setup chroot dpkg directories
if [ -z "$SLIM" ]; then
mkdir -p $FSROOT_2/var/lib/dpkg/info
mkdir -p $FSROOT_2/var/lib/dpkg/updates
mkdir -p $FSROOT_2/usr/share
cp /var/lib/dpkg/* $FSROOT_2/var/lib/dpkg
cp -r /var/lib/dpkg/info $FSROOT_2/var/lib/dpkg
cp -r /var/lib/dpkg/updates $FSROOT_2/var/lib/dpkg
cp -r /usr/share/debconf $FSROOT_2/usr/share
fi
# install method 2: install all packages to the filesystem root (overwriting the
# existing copies)
dpkg --force-confdef --force-confold --force-depends --root=$FSROOT_2 \
--abort-after=999999999 -i /var/cache/apt/archives/*deb
dpkg --force-confdef --force-confold --force-depends --root=$FSROOT_2 --unpack \
/var/cache/apt/archives/*deb
ls -1 /var/cache/apt/archives/*deb | xargs -I{} dpkg-deb -x {} $FSROOT_2
# dpkg method 2: update dpkg database
if [ -z "$SLIM" ]; then
cp -aP $FSROOT_2/var/lib/dpkg/* $DPKG_DIR
dpkg --merge-avail $DPKG_DIR/available
fi
# remove excess baggage
rm $FSROOT_2/var/lib/dpkg/*-old
# remove packages
if [ -z "$DEBUG_MODE" ]; then
rm /var/cache/apt/archives/*deb
umount /var/cache/apt/archives
rm -rf $DEB_STORE
fi
# combine the two methods; no clobbering (method 1 preferred)
cp -aP $FSROOT_2/* $FSROOT
# create file based on the new fsroot
rm $FSFILE
$MKFS $FSROOT $FSFILE
if [ -z "$DEBUG_MODE" ]; then
rm -rf $FSROOT
rm -rf $FSROOT_2
fi
# create list for extra packages
i=0
while [ -d "$ADDONS_DIR/pkgs$i" ]; do
ls -1 "$ADDONS_DIR/pkgs$i" > "$ADDONS_DIR/addons.pkgs$i.txt"
let i+=1
done
# synchronize (useful if on USB)
sync
The "grml" directory stores scripts that help set up and maintain the system.
drwxr-xr-x 3 root root 16384 1969-12-31 18:00 booter/ -rwx------ 1 root root 313 2010-02-12 14:02 local-startup-after -rwx------ 1 root root 296 2010-02-12 14:02 local-startup-before -rwx------ 1 root root 3926 2011-01-12 13:54 make-addons -rwx------ 1 root root 33602 2009-10-05 20:41 my-grml-x -rwx------ 1 root root 1221 2008-03-15 15:32 static-copy -rwx------ 1 root root 2388 2010-03-16 20:38 sync-os -rwx------ 1 root root 1454 2011-01-12 07:48 system-work -rwx------ 1 root root 282 2008-03-14 15:31 virtfs-init
#!/bin/bash # local-startup-before bash /home/sechome/grml/local-startup-before # setup addons fs, then append to aufs if [ -e "/home/sechome/addons/`arch`/addons.fs" ]; then echo "Select an addons configuration:" echo "A) Architecture Specific" echo "s) Slim" echo "n) None" read -p "[Asn]: " mode if [ "$mode" != "n" ] && [ "$mode" != "N" ]; then if [ "$mode" = "s" ] || [ "$mode" = "S" ]; then ARCH="slim" else ARCH="`arch`" fi # add addons squashfs to aufs mkdir /live/addons # TODO: figure out if this was necessary #cp /home/sechome/addons/$ARCH/addons.fs /live/addons.fs #mount -o loop /live/addons.fs /live/addons mount -o loop /home/sechome/addons/$ARCH/addons.fs /live/addons mount -o remount,append:/live/addons=ro / # setup dpkg database (for speed) dpkg --clear-avail cp -a /home/sechome/addons/$ARCH/dpkg/* /var/lib/dpkg dpkg --merge-avail /var/lib/dpkg/available # install other extra packages (nvidia drivers and 64-bit compatibility # packages mostly) i=0 while [ -d "/home/sechome/addons/$ARCH/pkgs$i" ]; do dpkg --force-all -i /home/sechome/addons/$ARCH/pkgs$i/*deb let i+=1 done # uninstall selected packages while read line; do apt-get -y remove "$line" done < /home/sechome/addons/$ARCH/addons.rm.txt fi fi # initialize virtual filesystem stuff bash /home/sechome/grml/virtfs-init # mounts the 'boot' partition to an easily accessed and backed up directory bootdev="$1" bootname="`echo "$bootdev" | cut -d '/' -f3`" mount $bootdev /mnt/$bootname mount --bind /mnt/grml /home/sechome/grml/booter # my-grml-x ln -s /home/sechome/grml/my-grml-x /usr/bin/my-grml-x # local-startup-after bash /home/sechome/grml/local-startup-after # teh edn (sleep 0.5; killall -9 zsh) & disownThis file creates the process described in Virtual Directories. There is an optional argument, "nofs", which will prevent the script from utilizing ".staticfs". This option is used by sync-os.
#!/bin/bash # home-work rm -rf /home/grml cp -r /home/sechome/.statichome /home/grml chown -R grml.grml /home/grml # root-work rm -rf /root cp -r /home/sechome/.staticroot /root chown -R root.root /root # fs-work if [ "$1" != "nofs" ]; then cp -r /home/sechome/.staticfs/* / fiAny application can store logs, private information, and other random status files in a user's home directory. These files are unnecessary for the most part, and can increase wear on a device such as a USB drive, especially if all of the information is to be encrypted before being stored. To prevent unnecessary wear, and to reduce logging of personal data, I leave the user's home directory as a part of the ramdisk generated by the operating system. The directories ".statichome" and ".staticroot" are copied over to the ramdisk by virtfs-init, then any changes that are made by any application are removed when the system is shut down. The same thing is done for the root filesystem ("/") with the directory ".staticfs".
alias revert-fs="/home/sechome/grml/static-copy revert /home/sechome/.staticfs /" alias revert-home="/home/sechome/grml/static-copy revert /home/sechome/.statichome /home/grml" alias revert-root="/home/sechome/grml/static-copy revert /home/sechome/.staticroot /root" alias save-fs="/home/sechome/grml/static-copy save /home/sechome/.staticfs /" alias save-home="/home/sechome/grml/static-copy save /home/sechome/.statichome /home/grml" alias save-root="/home/sechome/grml/static-copy save /home/sechome/.staticroot /root"
#!/bin/bash
command="$1"
staticdir="$2"
dynamicdir="$3"
filename="$4"
if [ -z "$filename" ]; then
echo Error: No file specified.
exit
fi
if [ -z "$staticdir" ]; then
echo Error: No static directory specified.
exit
fi
if [ -z "$dynamicdir" ]; then
echo Error: No dynamic directory specified.
exit
fi
if [ "${filename:0:1}" = "*" ]; then
echo "Error: That could be dangerous... catastrophe averted."
exit
fi
if [ "$command" = "revert" ]; then
origindir="$staticdir"
destdir="$dynamicdir"
prompt="Really revert file '$filename' to static directory version? "
waitmsg="Reverting file to static directory version... "
elif [ "$command" = "save" ]; then
origindir="$dynamicdir"
destdir="$staticdir"
prompt="Really save current file '$filename' to static directory? "
waitmsg="Saving file to static directory... "
else
echo Error: Unknown command.
exit
fi
[ ! -e "$origindir/$filename" ] && \
echo "No such file or directory '$filename' in '$origindir'" && exit
echo -n "$prompt"
choice=`bash -c "read -n 1 choice; echo \\$choice"`
echo
if [ "$choice" = "y" ]; then
echo -n "$waitmsg"
rm -rf "$destdir/$filename"
cp -ar "$origindir/$filename" "$destdir/$filename"
echo Done
else
echo Quitting
fi
The system is set up so that everything is contained within /home/sechome/. The only thing that isn't in this directory is the boot partition, which is why system-work bind mounts this partition to /home/sechome/grml/booter/.
# these aren't the values I use
BKUP_ICK=1234
BKUP_SEED=5678
function encbkup(){
(tar cj \
--exclude=/home/sechome/addons/*/*.fs \
--exclude=/home/sechome/addons/*/pkgs* \
--exclude=/home/sechome/addons/*/dpkg \
--exclude=/home/sechome/.codecs* \
/home/sechome | \
aespipe -e aes256 -C $BKUP_ICK -S $BKUP_SEED -T) \
> "bkup`date +%Y%m%d`";
}
function decbkup(){
(aespipe -d -e aes256 -C $BKUP_ICK -S $BKUP_SEED < "$1") | \
tar xj;
}
Synchronization is performed by specifying a direction and device to synchronize the current running instance of the system with. Currently, synchronization is a one way action, so if different changes were made on two different systems, any synchronization actions performed would clear any changes on one of the two systems depending on what is specified.
#!/bin/bash
if [ "$1" != "to" ] && [ "$1" != "from" ]; then
echo "First argument must be 'to' or 'from'."
exit
fi
if [ -z "$2" ]; then
echo "Second argument must point to GRML partition."
exit
fi
action="$1"
n_booter_dev="$2"
SYNC="rsync -arvuz --delete-before"
SYNC_MSDOS="rsync -rvuz --delete-before"
device="`echo $n_booter_dev | sed -r "s/(.*)[0-9]+/\1/g"`"
partnum="`echo $n_booter_dev | sed -r "s/.*([0-9]+)/\1/g"`"
function devplus(){
new="$partnum"
let new+=$1
echo $device$new
}
function chr(){ echo "print chr($1)" | python; }
function gen_randnum(){ let "rand=$RANDOM%($2-$1+1)+$1"; echo $rand; }
function gen_randstr(){
cnt="$1"
newstr=""
i=0; while let i+=1 && [ "$i" -le "$cnt" ]; do
rand="`gen_randnum 0 61`"
let rand+=48
[ "$rand" -ge "58" ] && let rand+=7 && [ "$rand" -ge "91" ] && let rand+=6
newstr="$newstr`chr $rand`"
done
echo $newstr
}
if
[ ! -b "$n_booter_dev" ] ||
[ ! -b "`devplus 1`" ]
then
echo "Partition requirements not met."
exit
fi
randstr="`gen_randstr 5`"
TMP="/tmp/$randstr"
# quit cleanly
function quit_clean(){
if [ ! -z "$1" ]; then echo "Sync-ing booter partition..."; fi
umount $TMP-n_booter &> /dev/null
rmdir $TMP-n_booter &> /dev/null
if [ ! -z "$1" ]; then echo "Sync-ing encrypted partition..."; fi
umount $TMP-sync-to &> /dev/null
rmdir $TMP-sync-to
devplus1="`devplus 1`"
lodev="`losetup -a | grep $devplus1 | cut -d ':' -f1`"
if [ -b "$lodev" ]; then losetup -d $lodev; fi
sync
exit
}
# get booter mount
booter_mount="`mount | grep booter | cut -d ' ' -f1`"
# prepare/mount booter partition
mkdir $TMP-n_booter
chmod 700 $TMP-n_booter
mount $n_booter_dev $TMP-n_booter
# prepare/mount encrypted partition
mkdir $TMP-sync-to
chmod 700 $TMP-sync-to
bash /home/sechome/grml/booter/smount /home/sechome/grml/booter/.ss `devplus 1` $TMP-sync-to 3
# test mount
if [ -z "`mount | grep $TMP-sync-to`" ]; then
echo "Mount failed."
quit_clean
fi
# umount booter partition in sechome
umount /home/sechome/grml/booter
# sync partitions
if [ "$action" = "from" ]; then
# sync 'from'
$SYNC_MSDOS $TMP-n_booter/ $booter_mount
$SYNC $TMP-sync-to/ /home/sechome
bash /home/sechome/grml/virtfs-init nofs
else
# sync 'to'
$SYNC_MSDOS $booter_mount/ $TMP-n_booter
$SYNC /home/sechome/ $TMP-sync-to
fi
# remount booter partition
mount --bind $booter_mount /home/sechome/grml/booter
quit_clean 1
This section describes security functions in the system which are not a direct part of setting up the system itself, but are still important security measures within the system.
Because GRML is a live-CD, sudo works to gain root access to anything. On top of which, the root user has no password or some default password set by the GRML developers. To fix this, passwd was run as user root and user grml (so that user wasn't using defaults as well), and the resulting shadow file was stored in "/home/sechome/.staticfs/etc/shadow". The sudoers file was truncated, and simple things were added such as /sbin/halt, /sbin/reboot, and my-grml-x.
grml ALL=NOPASSWD: /usr/bin/my-grml-x, /sbin/halt, /sbin/reboot
if [ "$TERM" = "linux" ]; then [ "$UID" = "0" ] && su - grml clear; vlock fi
alias x="(sudo /usr/bin/my-grml-x ion3 &> /dev/null) &; disown; sleep 1; clear; vlock"
--- /usr/bin/grml-x 2009-10-18 08:22:58.000000000 -0500
+++ /usr/bin/my-grml-x 2009-10-05 20:41:06.000000000 -0500
@@ -36,7 +36,7 @@
PROGRAMNAME=${0##*/}
HWINFO='/usr/sbin/hwinfo'
DATE=$(date)
- [ -n "$XINITRC" ] || XINITRC="$HOME/.xinitrc"
+ [ -n "$XINITRC" ] || XINITRC="/home/grml/.xinitrc" # bcable
# temporary files
# notice: we need the unsafe option, otherwise users other than root
@@ -101,18 +101,19 @@
# }}}
# warn if running as user root {{{
- if [ -n "$ROOT" ] ; then
- if [ -r /etc/grml_cd ] ; then
- print "$bg[black]$fg[red]${bold_color}Warning: Please do not run grml-x as user root.${reset_color}"
- print "$bg[black]$fg[red]${bold_color}Running grml-x as user root is *not* supported!${reset_color}"
- print "$bg[black]$fg[red]${bold_color}Switch to user grml or run su - grml -c 'grml-x ...' instead.${reset_color}"
- print ''
- else
- print "$bg[black]$fg[red]${bold_color}Warning: Please do not run X.org as user root!${reset_color}"
- print "$bg[black]$fg[red]${bold_color}As soon as you have a working $XCONFIG please use startx instead of grml-x.${reset_color}"
- print ''
- fi
- fi
+# commented - bcable
+# if [ -n "$ROOT" ] ; then
+# if [ -r /etc/grml_cd ] ; then
+# print "$bg[black]$fg[red]${bold_color}Warning: Please do not run grml-x as user root.${reset_color}"
+# print "$bg[black]$fg[red]${bold_color}Running grml-x as user root is *not* supported!${reset_color}"
+# print "$bg[black]$fg[red]${bold_color}Switch to user grml or run su - grml -c 'grml-x ...' instead.${reset_color}"
+# print ''
+# else
+# print "$bg[black]$fg[red]${bold_color}Warning: Please do not run X.org as user root!${reset_color}"
+# print "$bg[black]$fg[red]${bold_color}As soon as you have a working $XCONFIG please use startx instead of grml-x.${reset_color}"
+# print ''
+# fi
+# fi
fstabuser=$(grep ':x:1000:' /etc/passwd)
fstabuser=${fstabuser%%[:]*}
# }}}
@@ -151,18 +152,21 @@
# writehwinfo {{{
writehwinfo()
{
- if [ -n "$ROOT" ] ; then
- su - $fstabuser -c "$HWINFO > $HWINFO_TMP"
- else
+ # bcable
+ #if [ -n "$ROOT" ] ; then
+ # su - $fstabuser -c "$HWINFO > $HWINFO_TMP"
+ #else
$HWINFO > $HWINFO_TMP
- fi
+ #fi
}
# }}}
# monitor {{{
monitor()
{
- sudo $HWINFO --monitor > $MONITORINFO
+ # bcable
+ $HWINFO --monitor > $MONITORINFO
+ #sudo $HWINFO --monitor > $MONITORINFO
}
# }}}
@@ -286,7 +290,9 @@
# mouse {{{
mouse()
{
- sudo $HWINFO --mouse > $MOUSEINFO
+ # bcable
+ $HWINFO --mouse > $MOUSEINFO
+ #sudo $HWINFO --mouse > $MOUSEINFO
# SynPS/2 Synaptics TouchPad
if grep -q 'Device:.*Synaptics' "$MOUSEINFO" ; then
@@ -455,7 +461,12 @@
nostart=o_nostart nodpms=o_nodpms nosynaptics=o_nosynaptics nousb=o_nousb \
nops2=o_nops2 genmouse=o_genmouse novref=o_novref nohsync=o_nohsync \
fallback=o_fallback usb=o_usb ps2=o_ps2 composite=o_composite \
- xinerama=o_xinerama
+ xinerama=o_xinerama tcp=o_tcp # bcable
+
+ # bcable
+ if [ -z "$o_tcp" ]; then
+ XOPTS="$XOPTS -nolisten tcp"
+ fi
if [[ $# == 0 || "$o_help" != "" || "$1" == '-h' || "$1" == '--help' ]]; then
usage
@@ -724,16 +735,16 @@
Load "dbe" # double buffer extension
Load "dri" # direct rendering
Load "glx" # 3D layer / GLX extension
+ Load "type1" # type1 font module
+ Load "freetype" # freetype fonts rendering
Load "extmod" # some commonly used server extensions (e.g. shape extension)
Load "record" # recording extension
Load "evdev" # generic input handling driver on Linux
Load "xtrap" # X Trap extension
- # Load "freetype" # freetype fonts rendering
+ # Load "vbe" # Vesa BIOS Extension
# Load "i2c" # I2C bus
# Load "int10" # initialize graphics cards via int10 call to the BIOS
- # Load "type1" # type1 font module
# Load "v4l" # Video for Linux
- # Load "vbe" # Vesa BIOS Extension
## Deprecated/unneeded modules with Xorg >=7.0:
# Load "speedo" # font module (does not exist anymore)
# Load "ddc" # ddc probing of monitor (automatically loaded)
@@ -860,10 +871,15 @@
sed -i 's|InputDevice.*PS/2.*CorePointer|# & # deactivated to avoid two CorePointers|' $XCONFTMP
fi
fi
- [ -f $XCONFIG ] && sudo mv -f $XCONFIG $XCONFIG.old
- sudo mv $XCONFTMP $XCONFIG
- sudo chown root.root $XCONFIG
- sudo chmod 644 $XCONFIG
+ # bcable
+ [ -f $XCONFIG ] && mv -f $XCONFIG $XCONFIG.old
+ #[ -f $XCONFIG ] && sudo mv -f $XCONFIG $XCONFIG.old
+ mv $XCONFTMP $XCONFIG
+ #sudo mv $XCONFTMP $XCONFIG
+ chown root.root $XCONFIG
+ #sudo chown root.root $XCONFIG
+ chmod 644 $XCONFIG
+ #sudo chmod 644 $XCONFIG
}
# }}}
@@ -909,11 +925,13 @@
print ""
if [ -z "$DISPLAY" ] ; then
print "$bold_color$fg[green]Now trying to run startx.$reset_color"
- startx $XINITRC -- $XOPTS
+ su - grml -c "startx $XINITRC -- $XOPTS" # bcable
+ #startx $XINITRC -- $XOPTS
return 1
else
print "$bold_color$fg[green]Now trying to run startx on display $DISPLAY.$reset_color"
- startx $XINITRC -- :$DISPLAY $XOPTS
+ su - grml -c "startx $XINITRC -- $XOPTS" # bcable
+ #startx $XINITRC -- :$DISPLAY $XOPTS
return 1
fi
else
This system is quite awesome, but it is not perfect (no system is). There are a few known flaws with the security of the system, and most cannot be eliminated due to the design of the system. If you think of any more, or think of a plausible solution for any of these, contact me.
Rebooting does not fix all problems associated with remote attacks. Any automated remote attacks would be completely eliminated by a reboot, but a skilled hacker that broke into this system, and got root access, could easily append commands to any of the startup scripts. An attacker could also remount the live-CD image as read-write ("mount -o remount,rw /live/image"), then modify everything. If that isn't enough, the attacker could create a new squashfs filesystem and throw it into /home/sechome/addons/.
If someone were to physically gain access to a device with this system installed, such as a hard drive or USB drive, they could easily replace binary files with their own rootkits and other malware since the operating system is not encrypted. However, even with full encryption on the operating system partition, some sort of binary would need to be executed to decrypt that partition, so there will always be an issue with physical security.
echo -n "PASS" | md5sum | tr "0-4a-c" "\!@#$%^&*"
7^95&f9#6^!$$$f577!5^e^*!7^$6#^# -
echo -n "PASS" | sha1sum | tr "5-9d-fa-c" ")(*&^%\$#X-Z"
Y%)(4%Y)%)ZZ3)&$Y0$3)23%3$03041*3^#230%) -
7552331663217214825006745062553074726977155423512707515618786818627900161416446 34546410310899572146176
5703771355123330237019007212917971463727350822126776738571796837795501025273128 0900988612121263585565441806450432685067156764815113982255928204809523985053041 9933797647200292755130496016995295694711422976The document you are currently viewing is version 1.4.