tomb

the crypto undertaker
git clone git://parazyd.org/tomb.git
Log | Files | Refs | README | LICENSE

commit 25512c5864ed3a8d09dc8b98a5e548c93b709c1b
parent 419ad9a2bc3326606017871eb124808395fdb4de
Author: boyska <piuttosto@logorroici.org>
Date:   Sat,  1 Sep 2012 17:17:47 +0200

chown of the tomb is done immediately

Diffstat:
Msrc/tomb | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/tomb b/src/tomb @@ -691,6 +691,10 @@ create_tomb() { tombsize_4k=`expr $tombsize \* 1024 / 4` _message "Generating ${tombfile} of ${tombsize}Mb (${tombsize_4k} blocks of 4Kb)" + # we will first touch the file and set permissions: this way, even if interrupted, permissions are right + touch ${tombdir}/${tombfile} + chown ${_uid}:${_gid} "${tombdir}/${tombfile}" + chmod 0600 "${tombdir}/${tombfile}" $DD if=/dev/urandom bs=4k count=${tombsize_4k} of=${tombdir}/${tombfile} if [ $? = 0 -a -e ${tombdir}/${tombfile} ]; then @@ -794,13 +798,14 @@ create_tomb() { header="" ;; esac + touch $tombkey + chown ${_uid}:${_gid} ${tombkey} + chmod 0600 ${tombkey} ( echo -n $header; gpg \ --openpgp --batch --no-options --no-tty --passphrase-fd 0 2>/dev/null \ -o - -c -a ${keytmp}/tomb.tmp <<< ${tombpass} ) > $tombkey unset tombpass - chown ${_uid}:${_gid} ${tombkey} - chmod 0600 ${tombkey} # if [ $? != 0 ]; then # _warning "setting password failed: gnupg returns 2" @@ -846,10 +851,6 @@ create_tomb() { cryptsetup luksClose tomb.tmp losetup -d ${nstloop} - # set permissions on the tomb - chown ${_uid}:${_gid} "${tombdir}/${tombfile}" - chmod 0600 "${tombdir}/${tombfile}" - _message "done creating $tombname encrypted storage (using Luks dm-crypt ${create_cipher}:sha256)" _success "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombkey}"