tsimplification - coffin - secure lan file storage on a device
HTML git clone git://parazyd.org/coffin.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 4ea2ed3d1e812aed5e82b9b084ed9618b76a3c7b
DIR parent 64c9bd1375a4fc023e9321e0cd1d42112d931cff
HTML Author: parazyd <parazyd@dyne.org>
Date: Thu, 28 Jan 2016 21:24:15 +0100
simplification
Diffstat:
M bin/sacrist | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
---
DIR diff --git a/bin/sacrist b/bin/sacrist
t@@ -27,20 +27,11 @@ _mountkey() {
mount $device $keymount
}
-_getttab() {
- if [[ $1 == "user" ]]; then
- undertaker=`cat $keymount/$coffindot/ttab | awk -F: '{print $1}'`
- chown -R $undertaker $keymount/$coffindot
- elif [[ $1 == "tombname" ]]; then
- tombname=`cat $keymount/$coffindot/ttab | awk -F: '{print $2}'`
- elif [[ $1 == "graveyard" ]]; then
- graveyard=`cat $keymount/$coffindot/ttab | awk -F: '{print $3}'`
- fi
-}
+_get_ttab() { ttab=`ls $keymount/$coffindot | awk -F. '{print $1}'` }
_hashkey() {
- _getttab tombname
- cat $keymount/$coffindot/$tombname.key \
+ _get_ttab
+ cat $keymount/$coffindot/$ttab.key \
| sha512sum \
| awk -F" " '{print $1}'
}
t@@ -65,13 +56,13 @@ _msg() {
if [[ $happenz == "CREATE" ]]; then
_mountkey
- if [[ -f "$keymount/$coffindot/ttab" ]]; then
- _getttab user; _msg info "Got undertaker: $undertaker"
+ if [[ -d "$keymount/$coffindot" ]]; then
+ _get_ttab; _msg info "Got undertaker: $ttab"
_compare_key
if [[ $happenz == "close" ]]; then
_msg info "Comparekey true"
- tombname=`cat $tmptombs | grep $keyhash | awk -F: '{print $3}'`; _msg info "Got tombname: $tombname"
+ tombname=`cat $tmptombs | grep $keyhash | awk -F: '{print $1}'`; _msg info "Got tombname: $ttab"
tomb slam $tombname
cp $tmptombs $temptombs
grep -v "$keyhash" $temptombs > $tmptombs; _msg info "Put stuff in $tmptombs"
t@@ -79,10 +70,9 @@ if [[ $happenz == "CREATE" ]]; then
umount $keymount; rmdir $keymount; _msg info "Unmounted usb"
elif [[ $happenz == "open" ]]; then
_msg info "Comparekey false"
- _getttab tombname; _getttab graveyard; _msg info "Got tombname and graveyard"
-
- echo -e "$undertaker:$graveyard:$tombname:$keyhash:$keyuuid\n" >> $tmptombs ; _msg info "Added it to $tmptombs"
- su $undertaker -c "tomb open $graveyard/$tombname -k $keymount/$coffindot/$tombname.key --unsafe --tomb-pwd lalala"
+ _get_ttab
+ echo -e "$ttab:$keyhash:$keyuuid\n" >> $tmptombs ; _msg info "Added it to $tmptombs"
+ su $ttab -c "tomb open /home/$ttab/$ttab -k $keymount/$coffindot/$ttab.key --unsafe --tomb-pwd lalala"
umount $keymount; rmdir $keymount; _msg info "Unmounted usb"
fi