coffin

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

commit c72765a0c46be65f742dca8abf3cf2ae2f0ba319
parent e93d938346c05f829aead9ef59febf0afa9f9403
Author: parazyd <parazyd@dyne.org>
Date:   Sat,  6 Feb 2016 16:20:12 +0100

middleman shell for webadmin

Diffstat:
Aweb/undertaker | 47+++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+), 0 deletions(-)

diff --git a/web/undertaker b/web/undertaker @@ -0,0 +1,47 @@ +#!/usr/bin/env zsh +# +# Shell script for webadmin to work as a middleman between the web and +# rest of the tombox +# +# ~ parazyd + +keymount="/media/tombkey" +coffindot=".coffin" + +happenz=$1 +device=$2 +user=$3 +size=$4 + +if [[ $happenz == "CREATE" ]]; then + + if [[ -d /home/$user ]]; then + echo "User already exists. Exiting..."; exit + fi + + sudo useradd -G tombox -m -s /bin/bash $user; echo "Added user: $user <br>" + sudo -u $user tomb dig -s $size /home/$user/$user; echo "Finished digging tomb <br>" + + sudo mkdir -p $keymount; echo "mkdir $keymount <br>" + sudo mount $device $keymount; echo "Mounted $device to $keymount <br>" + sudo mkdir $keymount/$coffindot; echo "mkdir $keymount/$coffindot <br>" + sudo chown -R $user:$user $keymount; echo "chown on those <br>" + + sudo -u $user tomb forge $keymount/$coffindot/$user.key --unsafe --tomb-pwd lalala ; \ + echo "Forged tomb's key at $keymount/$coffindot/$user.key <br>" + sudo -u $user tomb lock /home/$user/$user -k $keymount/$coffindot/$user.key --unsafe --tomb-pwd lalala ; \ + echo "Locked tomb with the key <br>" + + sudo umount $keymount; sudo rmdir $keymount; echo "Unmounted usb key <hr>" +fi + +if [[ $happenz == "REVOKE" ]]; then + + sudo mount $device $keymount + if ! [[ -d $keymount/$coffindot ]]; then + echo "No valid $coffindot dir. Exiting..."; exit + fi + + + +fi