Skip to content

Commit

Permalink
Closer to TrueCrypt support. Only missing the command line switch now
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Frivold committed Mar 6, 2013
1 parent 4ab88b8 commit 3231f9c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
9 changes: 5 additions & 4 deletions LUKSUS
Expand Up @@ -20,7 +20,7 @@
if [ -r LUKSUS.variables ]; then
source LUKSUS.variables
else
exit 0
exit 1
fi

###############################
Expand All @@ -31,7 +31,7 @@ fi
if [ -r LUKSUS.functions ]; then
source LUKSUS.functions
else
exit 0
exit 1
fi


Expand All @@ -42,7 +42,7 @@ fi
if [ -r LUKSUS.welcome ]; then
source LUKSUS.welcome
else
exit 0
exit 1
fi


Expand All @@ -54,7 +54,7 @@ fi
if [ -r LUKSUS.checks ]; then
source LUKSUS.checks
else
exit 0
exit 1
fi


Expand All @@ -77,4 +77,5 @@ THESECRETSAUCE
CREATEANDMOUNTFS
DISPLAYLOGO
DISPLAYSUMMARY
DISPLAYSUMMARY 1>$keydir/$name.information 2>$keydir/$name.information
exit 0
39 changes: 17 additions & 22 deletions LUKSUS.checks
Expand Up @@ -5,37 +5,30 @@
# for consistency and correctness sake. It only checks the first $1
# and second $2 argument.


## COMMAND LINE ARGUMENTS
## Checking to see if the user wants to use truecrypt
USAGE="Usage: `basename $0` [-t]"
## Playing around with arcane getopts

# Parse command line options.
while getopts t: OPT; do
case "$OPT" in
t)
TRUECRYPT=true
echo TrueCrypt encryption facility chosen.
;;
options=':t'
while getopts $options option
do
case $option in
t ) USETRUECRYPT=true;;
\? ) if (( (err & ERROPTS) != ERROPTS ))
then
error $NOEXIT $ERROPTS "Unknown option."
fi;;
* ) error $NOEXIT $ERROARG "Missing option argument.";;
esac
done

# Remove the switches we parsed above.
#shift `expr $OPTIND - 1`
shift $(($OPTIND - 1))

# We want at least one non-option argument.
# Remove this block if you don't need it.
#if [ $# -eq 0 ]; then
# echo $USAGE >&2
# exit 1
#fi

# Access additional arguments as usual through
# variables $@, $*, $1, $2, etc. or using this loop:
for PARAM; do
echo $PARAM
done

## Testing if the user has any options for LUKSUS. These should
# probably be ported to GETOPTS code, but it has to stay like this for
# now.
if [ -z "$1" ]
then
echo ""
Expand Down Expand Up @@ -121,3 +114,5 @@ vnconfig 1>/dev/null 2>/dev/null
else
echo On Linux, continuing.
fi


18 changes: 14 additions & 4 deletions LUKSUS.functions
Expand Up @@ -80,8 +80,9 @@ DRIVE: $device \n
MOUNTPOINT: $mountpoint \n
KEYFILE: $keyfile \n
HEADER BACKUP: $headerfile\n
FILECONTAINER LOCATION: $luksfile
FILECONTAINER SIZE: $luksfilesize
FILECONTAINER LOCATION: $luksfile\n
FILECONTAINER SIZE: $luksfilesize\n
USING TRUECRYPT: $USETRUECRYPT\n
" 50 50


Expand Down Expand Up @@ -109,20 +110,29 @@ THESECRETSAUCE()
mkdir -p $mountpoint
mkdir -p $keydir


# dd
# generate a keyfile using completely random data
# from /dev/urandom
dd if=/dev/urandom of=$keyfile bs=512 count=256
echo cryptsetup starting

# Begin the encryption - with TrueCrypt or LUKS
if [[ $USETRUECRYPT = true ]];
then
echo TrueCrypt mode
tcplay --create --device=$device --cipher=AES-256-XTS --keyfile=$keyfile --map=$name
else
# cryptsetup
# format the drive using encryption
# create an encrypted drive with aes-xts-plain cipher
# key size 512
# remember that the key size will increase the safety of the
# encryption, but the a stronger keyfile with more entropy (randomness)
# will produce the best security.
echo Cryptsetup mode
cryptsetup --batch-mode --verbose --key-size=512 --cipher=aes-xts-plain64 luksFormat $device $keyfile
fi



# cryptsetup isLuks
# check to see if the device has got a valid LUKS container
Expand Down
6 changes: 3 additions & 3 deletions LUKSUS.variables
@@ -1,6 +1,6 @@
programname=LUKSUS
version=v0.8.91
date=05.03.2013
version=v0.95
date=06.03.2013
author="Thomas J. Frivold"

time1="$(date +%s.%N)"
Expand All @@ -19,4 +19,4 @@ UNAME=`uname`
screensize=`stty size`
height=$(echo $screensize | cut -d " " -f 1)
width=$(echo $screensize | cut -d " " -f 2)

USETRUECRYPT=false

0 comments on commit 3231f9c

Please sign in to comment.