diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..15438fb --- /dev/null +++ b/CHANGELOG @@ -0,0 +1 @@ +link cbox-tree.d/usr/share/doc/cryptobox/changelog \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..2fa9850 --- /dev/null +++ b/README @@ -0,0 +1 @@ +link cbox-tree.d/usr/share/doc/cryptobox/README \ No newline at end of file diff --git a/cbox-tree.d/etc/cryptobox/cryptobox.conf b/cbox-tree.d/etc/cryptobox/cryptobox.conf index 871126f..44be154 100644 --- a/cbox-tree.d/etc/cryptobox/cryptobox.conf +++ b/cbox-tree.d/etc/cryptobox/cryptobox.conf @@ -1,10 +1,10 @@ # this file is directly sourced by some bash scripts # so there should be no space around the "=" -LANGUAGE=de +LANGUAGE=en NET_IFACE=eth0 SAMBA_USER=nobody -SCAN_DEVICES="/dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/hdg /dev/scd0 /dev/scd1 /dev/scd2 /dev/scd3 /dev/sg /dev/sda /dev/sdb /dev/sdc /dev/sdd" +SCAN_DEVICES="hda hdb hdc hdd hde hdf hdg scd0 scd1 scd2 scd3 sg sda sdb sdc sdd" # directories LANGUAGE_DIR=/usr/share/cryptobox/lang @@ -12,7 +12,7 @@ HTML_TEMPLATE_DIR=/usr/share/cryptobox/templates DOC_DIR=/usr/share/doc/cryptobox/html CONFIG_DEFAULTS_DIR=/usr/share/cryptobox/defaults CONFIG_DIR=/mnt/cb-etc -CRYPTO_DIR=/mnt/crypto +MNT_PARENT=/mnt/crypto # some files CB_SCRIPT=/usr/lib/cryptobox/cbox-manage.sh @@ -25,8 +25,9 @@ OPENSSL_CONF_FILE=/etc/cryptobox/openssl.cnf IDLE_COUNTER_FILE=/tmp/cbox-idle-counter # crypto settings -# since 0.2.1 you find the default crypto settings in /usr/share/cryptobox/defaults -CRYPTMAPPER_DEV=/dev/mapper/cryptobox-data +# there is no default hash, as this is ignored by luks +DEFAULT_CIPHER=aes-cbc-essiv:sha256 +CRYPTMAPPER_DIR=/dev/mapper # some programs SFDISK=/sbin/sfdisk diff --git a/cbox-tree.d/etc/issue b/cbox-tree.d/etc/issue index b7ee20f..592ea49 100644 --- a/cbox-tree.d/etc/issue +++ b/cbox-tree.d/etc/issue @@ -1 +1 @@ -CryptoBox r$Revision$ +CryptoBox $Revision$ diff --git a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh index 80f765c..e929b10 100755 --- a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh +++ b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # this script does EVERYTHING @@ -18,7 +24,11 @@ set -eu CONFIG_MARKER="$CONFIG_DIR/cryptobox.marker" CERT_TEMP=/tmp/stunnel.pem -##### +######## stuff ########## + +ALL_PARTITIONS=$(cat /proc/partitions | sed '1,2d; s/ */ /g; s/^ *//' | cut -d " " -f 4) + +######################### function log_msg() { @@ -35,25 +45,16 @@ function error_msg() { echo "[`date`] - $2" | tee -a "$LOG_FILE" >&2 # print the execution stack - not usable with busybox - #caller | sed 's/^/\t/' >&2 + # caller | sed 's/^/\t/' >&2 exit "$1" } -function initial_checks() -# Parameter: device -{ - local device="$1" - [ ! -b "$device" ] && log_msg "blockdevice $device does not exist" && return 1 - [ ! -x "$SFDISK" ] && log_msg "$SFDISK not found" && return 1 - log_msg "inital checks successful" - return 0 -} - - function create_partitions() # Parameter: device { + # TODO: allow different layouts + # TODO: skip config partition if a configuration is already active local device="$1" # first partition size is 1 sector, second goes til end # sfdisk -n doesn't actually write (for testing purpose) @@ -62,10 +63,14 @@ function create_partitions() function config_set_value() -# parameters: SettingName SettingValue +# parameters: SettingName [SettingValue] +# read from stdin if SettingValue is not defined { mount -o rw,remount "$CONFIG_DIR" - echo -n "$2" > "$CONFIG_DIR/$1" + if [ $# -gt 1 ] + then echo -n "$2" > "$CONFIG_DIR/$1" + else cat - >"$CONFIG_DIR/$1" + fi mount -o ro,remount "$CONFIG_DIR" } @@ -83,15 +88,8 @@ function config_get_value() # check for existence - maybe use default values (for old releases without this setting) if [ ! -e "$conf_dir/$1" ] then case "$1" in - version ) - echo -n "0.2" - ;; - cipher ) - echo -n "aes" - ;; - hash ) - echo -n "sha512" - ;; + # you may place default values for older versions here + # for compatibility * ) error_msg 2 "unknown configuration value ($1)" # empty output @@ -108,7 +106,7 @@ function config_get_value() function create_config() # Parameter: device { - local device="${1}1" + local device="$1" log_msg "Creating config filesystem ..." # filter output through 'tr' to replace tabs $MKFS_CONFIG "$device" | tr '\010' ' ' @@ -124,9 +122,12 @@ function create_config() # beware: the temp file should always be there - even after reboot - see "mount_config" cp -p "$CERT_TEMP" "$CERT_FILE" + # create database of readable names + touch "$CONFIG_DIR/names.db" + log_msg "Setting inital values ..." # beware: config_set_value remounts the config partition read-only - config_set_value "device" "$1" + config_set_value "device" "$device" config_set_value "ip" "$(get_current_ip)" # reinitialise configuration @@ -145,60 +146,125 @@ function get_current_ip() } -function create_crypto() -# Parameter: device +function list_crypto_containers() { - local device="$1" - # passphrase may be passed via command line - log_msg "Creating crypto partition with -h $(config_get_value hash) -c $(config_get_value cipher) on ${device}2" - $CRYPTSETUP -h "$(config_get_value hash)" -c "$(config_get_value cipher)" create "`basename $CRYPTMAPPER_DEV`" "${device}2" + for a in $ALL_PARTITIONS + do $CRYPTSETUP isLuks "/dev/$a" 2>/dev/null && echo "/dev/$a" + done } -function mkfs_crypto() -# split from create_crypto to allow background execution via web interface +function list_unused_partitions() { - local device=$(find_harddisk) + for a in $ALL_PARTITIONS + do $CRYPTSETUP isLuks "/dev/$a" 2>/dev/null || echo "/dev/$a" + done | grep -v "$(config_get_value device)1" + # replace the config_get_value by a sub, that returns the config partition +} - # flood the crypto partition with noise - # writing to the real partition is faster - # TODO: this takes _much_ too long - maybe add a "secure wipe" switch to the interface? - #dd if=/dev/urandom of="${device}2" bs=512 + +function get_crypto_uuid() +# Parameter: DEVICE +{ + $CRYPTSETUP luksUUID "$1" +} + + +function get_crypto_name() +# Parameter: DEVICE +# return the readable name of the crypto container, it it is already defined +# if undefined - return the uuid +{ + local uuid=$($CRYPTSETUP luksUUID $1) + local dbname=$(config_get_value "names.db" | grep "^$uuid:" | cut -d ":" -f 2-) + if [ -z "$dbname" ] + then echo -n "$uuid" + else echo -n "$dbname" + fi +} + + +function set_crypto_name() +# Parameter: DEVICE NAME +{ + local uuid=$($CRYPTSETUP luksUUID $1) + # remove the old setting for this device and every possible entry with the same name + (config_get_value 'names.db' | sed "/^$uuid:/d; /^[^:]*:$2$/d"; echo "$uuid:$2") | config_set_value 'names.db' +} + + +function does_crypto_name_exist() +# Parameter: NAME +{ + config_get_value 'names.db' | grep -q "^[^:]*:$1$" +} + + +function create_crypto() +# Parameter: DEVICE NAME KEYFILE +# keyfile is necessary, to allow background execution via 'at' +{ + local device=$1 + local name=$2 + local keyfile=$3 + # otherwise the web interface will hang + # passphrase may be passed via command line + log_msg "Creating crypto partition with the cipher $DEFAULT_CIPHER on $device" + # the hash is ignored by luks + # the iter-time specifies the time spent on PBKDF2 - one second is said to be sufficient + # luksFormat floods the container with random noise automatically + cat "$keyfile" | $CRYPTSETUP -c "$DEFAULT_CIPHER" luksFormat "$device" + set_crypto_name "$device" "$name" + local uuid=$(get_crypto_uuid "$device") + + # map the crypto container + cat "$keyfile" | $CRYPTSETUP luksOpen "$device" "$uuid" + + # remove the passphrase-file as soon as possible + dd if=/dev/zero of="$keyfile" bs=512 count=1 2>/dev/null + rm "$keyfile" # filter output through 'tr' to replace tabs - $MKFS_DATA "$CRYPTMAPPER_DEV" | tr '\0101' ' ' + $MKFS_DATA "$CRYPTMAPPER_DIR/$uuid" | tr '\0101' ' ' + + # set user for samba + mkdir -p "$MNT_PARENT/$name" + mount "$CRYPTMAPPER_DIR/$uuid" "$MNT_PARENT/$name" + chown $SAMBA_USER "$MNT_PARENT/$name" + umount_crypto "$device" } function config_mount_test() # Parameter: device { - local device="${1}" + local device=$1 local STATUS=0 mount "${device}1" "$CONFIG_DIR" &>/dev/null || true is_config_mounted && STATUS=1 umount "$CONFIG_DIR" &>/dev/null || true # return code is the result of this expression - [ 1 -eq "$STATUS" ] && return 0 - return 1 + test 1 -eq "$STATUS" } function is_config_mounted() { - mount | grep -q " ${CONFIG_DIR} " && [ -f "$CONFIG_MARKER" ] + mount | grep -q " $CONFIG_DIR " && [ -f "$CONFIG_MARKER" ] } function is_crypto_mounted() +# Parameter: DEVICE { - mount | grep -q " ${CRYPTO_DIR} " + local uuid=$(get_crypto_uuid $1) + test -e "$CRYPTMAPPER_DIR/$uuid" } function is_init_running() { - check_at_command_queue " box-init-bg" + check_at_command_queue " init" } @@ -219,30 +285,29 @@ function check_at_command_queue() function find_harddisk() # look for the harddisk to be partitioned { - local dev=$( - if is_config_mounted - then config_get_value "device" - else for a in $SCAN_DEVICES - do grep -q " `basename $a`$" /proc/partitions && echo "$a" && break - done - fi ) - if [ -z "$dev" ] ; then + local device + if is_config_mounted + then device=$(config_get_value "device") + else device=$(get_available_disks | head -1) + fi + if [ -z "$device" ] ; then log_msg "no valid harddisk for initialisation found!" cat /proc/partitions >>"$LOG_FILE" # do not return with an error, to avoid a failing of the script ('break on error') # the caller of this function should handle an empty return string fi - echo -n "$dev" + echo -n "$device" } + function get_available_disks() # looks which allowed disks are at the moment connected with the cbox { - local dev=$( - for a in $SCAN_DEVICES - do grep -q " `basename $a`$" /proc/partitions && echo "$a" - done ) - echo -n "$dev" + for scan in $SCAN_DEVICES + do for avail in $ALL_PARTITIONS + do [ "$scan" = "$avail" ] && echo "$a" + done + done } @@ -268,27 +333,35 @@ function mount_config() function mount_crypto() +# Parameter: DEVICE { - is_crypto_mounted && echo "The cryptofilesystem is already active!" && return - local device=`find_harddisk` + local device=$1 [ -z "$device" ] && error_msg 4 'No valid harddisk found!' && return 1 + is_crypto_mounted "$device" && echo "The crypto filesystem is already active!" && return + local uuid=$(get_crypto_uuid $device) + local name=$(get_crypto_name $device) # passphrase is read from stdin - log_msg "Mounting crypto partition with -h $(config_get_value hash) -c $(config_get_value cipher) on ${device}2" - $CRYPTSETUP -h "$(config_get_value hash)" -c "$(config_get_value cipher)" create "`basename $CRYPTMAPPER_DEV`" "${device}2" - if mount "$CRYPTMAPPER_DEV" "$CRYPTO_DIR" - then log_msg "Mount succeded - now starting samba ..." + log_msg "Mounting crypto partition $name ($device)" + $CRYPTSETUP luksOpen "$device" "$uuid" + [ -e "$MNT_PARENT/$name" ] || mkdir -p "$MNT_PARENT/$name" + if mount "$CRYPTMAPPER_DIR/$uuid" "$MNT_PARENT/$name" + then log_msg "Mount succeeded - now starting samba ..." /etc/init.d/samba start - else log_msg "Mount failed - removing dev-mapper ..." - dmsetup remove $(basename $CRYPTMAPPER_DEV) + return 0 + else log_msg "Mount failed - removing the crypto device $uuid ..." + $CRYPTSETUP luksClose "$uuid" return 1 fi } function umount_crypto() +# Parameter: DEVICE { + local device=$1 # do not break on error set +e + # TODO: do not stop samba - or do it just temporarily if ps -e | grep -q " [sn]mbd$" then log_msg "Stopping samba ..." /etc/init.d/samba stop @@ -297,13 +370,16 @@ function umount_crypto() ps -e | grep -q " smbd$" && killall -9 smbd ps -e | grep -q " nmbd$" && killall -9 nmbd fi - if mount | grep -q " $CRYPTO_DIR " + local uuid=$(get_crypto_uuid $device) + local name=$(get_crypto_name $device) + if mount | grep -q " $MNT_PARENT/$name " then log_msg "Unmounting crypto partition ..." - umount "$CRYPTO_DIR" + umount "$MNT_PARENT/$name" + rmdir "$MNT_PARENT/$name" fi - if [ -e "$CRYPTMAPPER_DEV" ] + if [ -e "$CRYPTMAPPER_DIR/$uuid" ] then log_msg "Removing dev-mapper ..." - $CRYPTSETUP remove $(basename $CRYPTMAPPER_DEV) + $CRYPTSETUP luksClose "$uuid" fi set -e } @@ -312,51 +388,36 @@ function umount_crypto() function box_purge() # removing just the first bytes from the harddisk should be enough { - local device=$(find_harddisk) - log_msg "Purging $device ..." - dd if=/dev/zero of=$device bs=1M count=1 - log_msg " " + local device + get_available_disks | while read a + do log_msg "Purging $device ..." + dd if=/dev/zero of=$device bs=1M count=1 + log_msg " " + done } -function init_cryptobox_part1() +function init_cryptobox() # this is only the first part of initialisation that takes no time - good for a smooth web interface { local device=$(find_harddisk) [ -z "$device" ] && log_msg 'No valid harddisk found!' && return 1 - ( - log_msg "Initializing crypto partition on $device ..." - umount_crypto || true - mount | grep -q " $CONFIG_DIR " && umount "$CONFIG_DIR" || true - initial_checks "$device" || { log_msg "initial checks failed" && return 1 ;} - create_partitions "$device" - create_config "$device" - ) >>"$LOG_FILE" 2>&1 - # the output of create_crypto may NOT be redirected - this would prevent cryptsetup from - # reading the passphrase from stdin - log_msg "Creating the crypto partition ..." - create_crypto "$device" + turn_off_all_crypto + mount | grep -q " $CONFIG_DIR " && umount "$CONFIG_DIR" || true + log_msg "Initializing config partition on $device ..." + create_partitions "$device" + create_config "${device}1" } -function init_cryptobox_part2() -# some things to be done in the background -# these are the final steps of initialisation -# the uid must be changed initially, therfore it needs to be mounted +function turn_off_all_crypto() { - mkfs_crypto - mount "$CRYPTMAPPER_DEV" "$CRYPTO_DIR" - chown $SAMBA_USER "$CRYPTO_DIR" - umount_crypto + list_crypto_containers | while read a + do is_crypto_mounted "$a" && umount_crypto "$a" + done } -function init_cryptobox_complete() -{ - init_cryptobox_part1 - init_cryptobox_part2 -} - ### main ### # set PATH because thttpd removes /sbin and /usr/sbin for cgis @@ -364,7 +425,7 @@ export PATH=/usr/sbin:/usr/bin:/sbin:/bin ACTION=help -[ $# -gt 0 ] && ACTION="$1" +[ $# -gt 0 ] && ACTION="$1" && shift case "$ACTION" in config-up ) @@ -374,13 +435,13 @@ case "$ACTION" in fi ;; config-down ) - umount "$CONFIG_DIR" || error_msg 4 "Could not unmount configuration partition" + mount | grep -q " $CONFIG_DIR$ " && umount "$CONFIG_DIR" || error_msg 4 "Could not unmount configuration partition" ;; network-up ) kudzu -s -q --class network conf_ip=$(config_get_value "ip") - ifconfig $NET_IFACE "$conf_ip" log_msg "Configured $NET_IFACE for $conf_ip ..." + ifconfig $NET_IFACE "$conf_ip" echo "Configured network interface for $NET_IFACE: $conf_ip" log_msg "Starting the firewall ..." "$FIREWALL_SCRIPT" start @@ -403,46 +464,57 @@ case "$ACTION" in log_msg "Stopping stunnel ..." killall stunnel log_msg "Shutting the network interface down ..." - ifconfig $NET_IFACE down + ifconfig "$NET_IFACE" down ;; services-up ) + # the mount point has to be writeable + mount -t tmpfs tmpfs "$MNT_PARENT" # is something special necessary? ;; services-down ) - /etc/init.d/samba stop - /etc/init.d/thttpd stop + umount "$MNT_PARENT" + /etc/init.d/samba stop || true + /etc/init.d/thttpd stop || true + true ;; crypto-up ) - mount_crypto + [ $# -ne 1 ] && error_msg "invalid number of parameters for 'crypto-up'" + mount_crypto "$1" ;; crypto-down ) - umount_crypto + [ $# -ne 1 ] && error_msg "invalid number of parameters for 'crypto-up'" + umount_crypto "$1" ;; - box-init ) - # do complete initialization - "$0" box-init-fg - # the background part will recall itself as an at-command - "$0" box-init-bg + init ) + init_cryptobox >"$LOG_FILE" 2>&1 ;; - box-init-fg ) - # only partitioning and configuration - # this is nice for the web interface, as it is fast - # output redirection does not work, as it prevents cryptsetup from asking - # for a password - init_cryptobox_part1 - ;; - box-init-bg ) + crypto-create ) + # Parameter: DEVICE NAME + [ $# -ne 2 ] && error_msg "invalid number of parameters for 'crypto-create'" # do it in the background to provide a smoother web interface # messages and errors get written to $LOG_FILE - - # make sure, that this is always called via 'at': - if check_at_command_queue " box-init-bg" - then init_cryptobox_part2 >"$LOG_FILE" 2>&1 - else echo -n "'$0' box-init-bg" | at now - fi + keyfile=/tmp/$(basename $0)-passphrase-$(basename $1) + # read the password + cat - >"$keyfile" + # execute it in the background + echo "'$0' crypto-create-bg '$1' '$2' '$keyfile' >'$LOG_FILE' 2>&1" | at now + ;; + crypto-create-bg ) + create_crypto "$@" + ;; + crypto-list ) + list_crypto_containers + ;; + crypto-list-unused ) + list_unused_partitions + ;; + crypto-name ) + # Parameter: DEVICE + get_crypto_name "$1" ;; is_crypto_mounted ) - is_crypto_mounted + [ $# -ne 1 ] && error_msg 10 "invalid number of parameters for 'is_crypto_mounted'" + is_crypto_mounted "$1" ;; is_config_mounted ) is_config_mounted @@ -460,36 +532,38 @@ case "$ACTION" in echo -n "sleep 5; ifconfig $NET_IFACE `config_get_value ip`" | at now ;; get_available_disks ) - get_available_disks + get_available_disks ;; get_current_ip ) get_current_ip ;; set_config ) - [ $# -ne 3 ] && error_msg 7 "'set_config' requires two parameters" - config_set_value "$2" "$3" + [ $# -ne 2 ] && error_msg 7 "'set_config' requires two parameters" + config_set_value "$1" "$2" ;; get_config ) - [ $# -ne 2 ] && error_msg 6 "'get_config' requires exactly one parameter" - config_get_value "$2" + [ $# -ne 1 ] && error_msg 6 "'get_config' requires exactly one parameter" + config_get_value "$1" ;; diskinfo ) - $SFDISK -L -q -l `find_harddisk` + get_available_disks | while read a + do $SFDISK -L -q -l "$a" + done ;; box-purge ) log_msg "Cleaning the CryptoBox ..." - $0 crypto-down - $0 config-down + turn_off_all_crypto + "$0" config-down box_purge ;; poweroff ) - is_crypto_mounted && umount_crypto log_msg "Turning off the CryptoBox ..." + turn_off_all_crypto echo "poweroff" | at now ;; reboot ) - is_crypto_mounted && umount_crypto log_msg "Rebooting the CryptoBox ..." + turn_off_all_crypto echo "reboot" | at now ;; * ) diff --git a/cbox-tree.d/usr/lib/cryptobox/check_smb_idle.sh b/cbox-tree.d/usr/lib/cryptobox/check_smb_idle.sh index ec596ef..5712ccc 100755 --- a/cbox-tree.d/usr/lib/cryptobox/check_smb_idle.sh +++ b/cbox-tree.d/usr/lib/cryptobox/check_smb_idle.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # a simple script to check, if there was no smb traffic for the specified @@ -49,6 +55,9 @@ function check_for_traffic() ################### main ###################### +# TODO: migrate to multi-container-setup +exit 0 + # break, if crypto partition is not mounted "$CB_SCRIPT" is_crypto_mounted || exit 0 diff --git a/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh b/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh index d89a46e..5ac37ed 100755 --- a/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh +++ b/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # FOR DEVELOPMENT ONLY! @@ -11,6 +17,7 @@ # parameter: [commandline] # # if "commandline" is empty, "bash" will be used +# set -eu diff --git a/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh b/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh index 4eea353..7522293 100755 --- a/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh +++ b/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # this script is part of the building process of the cryptobox @@ -17,8 +23,13 @@ set -eu RUNTIMEDIR=/opt/dfsruntime/runtimerd TUNDEV=$RUNTIMEDIR/dev/net/tun -SECURITY_REMOVE_PACKAGES="ssh strace unzip tar zip wget nvi nano gzip curl bzip2 aptitude tasksel elinks vim vim-common" -DEVEL_REMOVE_PACKAGES="exim4-daemon-light exim4-config exim4-base netkit-inetd telnet ppp pppconfig pppoe pppoeconf" +REMOVE_PACKAGES="strace + nvi nano vim vim-common + unzip tar zip gzip bzip2 + aptitude tasksel + ssh elinks curl wget netkit-inetd telnet + exim4-daemon-light exim4-config exim4-base + ppp pppconfig pppoe pppoeconf" # remove rc symlinks for these services SERVICES_OFF="ssh samba setserial nviboot mountnfs ntpdate" @@ -26,8 +37,13 @@ SERVICES_OFF="ssh samba setserial nviboot mountnfs ntpdate" function configure_normal() # the usual stuff - not optimized for security { + ########### boot up ########### # set default runlevel to 3 sed -i 's/^id:2:initdefault/id:3:initdefault/' /etc/inittab + # turn off creation of "/etc/nologin" (read-only fs) + sed -i '/^DELAYLOGIN=/s/^DELAYLOGIN=.*$/DELAYLOGIN=no/' /etc/default/rcS + # turn off modifying /etc/motd (read-only fs) + sed -i '/^EDITMOTD=/s/^EDITMOTD=.*$/EDITMOTD=no/' /etc/default/rcS ######### devices ########## # create tun device for running under qemu @@ -60,10 +76,6 @@ function configure_normal() sed -i 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config fi - # remove unnecessary packages - return true, if no packages were - # removed - dpkg --force-all -P $DEVEL_REMOVE_PACKAGES 2>&1 | grep -v "which isn't installed." || true - # remove symlinks for unwanted services for a in $SERVICES_OFF; do # echo "Turning off service $a ..." @@ -72,9 +84,6 @@ function configure_normal() done done - # remove deb-files, that were left by dfsbuild - test -d /opt/packages && rm -r /opt/packages - return 0 } @@ -87,7 +96,7 @@ function configure_secure() sed -i '/getty/d' /etc/inittab # remove unnecessary packages - dpkg --force-all -P $SECURITY_REMOVE_PACKAGES 2>&1 | grep -v "which isn't installed." || true + dpkg --force-all -P $REMOVE_PACKAGES 2>&1 | grep -v "which isn't installed." || true # remove the development features script [ -e "$DEV_FEATURES_SCRIPT" ] && rm -f "$DEV_FEATURES_SCRIPT" @@ -96,6 +105,12 @@ function configure_secure() # as the openssh package was removed anyway [ -d /root/.ssh ] && rm -rf /root/.ssh + ############## clean up ################ + # remove deb-files, that were left by dfsbuild + test -d /opt/packages && rm -r /opt/packages + # remove packages and package lists + rm -fr /var/cache/apt/ + return 0 } diff --git a/cbox-tree.d/usr/lib/cryptobox/devel-features.sh b/cbox-tree.d/usr/lib/cryptobox/devel-features.sh index 7fc2d66..0c86c02 100755 --- a/cbox-tree.d/usr/lib/cryptobox/devel-features.sh +++ b/cbox-tree.d/usr/lib/cryptobox/devel-features.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # this script is part of the boot process of a developer's cryptobox diff --git a/cbox-tree.d/usr/lib/cryptobox/firewall.sh b/cbox-tree.d/usr/lib/cryptobox/firewall.sh index 9716778..5509dba 100755 --- a/cbox-tree.d/usr/lib/cryptobox/firewall.sh +++ b/cbox-tree.d/usr/lib/cryptobox/firewall.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # set up the firewall of the cryptobox diff --git a/cbox-tree.d/usr/lib/cryptobox/make_stunnel_cert.sh b/cbox-tree.d/usr/lib/cryptobox/make_stunnel_cert.sh index 53f038e..8972475 100755 --- a/cbox-tree.d/usr/lib/cryptobox/make_stunnel_cert.sh +++ b/cbox-tree.d/usr/lib/cryptobox/make_stunnel_cert.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # this script creates the stunnel certificate for https diff --git a/cbox-tree.d/usr/share/cryptobox/defaults/cipher b/cbox-tree.d/usr/share/cryptobox/defaults/cipher deleted file mode 100644 index aaa484a..0000000 --- a/cbox-tree.d/usr/share/cryptobox/defaults/cipher +++ /dev/null @@ -1 +0,0 @@ -aes-cbc-essiv:sha256 diff --git a/cbox-tree.d/usr/share/cryptobox/defaults/hash b/cbox-tree.d/usr/share/cryptobox/defaults/hash deleted file mode 100644 index 80341c0..0000000 --- a/cbox-tree.d/usr/share/cryptobox/defaults/hash +++ /dev/null @@ -1 +0,0 @@ -ripemd160 diff --git a/cbox-tree.d/usr/share/cryptobox/defaults/names.db b/cbox-tree.d/usr/share/cryptobox/defaults/names.db new file mode 100644 index 0000000..e69de29 diff --git a/cbox-tree.d/usr/share/doc/cryptobox/LICENSE b/cbox-tree.d/usr/share/doc/cryptobox/LICENSE new file mode 100644 index 0000000..b7b5f53 --- /dev/null +++ b/cbox-tree.d/usr/share/doc/cryptobox/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/cbox-tree.d/usr/share/doc/cryptobox/README b/cbox-tree.d/usr/share/doc/cryptobox/README new file mode 100644 index 0000000..7161412 --- /dev/null +++ b/cbox-tree.d/usr/share/doc/cryptobox/README @@ -0,0 +1,24 @@ +$Id$ +CryptoBox version 0.3 + +1) Documentation +The documentation is available at https://systemausfall.org/trac/cryptobox/wiki/CryptoBoxUser + +2) Building a LiveCD +try: "scripts/cbox-build.sh release" +or look at the developer's documentation: https://systemausfall.org/trac/cryptobox/wiki/CryptoBoxDev + +3) Bug reporting +Use our issue tracker at https://systemausfall.org/trac/cryptobox/newticket + +4) Licence +All scripts are GPL code (v2.0 or above). +The documentation is licenced under "Creative Commons 2.5 share-alike" (http://creativecommons.org/licenses/by-sa/2.5/). + +5) Contributors +Clavdia Horvat, Tadej Brce & DuĊĦan Rebolj - slovenian translation + +6) Contact +email: cryptobox@systemausfall.org + +The CryptoBox project is mainly driven by sense.lab (https://systemausfall.org/senselab). diff --git a/cbox-tree.d/usr/share/doc/cryptobox/changelog b/cbox-tree.d/usr/share/doc/cryptobox/changelog new file mode 100644 index 0000000..89d3f09 --- /dev/null +++ b/cbox-tree.d/usr/share/doc/cryptobox/changelog @@ -0,0 +1,27 @@ +Version 0.3 - 11/??/02005 + * uses cryptsetup-luks instead of cryptsetup + * bugfix: add /dev/hdd to device scan + * support for usb, scsi and firewire cdrom drive + +Version 0.2.1 - 10/22/02005 + * fixed a critical bug in the initialisation process + * default cipher changed to "aes-cbc-essiv:sha256" (more secure) + * the boot menue (grub) is now protected + * support for usb and firewire harddisks + * new kernel: Linux 2.6.12.6 + * minor language improvements + +Version 0.2 - 10/04/02005 + * first public release + * fully configurable via web interface + * AES encryption via device-mapper + * Samba v3.0.14a-3 + * Linux 2.6.11 + * based on Debian GNU/Linux 3.1 + * documentation languages: + * English + * German + * interface languages: + * English + * German + * Slovenian diff --git a/cbox-tree.d/usr/share/doc/cryptobox/copyright b/cbox-tree.d/usr/share/doc/cryptobox/copyright new file mode 100644 index 0000000..d829ec5 --- /dev/null +++ b/cbox-tree.d/usr/share/doc/cryptobox/copyright @@ -0,0 +1,18 @@ +Copyright (c) 02005 sense.lab + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License with +your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the +Debian GNU/Linux hello source package as the file COPYING. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +$Id$ diff --git a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl index 91c4fee..a39555e 100755 --- a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl +++ b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl @@ -1,7 +1,13 @@ #!/usr/bin/perl +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # -# web interface of the CryptoBox +# the web interface of the CryptoBox # @@ -17,7 +23,7 @@ my $CONFIG_FILE = '/etc/cryptobox/cryptobox.conf'; my ($pagedata, $pagename); my ($LANGUAGE_DIR, $DEFAULT_LANGUAGE, $HTML_TEMPLATE_DIR, $DOC_DIR); -my ($CB_SCRIPT, $LOG_FILE, $IS_DEV); +my ($CB_SCRIPT, $LOG_FILE, $IS_DEVEL); &fatal_error ("could not find configuration file ($CONFIG_FILE)") unless (-e $CONFIG_FILE); my $config = ConfigFile::read_config_file($CONFIG_FILE); @@ -28,7 +34,10 @@ $LANGUAGE_DIR = $config->{LANGUAGE_DIR}; $DEFAULT_LANGUAGE = $config->{LANGUAGE}; $HTML_TEMPLATE_DIR = $config->{HTML_TEMPLATE_DIR}; $DOC_DIR = $config->{DOC_DIR}; -$IS_DEV = ( -e $config->{DEV_FEATURES_SCRIPT}); +$IS_DEVEL = ( -e $config->{DEV_FEATURES_SCRIPT}); + +# TODO: just a quick-and-dirty hack during migration to multiple containers +my $CRYPTO_DEV = "`$CB_SCRIPT get_config device`2"; my $query = new CGI; @@ -192,13 +201,13 @@ sub check_ssl sub check_mounted { - return (system("$CB_SCRIPT","is_crypto_mounted") == 0); + return (system("$CB_SCRIPT","is_crypto_mounted",$CRYPTO_DEV) == 0); } sub check_config { - return (system("$CB_SCRIPT","is_config_mounted") == 0); + return (system("$CB_SCRIPT","is_config_mounted",$CRYPTO_DEV) == 0); } @@ -253,7 +262,7 @@ sub mount_vol if (&check_mounted) { $pagedata->setValue('Data.Warning', 'IsMounted'); } else { - open(PW_INPUT, "| $CB_SCRIPT crypto-up"); + open(PW_INPUT, "| $CB_SCRIPT crypto-up $CRYPTO_DEV"); print PW_INPUT $pw; close(PW_INPUT); } @@ -263,7 +272,7 @@ sub mount_vol sub umount_vol { if (&check_mounted) { - system("$CB_SCRIPT", "crypto-down"); + system("$CB_SCRIPT", "crypto-down",$CRYPTO_DEV); } else { $pagedata->setValue('Data.Warning', 'NotMounted'); } @@ -274,16 +283,16 @@ sub box_init { my ($crypto_pw, $admin_pw) = @_; + system("$CB_SCRIPT", "init"); # partitioning, config and initial cryptsetup - open(PW_INPUT, "|$CB_SCRIPT box-init-fg"); + # TODO: define the name of the crypto container + # TODO: split init and create_crypto + open(PW_INPUT, "|$CB_SCRIPT crypto-create",$CRYPTO_DEV,"default"); print PW_INPUT $crypto_pw; close(PW_INPUT); # set administration password system("$CB_SCRIPT", "set_config", "admin_pw", "$admin_pw"); - - # wipe and mkfs takes some time - it will be done in the background - system("$CB_SCRIPT", "box-init-bg"); } sub box_purge @@ -678,7 +687,7 @@ if (-e "$LOG_FILE") { } $pagedata->setValue('Data.Log',"$output"); -$pagedata->setValue('Data.Status.DevelopmentMode', 1) if ($IS_DEV); +$pagedata->setValue('Data.Status.DevelopmentMode', 1) if ($IS_DEVEL); # save QUERY_STRING (e.g. for weblang-links) my $querystring = $ENV{'QUERY_STRING'}; diff --git a/etc-defaults.d/dfs-cbox.conf b/etc-defaults.d/dfs-cbox.conf index d8de2a8..b86c317 100644 --- a/etc-defaults.d/dfs-cbox.conf +++ b/etc-defaults.d/dfs-cbox.conf @@ -58,20 +58,13 @@ allpackages = util-linux nano ssh less - zip - unzip tar bash coreutils module-init-tools - iputils-tracepath iputils-ping - iptraf iptables ifupdown - # TODO: remove bzip2 dhcp-client iptraf iputils-tracepath zip unzip - dhcp-client - bzip2 busybox-static usbutils pciutils @@ -85,36 +78,16 @@ allpackages = util-linux thttpd stunnel samba - cryptsetup hashalot kudzu elinks ssh strace python-clearsilver - # needed for validation - curl - # needed for cryptobox.pl + # necessary for cryptobox.pl libconfigfile-perl - ## unnoetig - #gawk - #e2undel - #dfsbuild - #kernel-package - #libncurses5-dev - #tla - #build-essential - #g++ - #smbclient - #debhelper - #bind9-host - #whois - #dnsutils - #cpio - #devscripts - #cdebootstrap - #diff - #patch + # cryptsetup is replaced by cryptsetup-luks (installed from local file) + #cryptsetup # select a mirror for the repository (apt-cacher, apt-proxy, no caching) by @@ -128,7 +101,7 @@ mirror = http://127.0.0.1/apt-cacher/ftp.debian.org/debian # Devices to probe for CD -devices = scd0 scd1 scd2 scd3 scd4 hda hdb hdc hdd hde hdf hdg +devices = scd0 scd1 scd2 scd3 scd4 hda hdb hdc hdd hde hdf hdg sda sdb sdc sdd # Files to place on the ramdisk ramdisk_files = /etc/resolv.conf @@ -172,14 +145,17 @@ deletefiles = /etc/rcS.d/*discover #modules = /lib/modules/2.4.27-2-386 # Debs from local fs to unpack on live FS (will not be configured) -#unpackdebs = kernel/kernel-image-2.6.8_1.dfs_i386.deb -unpackdebs = kernel/kernel-image-2.6.12.6_cryptobox0.3_i386.deb +# cryptsetup-luks can not be install regurlarly, because of a weird dpkg error +# ("statusoverride ... Debian-exim" - this can probably be fixed, by adding the group +# Debian-exim to the host system) +unpackdebs = packages/kernel-image-2.6.12.6_cryptobox0.3_i386.deb + packages/cryptsetup-luks_1.0.1-3_i386.deb # Other packages to install besides the list in DEFAULT packages = %(allpackages)s # Debs from local fs to isntall on live fs -# installdebs = +#installdebs = # Bootloader (see options under default) bootloader = grub-no-emul @@ -196,12 +172,6 @@ grubconfig = timeout 0 [repo stable] suite = stable -[repo testing] -suite = testing - -[repo unstable] -suite = unstable - [repo amd64] suite = unstable # Override default mirror @@ -214,7 +184,6 @@ arch = amd64 ###################################################################### [appendfiles] -/etc/fstab = /dev/mapper/staub /mnt/crypto auto noauto,defaults 0 0 /etc/network/interfaces = auto lo iface lo inet loopback diff --git a/kernel/config-2.6.12.6_cryptobox0.3 b/packages/config-2.6.12.6_cryptobox0.3 similarity index 100% rename from kernel/config-2.6.12.6_cryptobox0.3 rename to packages/config-2.6.12.6_cryptobox0.3 diff --git a/packages/cryptsetup-luks_1.0.1-3_i386.deb b/packages/cryptsetup-luks_1.0.1-3_i386.deb new file mode 100644 index 0000000..d30875b Binary files /dev/null and b/packages/cryptsetup-luks_1.0.1-3_i386.deb differ diff --git a/kernel/info.txt b/packages/info.txt similarity index 60% rename from kernel/info.txt rename to packages/info.txt index 0d737cc..2369fe9 100644 --- a/kernel/info.txt +++ b/packages/info.txt @@ -1,3 +1,6 @@ BEWARE: the uml kernel does not work correctly - see ../hints/starting_uml.txt for details see hints/kernel-build.txt for details on how to build and include a new kernel + +cryptsetup-luks is not yet officially available for debian +Source: http://einsteinmg.dyndns.org/debian/unstable/ diff --git a/kernel/kernel-image-2.6.12.6_cryptobox0.3_i386.deb b/packages/kernel-image-2.6.12.6_cryptobox0.3_i386.deb similarity index 100% rename from kernel/kernel-image-2.6.12.6_cryptobox0.3_i386.deb rename to packages/kernel-image-2.6.12.6_cryptobox0.3_i386.deb diff --git a/kernel/uml-kernel-2.6.12.3-cryptobox b/packages/uml-kernel-2.6.12.3-cryptobox similarity index 100% rename from kernel/uml-kernel-2.6.12.3-cryptobox rename to packages/uml-kernel-2.6.12.3-cryptobox diff --git a/scripts/cbox-build.sh b/scripts/cbox-build.sh index 8c8db5e..2797b77 100755 --- a/scripts/cbox-build.sh +++ b/scripts/cbox-build.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # managing our work at the cryptobox @@ -53,6 +59,8 @@ function run_dfsbuild() function create_uncompressed_iso() { + # check for a mounted procfs + mount | grep -q " $IMAGE_DIR/proc " && umount "$IMAGE_DIR/proc" echo "Creating the iso ..." mkisofs $MKISOFS_OPTIONS -o "$IMAGE_FILE" "$IMAGE_DIR" } @@ -60,6 +68,8 @@ function create_uncompressed_iso() function create_compressed_iso() { + # check for a mounted procfs + mount | grep -q " $IMAGE_DIR/proc " && umount "$IMAGE_DIR/proc" echo "Creating the compressed iso ..." [ -e "$IMAGEZ_DIR" ] && rm -r "$IMAGEZ_DIR" mkdir "$IMAGEZ_DIR" diff --git a/scripts/cbox-dev.sh b/scripts/cbox-dev.sh index 3ebbdf7..f275d28 100755 --- a/scripts/cbox-dev.sh +++ b/scripts/cbox-dev.sh @@ -1,4 +1,10 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# # $Id$ # # managing our work at the cryptobox @@ -48,7 +54,7 @@ function qemu_boot() # create a virtual harddisk image file if [ ! -e "$HD_IMAGE" ] then echo "Creating temporary harddisk image ..." - dd if=/dev/zero of="$HD_IMAGE" bs=1M count=20 + dd if=/dev/zero of="$HD_IMAGE" bs=1M count=7 fi echo "Starting qemu ..." qemu -cdrom "$1" -m 96 -hda "$IMAGE_FILE" -boot d -n "$QEMU_IFUP_FILE" || true diff --git a/scripts/show_TODO.sh b/scripts/show_TODO.sh index 4611417..a2904ec 100755 --- a/scripts/show_TODO.sh +++ b/scripts/show_TODO.sh @@ -1,3 +1,9 @@ #!/bin/sh +# +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# grep "TODO" $(find "$(dirname $0)/.." -type f | grep -v "\.svn" | grep -v "$(basename $0)") diff --git a/scripts/userdocexport.sh b/scripts/userdocexport.sh index 22efc38..1102afb 100755 --- a/scripts/userdocexport.sh +++ b/scripts/userdocexport.sh @@ -1,5 +1,12 @@ #!/bin/sh # +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# +# $Id$ +# # export wiki pages to the cryptobox development tree # this creates static and integrated pages # diff --git a/scripts/validate.sh b/scripts/validate.sh index 3c5b9f2..2cc643b 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -1,5 +1,12 @@ #!/bin/sh # +# Copyright (c) 02005 sense.lab +# +# License: This script is distributed under the terms of version 2 +# of the GNU GPL. See the LICENSE file included with the package. +# +# $Id$ +# # do a validation # # use "--help" for a list of possible actions