coffin

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

commit c8469c1d7100a08baa625ae50d3ea7b83e46c928
parent bc1262457bdb09a8736897b14521e83aa920e3cf
Author: parazyd <parazyd@dyne.org>
Date:   Tue, 17 May 2016 14:38:35 +0200

wrap tomb open/close; tombtemps

Diffstat:
Msrc/extra/gen.sh | 4++--
Msrc/zlibs/hooks | 14++++++++++++++
Msrc/zlibs/ttab | 27++++++++++++++++++++-------
3 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/extra/gen.sh b/src/extra/gen.sh @@ -27,6 +27,6 @@ fprint=`openssl x509 -noout -in ./coffin.pem -fingerprint \ echo "#############################" echo "Successfully generated coffin's SSL certificate!" -echo "The fingerprint is: $fprint" -echo "Compare it and/or set it as trusted when you connect to coffin." +echo "The fingerprint is: \033[0;32m${fprint}" +echo "\033[0mCompare it and/or set it as trusted when you connect to coffin." echo "#############################" diff --git a/src/zlibs/hooks b/src/zlibs/hooks @@ -144,3 +144,17 @@ delete-tomb() { delete-sshfs-hook $undertaker $tombid } } + +check-temptomb() { + fn check-temptomb + + act "Checking for tomb temps" + if [[ -d ${GRAVEYARD}/temp/${tombid} ]]; then + mv ${GRAVEYARD}/temp/${tombid}/* /media/${tombid}/ + mv ${GRAVEYARD}/temp/${tombid}/.* /media/${tombid}/ + + act "Moved all tomb temps" + + rmdir ${GRAVEYARD}/temp/${tombid} + fi +} diff --git a/src/zlibs/ttab b/src/zlibs/ttab @@ -56,7 +56,7 @@ ttab-magic() { compare-key [[ $? = 0 ]] && { act "compare-key -> true" - sudo -u $undertaker $TOMB slam $tombid + close-tomb update-tombs del continue @@ -69,17 +69,30 @@ ttab-magic() { keypass=${keypass[(ws@:@)2]} xxx "Key password: $keypass" - sudo -u $undertaker $TOMB open $GRAVEYARD/$tombid.tomb \ - -k $COFFINDOT/$tombid.key \ - --unsafe \ - --tomb-pwd "$keypass" - - [[ $? = 0 ]] || { die "Tomb didn't open" && return 1 } + open-tomb [[ -d "/media/$tombid" ]] && { chmod g+rw /media/$tombid update-tombs add } + + check-temptomb } done } + +open-tomb() { + sudo -u ${undertaker} ${TOMB} open \ + ${GRAVEYARD}/${tombid}.tomb \ + -k ${COFFINDOT}/${tombid}.key \ + --unsafe \ + --tomb-pwd "${keypass}" + + [[ $? = 0 ]] || { die "Tomb didn't open" && return 1 } +} + +close-tomb() { + sudo -u ${undertaker} ${TOMB} slam ${tombid} + + [[ $? = 0 ]] || { die "Tomb didn't slam" && return 1 } +}