coffin

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

commit c4ed1f8e424d2a2aa952640be61bf13eb6171c22
parent f93af1133909fc68bb6a6d4aa83a219750a197b8
Author: parazyd <parazyd@dyne.org>
Date:   Tue, 29 Mar 2016 17:27:26 +0200

added override config file

Diffstat:
Asrc/coffinrc | 10++++++++++
Msrc/sacrist | 18+++++++++++-------
Asrc/zlibs/config | 19+++++++++++++++++++
3 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/src/coffinrc b/src/coffinrc @@ -0,0 +1,10 @@ +# Configuration file for coffin. If you want to override any defaults, +# please do so here, and rename the file to '.coffinrc'. +# Careful! +# +# Directory where you keep all your tombs and data +GRAVEYARD /home/graveyard +# Directory where your keys get mounted +KEYMOUNT /media/tombkey +# Path to tomb executable +TOMB /usr/local/bin/tomb diff --git a/src/sacrist b/src/sacrist @@ -16,7 +16,7 @@ swapoff -a # Security zkv=1 helpers=1 -R=${COFFIN_PATH:-`pwd`} +R=`pwd` source $R/zlibs/zuper # USB key @@ -33,24 +33,28 @@ source $R/zlibs/hooks source $R/zlibs/keyfiles source $R/zlibs/mounts source $R/zlibs/ttab +source $R/zlibs/config LOCK=$R/.lock [[ -f $LOCK ]] && { warn "Lock found. Wait until finished." && exit } touch $LOCK +# Check for a configuration file +[[ -f ".coffinrc" ]] && parse-config + device=$1 && xxx "Device: $device" happenz=$2 && xxx "Happenz: $happenz" keyuuid=$(lsblk -no uuid $device) && xxx "Key UUID: $keyuuid" GRAVEYARD="${GRAVEYARD:-/home/graveyard}" # Our graveyard, with all the tombs -TOMBS="${TOMBS:-$GRAVEYARD/tombs}" # Info about opened tombs, holds keyuuid, keyhash and tombid -TMPTOMBS="${TMPTOMBS:-$GRAVEYARD/tmptombs}" # Temp tempfile, for updating $tombs +TOMBS="$GRAVEYARD/tombs" # Info about opened tombs, holds keyuuid, keyhash and tombid +TMPTOMBS="$GRAVEYARD/tmptombs" # Temp tempfile, for updating $tombs +TOMBPASSWD="$GRAVEYARD/passwd" KEYMOUNT="${KEYMOUNT:-/media/tombkey}" # Directory where keys get mounted -COFFINDOT="${COFFINDOT:-$KEYMOUNT/.coffin}" # .coffin directory on the usb key -TTAB="${TTAB:-$COFFINDOT/ttab}" # Our ttab -HOOKS="${HOOKS:-$COFFINDOT/hook}" +COFFINDOT="$KEYMOUNT/.coffin" # .coffin directory on the usb key +TTAB="$COFFINDOT/ttab" # Our ttab +HOOKS="$COFFINDOT/hook" TOMB="${TOMB:-/usr/local/bin/tomb}" -TOMBPASSWD="${TOMBPASSWD:-$GRAVEYARD/passwd}" # Main req=(happenz device) diff --git a/src/zlibs/config b/src/zlibs/config @@ -0,0 +1,19 @@ +#!/usr/bin/env zsh + +parse-config() { + act "Found config file. Parsing..." + + ttmp=`awk ' + /^#/ { next } + /^GRAVEYARD / { printf "GRAVEYARD=\"%s\";", $2 } + /^KEYMOUNT / { printf "KEYMOUNT=\"%s\";", $2 } + /^TOMB / { printf "TOMB=\"%s\";", $2 } + ' "$R/.coffinrc"` + { test $? = 0 } || { + die "Error parsing config file." + return 1 + } + + eval "$ttmp" + act "Success parsing config file!" +}