coffin

secure lan file storage on a device
git clone git://parazyd.org/coffin.git
Log | Files | Refs | Submodules | README | LICENSE

commit 9f9672d40ff940a46df63523aeeab501c2ebd79b
parent 80bb8a40f1e53059404cd13a0d321127b0f8d072
Author: parazyd <parazyd@dyne.org>
Date:   Mon, 22 Feb 2016 15:09:24 +0100

changed var names because of conflicts with tomb

Diffstat:
Mbin/sacrist | 36++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/bin/sacrist b/bin/sacrist @@ -9,7 +9,7 @@ happenz=$2 keyuuid=$(blkid $device | awk -F\" '{print $2}') # Vars -tmptombs="/tmp/tombs" # Info about opened tombs, holds keyuuid, keyhash and tombname +tmptombs="/tmp/tombs" # Info about opened tombs, holds keyuuid, keyhash and tombid tmptombs2="/tmp/tombs2" # Temp tempfile, for updating $tmptombs graveyard="/home/graveyard" # Our graveyard, with all the tombs keymount="/media/tombkey" # Directory where keys get mounted @@ -41,24 +41,24 @@ _ttabmagic() { _msg info "Working on tomb from line $line..." undertaker=$(echo $entry | awk -F: '{print $1}') echo "Username: $undertaker" - tombname=$(echo $entry | awk -F: '{print $2}') - echo "Tomb name: $tombname" + tombid=$(echo $entry | awk -F: '{print $2}') + echo "Tomb name: $tombid" _comparekey if [[ $happenz == "close" ]]; then _msg warn "Comparekey true" - sudo -u $undertaker $tomb slam $tombname + sudo -u $undertaker $tomb slam $tombid cp $tmptombs $tmptombs2 grep -v $keyhash $tmptombs2 > $tmptombs; chmod 600 $tmptombs; _msg info "Updated $tmptombs" rm $tmptombs2 continue fi _msg warn "Comparekey false" - tombpass=$(echo $entry | awk -F: '{print $3}') - echo "Tomb passphrase: $tombpass" - sudo -u $undertaker $tomb open $graveyard/$tombname.tomb -k $coffindot/$tombname.key \ - --unsafe --tomb-pwd $tombpass # Deal with this shit somehow! + keypass=$(echo $entry | awk -F: '{print $3}') + echo "Tomb passphrase: $keypass" + sudo -u $undertaker $tomb open $graveyard/$tombid.tomb -k $coffindot/$tombname.key \ + --unsafe --tomb-pwd $keypass # Deal with this shit somehow! - if [[ -d "/media/$tombname" ]]; then + if [[ -d "/media/$tombid" ]]; then echo "$undertaker:$keyhash:$keyuuid" >> $tmptombs; chmod 600 $tmptombs; _msg info "Added info to $tmptombs" else _msg warn "Nothing added to $tmptombs" @@ -69,7 +69,7 @@ _ttabmagic() { } _hashkey() { - cat $coffindot/$tombname.key | sha512sum | awk -F" " '{print $1}' + cat $coffindot/$tombid.key | sha512sum | awk -F" " '{print $1}' } _comparekey() { @@ -84,8 +84,8 @@ _comparekey() { _create_new_tomb() { _msg info "Creating new tomb!" undertaker=$(cat $createme | awk -F: '{print $1}') - tombname=$(cat $createme | awk -F: '{print $2}') - tombpass=$(cat $createme | awk -F: '{print $3}') + tombid=$(cat $createme | awk -F: '{print $2}') + keypass=$(cat $createme | awk -F: '{print $3}') tombsize=$(cat $createme | awk -F: '{print $4}') if ! [[ ( $(id $undertaker) ) ]]; then @@ -94,13 +94,13 @@ _create_new_tomb() { _msg info "Created user $undertaker" fi - sudo -u $undertaker $tomb dig -s $tombsize $graveyard/$tombname.tomb - sudo -u $undertaker $tomb forge $graveyard/$tombname.key --unsafe --tomb-pwd "$tombpass" - sudo -u $undertaker $tomb lock $graveyard/$tombname.tomb -k $graveyard/$tombname.key \ - --unsafe --tomb-pwd "$tombpass" - mv $graveyard/$tombname.key $coffindot/ && chown $undertaker:$undertaker $coffindot/$tombname.key && \ + sudo -u $undertaker $tomb dig -s $tombsize $graveyard/$tombid.tomb + sudo -u $undertaker $tomb forge $graveyard/$tombid.key --unsafe --tomb-pwd "$keypass" + sudo -u $undertaker $tomb lock $graveyard/$tombid.tomb -k $graveyard/$tombname.key \ + --unsafe --tomb-pwd "$keypass" + mv $graveyard/$tombid.key $coffindot/ && chown $undertaker:$undertaker $coffindot/$tombname.key && \ _msg info "Moved and chowned keyfile" - echo "$undertaker:$tombname:$tombpass:true" >> $ttab + echo "$undertaker:$tombid:$keypass:true" >> $ttab _msg info "Wrote to $ttab" rm $createme && _msg info "Removed $createme" }