"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "testing/mudslinger.in" between
cryptmount-5.3.2.tar.gz and cryptmount-5.3.3.tar.gz

About: cryptmount allows any user to access encrypted filing systems on demand under GNU/Linux systems. It also assists the system administrator in creating and managing encrypted filesystems based on the kernels dm-crypt device-mapper target.

mudslinger.in  (cryptmount-5.3.2):mudslinger.in  (cryptmount-5.3.3)
#!/bin/bash #!/bin/bash
# Testing script for cryptmount (compiled with -DTESTING) # Testing script for cryptmount (compiled with -DTESTING)
# RW Penney, December 2005 # RW Penney, December 2005
DD=/bin/dd DD="/bin/dd oflag=sync"
LOSETUP=/sbin/losetup LOSETUP=/sbin/losetup
SU_p="/bin/su -p" SU_p="/bin/su -p"
TMPDIR=/tmp/cm-$$ TMPDIR=/tmp/cm-$$
CM=../cryptmount CM=../cryptmount
PASSWD="3normouslyComplexPassw0rd,maybe?" PASSWD="3normouslyComplexPassw0rd,maybe?"
# Pair of users, with valid login-shells: # Pair of users, with valid login-shells:
USER1=bin USER1=bin
USER2=nobody USER2=nobody
# Pair of unused loopback devices: LOOPDEV=/dev/null
LOOPDEV=`${LOSETUP} -f` LOOPDEV2=/dev/null
LOOPDEV2=/dev/loop5
DATEFMT="+%d%b%y-%H:%M:%S" DATEFMT="+%d%b%y-%H:%M:%S"
function listLoopDevs() {
# Find free loopback devices least likely to be selected by 'losetup -f'
losetup -f > /dev/null
losetup -l -O NAME | \
sed '1d' > ${TMPDIR}/usedLoops
ls /dev/loop[0-9] | \
grep -v -f ${TMPDIR}/usedLoops | \
sort -r > ${TMPDIR}/availableLoops
};
# #
# Testing infrastructure # Testing infrastructure
# #
NTESTS_RUN=0 NTESTS_RUN=0
NTESTS_FAILED=0 NTESTS_FAILED=0
NTESTS_PASSED=0 NTESTS_PASSED=0
NTESTS_ABORTED=0 NTESTS_ABORTED=0
if test -t 1 && which tput >/dev/null 2>&1; then if test -t 1 && which tput >/dev/null 2>&1; then
skipping to change at line 273 skipping to change at line 282
if ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3; then true; else test_fail release; return; fi if ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3; then true; else test_fail release; return; fi
test_pass test_pass
}; };
function test_setup_roloop() { function test_setup_roloop() {
# Test prepare/release of loopback on read-only device # Test prepare/release of loopback on read-only device
if test_start "read-only loopback"; then true; else return; fi if test_start "read-only loopback"; then true; else return; fi
idx=`mkrandshort` idx=`mkrandshort`
mkdir ${TMPDIR}/romnt mkdir ${TMPDIR}/romnt
${DD} if=/dev/zero of=${TMPDIR}/roloopfile bs=1M count=16 2>/dev/null ${DD} if=/dev/zero of=${TMPDIR}/roloopfile bs=1M count=16 2>/dev/null
${LOSETUP} ${LOOPDEV2} ${TMPDIR}/roloopfile ${LOSETUP} "${LOOPDEV2}" ${TMPDIR}/roloopfile
mke2fs -q ${LOOPDEV2} mke2fs -q "${LOOPDEV2}"
mount -t ext2 ${LOOPDEV2} ${TMPDIR}/romnt mount -t ext2 "${LOOPDEV2}" ${TMPDIR}/romnt
${DD} if=/dev/zero of=${TMPDIR}/romnt/lpfl bs=1M count=8 2>/dev/null ${DD} if=/dev/zero of=${TMPDIR}/romnt/lpfl bs=1M count=8 2>/dev/null
cat <<EOF > ${TMPDIR}/cmtab cat <<EOF > ${TMPDIR}/cmtab
target${idx} { target${idx} {
dev=${TMPDIR}/romnt/lpfl flags=nofsck dev=${TMPDIR}/romnt/lpfl flags=nofsck
loop=auto loop=auto
dir=${TMPDIR}/mnt dir=${TMPDIR}/mnt
fstype=ext2 mountoptions=ro cipher=twofish fstype=ext2 mountoptions=ro cipher=twofish
keyformat=builtin keyfile=${TMPDIR}/keyfile keyformat=builtin keyfile=${TMPDIR}/keyfile
keyhash=sha1 keycipher=blowfish-cbc keyhash=sha1 keycipher=blowfish-cbc
} }
EOF EOF
cleanup="umount ${TMPDIR}/romnt; ${LOSETUP} -d ${LOOPDEV2}; rm ${TMPDIR}/rol oopfile; rmdir ${TMPDIR}/romnt" cleanup="umount ${TMPDIR}/romnt; ${LOSETUP} -d "${LOOPDEV2}"; rm ${TMPDIR}/r oloopfile; rmdir ${TMPDIR}/romnt"
rm -f ${TMPDIR}/keyfile rm -f ${TMPDIR}/keyfile
if ${CM} --config-dir ${TMPDIR} --newpassword "${PASSWD}" --generate-key 16 target${idx} 2>&3; then true; else test_fail "key-generation" "${cleanup}"; retu rn; fi if ${CM} --config-dir ${TMPDIR} --newpassword "${PASSWD}" --generate-key 16 target${idx} 2>&3; then true; else test_fail "key-generation" "${cleanup}"; retu rn; fi
if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --prepare target${idx } 2>&3; then true; else test_fail "prepare" "${cleanup}" ; return; fi if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --prepare target${idx } 2>&3; then true; else test_fail "prepare" "${cleanup}" ; return; fi
if mke2fs -q /dev/mapper/target${idx}; then true; else test_fail "mke2fs" "$ {cleanup}"; return; fi if mke2fs -q /dev/mapper/target${idx}; then true; else test_fail "mke2fs" "$ {cleanup}"; return; fi
wait_udev wait_udev
if ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3; then true; else test_fail "release" "${cleanup}"; return; fi if ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3; then true; else test_fail "release" "${cleanup}"; return; fi
mount -o remount,ro ${TMPDIR}/romnt mount -o remount,ro ${TMPDIR}/romnt
if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --mount target${idx} 2>&3; then true; else test_fail "mount-ro" "${cleanup}" ; return; fi if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --mount target${idx} 2>&3; then true; else test_fail "mount-ro" "${cleanup}" ; return; fi
wait_udev wait_udev
if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --unmount target${idx } 2>&3; then true; else test_fail "unmount-ro" "${cleanup}" ; return; fi if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --unmount target${idx } 2>&3; then true; else test_fail "unmount-ro" "${cleanup}" ; return; fi
skipping to change at line 1003 skipping to change at line 1012
dev=${TMPDIR}/devfile dev=${TMPDIR}/devfile
startsector=${offset} startsector=${offset}
numsectors=${length} numsectors=${length}
dir=${TMPDIR}/mnt dir=${TMPDIR}/mnt
fstype=ext2 mountoptions=defaults fstype=ext2 mountoptions=defaults
cipher=aes ivoffset=61 cipher=aes ivoffset=61
keyfile=${TMPDIR}/keyfile keyfile=${TMPDIR}/keyfile
} }
EOF EOF
test -f ${TMPDIR}/keyfile || ${CM} --config-dir ${TMPDIR} --newpassw ord "${PASSWD}" --generate-key 16 target${idx} 2>&3 test -f ${TMPDIR}/keyfile || ${CM} --config-dir ${TMPDIR} --newpassw ord "${PASSWD}" --generate-key 16 target${idx} 2>&3
${DD} if=/dev/zero of=${LOOPDEV} 2>/dev/null ${DD} if=/dev/zero of=${LOOPDEV} bs=1M count=32 2>/dev/null
sync sync
if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --prepare tar get${idx} 2>&3; then if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --prepare tar get${idx} 2>&3; then
cleanup="${CM} --config-dir ${TMPDIR} --release target${idx}" cleanup="${CM} --config-dir ${TMPDIR} --release target${idx}"
${DD} if=/dev/zero of=/dev/mapper/target${idx} bs=1b count=`expr ${length} + 16` 2>&3 ${DD} if=/dev/zero of=/dev/mapper/target${idx} bs=1b count=`expr ${length} + 16` 2>&3
wait_udev wait_udev
${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3 ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3
wait_udev wait_udev
sync sync
locs=`${TMPDIR}/bingrep < ${LOOPDEV}` locs=`${TMPDIR}/bingrep < ${LOOPDEV}`
first=`echo $locs | awk '{printf"%d",($1 / 512)}'` first=`echo $locs | awk '{printf"%d",($1 / 512)}'`
skipping to change at line 1277 skipping to change at line 1286
}; };
function test_luks_compat() { function test_luks_compat() {
# Check compatibility with cryptsetup-luks, importing into cryptmount # Check compatibility with cryptsetup-luks, importing into cryptmount
if test_start "LUKS compatibility"; then true; else return; fi if test_start "LUKS compatibility"; then true; else return; fi
if which cryptsetup 1>&3; then true; else test_fail "cryptsetup not availabl e"; return; fi if which cryptsetup 1>&3; then true; else test_fail "cryptsetup not availabl e"; return; fi
if ${CM} --key-managers 2>/dev/null | grep -q luks; then true; else test_fai l "No LUKS support"; return; fi if ${CM} --key-managers 2>/dev/null | grep -q luks; then true; else test_fai l "No LUKS support"; return; fi
echo -n "keyslot0-password" > ${TMPDIR}/keymat0 echo -n "keyslot0-password" > ${TMPDIR}/keymat0
echo -n "${PASSWD}" > ${TMPDIR}/keymat echo -n "${PASSWD}" > ${TMPDIR}/keymat
for CipherLen in aes,128 blowfish,288 twofish-ecb,128 serpent-cbc-plain,96 for CipherLen in aes,128 blowfish,288 twofish-xts-plain64,256 serpent-cbc-es siv:sha256,96
do do
tupelize $CipherLen cipher len tupelize $CipherLen cipher len
echo "config: $CipherLen" 1>&3 echo "config: $CipherLen" 1>&3
# Setup partition with cryptsetup-luks: # Setup partition with cryptsetup-luks:
TMPTGT="mudslinger-`mkrandshort`" TMPTGT="mudslinger-`mkrandshort`"
if ${DD} if=/dev/zero of=${LOOPDEV} bs=1k count=1 conv=notrunc 2>/dev/nu ll; then true; else test_fail "purging"; return; fi if ${DD} if=/dev/zero of=${LOOPDEV} bs=1M count=1 conv=notrunc 2>/dev/nu ll; then true; else test_fail "purging"; return; fi
cryptsetup --batch-mode --cipher ${cipher} --key-size ${len} luksFormat "${LOOPDEV}" ${TMPDIR}/keymat0 1>&3 2>&3 cryptsetup --batch-mode --cipher ${cipher} --key-size ${len} luksFormat "${LOOPDEV}" ${TMPDIR}/keymat0 1>&3 2>&3
sync
cryptsetup --key-file ${TMPDIR}/keymat0 --cipher ${cipher} --key-slot 2 luksAddKey "${LOOPDEV}" ${TMPDIR}/keymat 1>&3 2>&3 cryptsetup --key-file ${TMPDIR}/keymat0 --cipher ${cipher} --key-slot 2 luksAddKey "${LOOPDEV}" ${TMPDIR}/keymat 1>&3 2>&3
wait_udev sync; wait_udev
cryptsetup --key-file ${TMPDIR}/keymat luksOpen "${LOOPDEV}" "${TMPTGT}" 1>&3 2>&3 cryptsetup --key-file ${TMPDIR}/keymat luksOpen "${LOOPDEV}" "${TMPTGT}" 1>&3 2>&3
if [ ! -b /dev/mapper/${TMPTGT} ]; then test_fail "luksOpen"; return; fi if [ ! -b /dev/mapper/${TMPTGT} ]; then test_fail "luksOpen"; return; fi
if mke2fs -q -j "/dev/mapper/${TMPTGT}"; then true; else test_fail mke2f s; return; fi if mke2fs -q -j "/dev/mapper/${TMPTGT}"; then true; else test_fail mke2f s; return; fi
wait_udev wait_udev
cryptsetup luksClose "${TMPTGT}" 2>&3 cryptsetup luksClose "${TMPTGT}" 2>&3
sync sync; wait_udev
idx=`mkrandshort` idx=`mkrandshort`
cat <<EOF > ${TMPDIR}/cmtab cat <<EOF > ${TMPDIR}/cmtab
target${idx} { target${idx} {
dev=${LOOPDEV} dir=${TMPDIR}/mnt dev=${LOOPDEV} dir=${TMPDIR}/mnt
fstype=ext3 flags=nofsck fstype=ext3 flags=nofsck
keyformat=luks keyformat=luks
cipher=aes # This should be overridden by LUKS header cipher=aes # This should be overridden by LUKS header
} }
EOF EOF
if ${SU_p} ${USER1} -c "${CM} --config-dir ${TMPDIR} --password "${PASSW D}" target${idx}" 2>&3; then true; else test_fail "mount"; return; fi if ${SU_p} ${USER1} -c "${CM} --config-dir ${TMPDIR} --password "${PASSW D}" target${idx}" 2>&3; then true; else test_fail "mount"; return; fi
wait_udev; sleep 1 sync; wait_udev
if ${SU_p} ${USER1} -c "${CM} --config-dir ${TMPDIR} --unmount target${i dx}" 2>&3; then true; else test_fail "unmount"; return; fi if ${SU_p} ${USER1} -c "${CM} --config-dir ${TMPDIR} --unmount target${i dx}" 2>&3; then true; else test_fail "unmount"; return; fi
if ${CM} --config-dir ${TMPDIR} --newpassword "${PASSWD}" --generate-key 16 target${idx} 2>&3; then test_fail "re-formatting"; fi if ${CM} --config-dir ${TMPDIR} --newpassword "${PASSWD}" --generate-key 16 target${idx} 2>&3; then test_fail "re-formatting"; fi
wait_udev wait_udev
done done
rm ${TMPDIR}/keymat0 ${TMPDIR}/keymat rm ${TMPDIR}/keymat0 ${TMPDIR}/keymat
test_pass test_pass
}; };
function test_luks_tapmoc() { function test_luks_tapmoc() {
# Check inverse-compatibility with cryptsetup-luks, as cryptmount export # Check inverse-compatibility with cryptsetup-luks, as cryptmount export
skipping to change at line 1332 skipping to change at line 1342
do do
tupelize $CipherMode cipher mode tupelize $CipherMode cipher mode
echo "config: $CipherMode" 1>&3 echo "config: $CipherMode" 1>&3
# Setup partition with cryptmount: # Setup partition with cryptmount:
idx=`mkrandshort` idx=`mkrandshort`
cat <<EOF > ${TMPDIR}/cmtab cat <<EOF > ${TMPDIR}/cmtab
target${idx} { target${idx} {
dev=${LOOPDEV} dir=${TMPDIR}/mnt dev=${LOOPDEV} dir=${TMPDIR}/mnt
fstype=ext3 flags=nofsck fstype=ext3 flags=nofsck
keyformat=luks keyfile=${LOOPDEV} keyformat=luks
cipher=${cipher}-${mode} cipher=${cipher}-${mode}
} }
EOF EOF
if ${DD} if=/dev/zero of=${LOOPDEV} bs=4k count=4 conv=notrunc 2>/dev/nu ll; then true; else test_fail "purging"; return; fi if ${DD} if=/dev/zero of=${LOOPDEV} bs=1M count=1 conv=notrunc 2>/dev/nu ll; then true; else test_fail "purging"; return; fi
sync sync
if ${CM} --config-dir ${TMPDIR} --newpassword "${PASSWD}" --generate-key 32 target${idx} 1>&3 2>&3; then true; else test_fail "key-generation"; return; fi if ${CM} --config-dir ${TMPDIR} --newpassword "${PASSWD}" --generate-key 32 target${idx} 1>&3 2>&3; then true; else test_fail "key-generation"; return; fi
if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --prepare target$ {idx} 2>&3; then true; else test_fail "prepare"; return; fi if ${CM} --config-dir ${TMPDIR} --password "${PASSWD}" --prepare target$ {idx} 2>&3; then true; else test_fail "prepare"; return; fi
if mke2fs -q /dev/mapper/target${idx}; then true; else test_fail "mke2fs "; return; fi if mke2fs -q /dev/mapper/target${idx}; then true; else test_fail "mke2fs "; return; fi
wait_udev wait_udev
if ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3; then true; else test_fail "release"; return; fi if ${CM} --config-dir ${TMPDIR} --release target${idx} 2>&3; then true; else test_fail "release"; return; fi
wait_udev wait_udev
# Attempt to mount with cryptsetup-luks: # Attempt to mount with cryptsetup-luks:
TMPTGT="mudslinger-`mkrandshort`" TMPTGT="mudslinger-`mkrandshort`"
skipping to change at line 1465 skipping to change at line 1475
if [ ! -u ${CM} ]; then if [ ! -u ${CM} ]; then
chown root ${CM} chown root ${CM}
chmod u+xs,go+rx ${CM} chmod u+xs,go+rx ${CM}
fi fi
# Prepare loopback file & pseudo device file: # Prepare loopback file & pseudo device file:
set -e set -e
touch ${TMPDIR}/keyfile touch ${TMPDIR}/keyfile
${DD} if=/dev/zero of=${TMPDIR}/loopfile bs=1M count=64 2>&3 1>&2 ${DD} if=/dev/zero of=${TMPDIR}/loopfile bs=1M count=64 2>&3 1>&2
${DD} if=/dev/zero of=${TMPDIR}/devfile bs=1M count=64 2>&3 1>&2 ${DD} if=/dev/zero of=${TMPDIR}/devfile bs=1M count=64 2>&3 1>&2
listLoopDevs
LOOPDEV=`sed -n '1p' "${TMPDIR}/availableLoops"`
LOOPDEV2=`sed -n '2p' "${TMPDIR}/availableLoops"`
if ${LOSETUP} ${LOOPDEV} ${TMPDIR}/devfile; then true; else echo "Failed to setu p ${LOOPDEV}"; exit 2; fi if ${LOSETUP} ${LOOPDEV} ${TMPDIR}/devfile; then true; else echo "Failed to setu p ${LOOPDEV}"; exit 2; fi
LOOPDEV2=`${LOSETUP} -f`
set +e set +e
# Keep record of existing device-mapper targets # Keep record of existing device-mapper targets
dmsetup ls | grep '^target' > ${TMPDIR}/dm-list0 dmsetup ls | grep '^target' > ${TMPDIR}/dm-list0
# Prepare binary-search tool: # Prepare binary-search tool:
mkbingrep ${TMPDIR}/bingrep mkbingrep ${TMPDIR}/bingrep
# attempt to cleanup if interrupted: # attempt to cleanup if interrupted:
trap 'cleanup_devmap; ${LOSETUP} -d ${LOOPDEV} || true; ${LOSETUP} -d ${LOOPDEV2 } || true; exit 5' SIGHUP SIGINT SIGQUIT trap 'cleanup_devmap; ${LOSETUP} -d ${LOOPDEV} || true; ${LOSETUP} -d ${LOOPDEV2 } || true; exit 5' SIGHUP SIGINT SIGQUIT
skipping to change at line 1523 skipping to change at line 1535
test_luks_tapmoc test_luks_tapmoc
test_residues test_residues
test_summary test_summary
cleanup_devmap cleanup_devmap
wait_udev wait_udev
${LOSETUP} -d ${LOOPDEV} ${LOSETUP} -d ${LOOPDEV}
rm -f ${TMPDIR}/loopfile ${TMPDIR}/devfile ${TMPDIR}/keyfile \ rm -f ${TMPDIR}/loopfile ${TMPDIR}/devfile ${TMPDIR}/keyfile \
${TMPDIR}/cmtab ${TMPDIR}/cryptmount.status \ ${TMPDIR}/cmtab ${TMPDIR}/cryptmount.status \
${TMPDIR}/dm-list0 ${TMPDIR}/bingrep ${TMPDIR}/dm-list0 ${TMPDIR}/bingrep \
${TMPDIR}/usedLoops ${TMPDIR}/availableLoops
rmdir ${TMPDIR}/mnt* ${TMPDIR} rmdir ${TMPDIR}/mnt* ${TMPDIR}
exit 0 exit 0
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et:
 End of changes. 17 change blocks. 
18 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)