tmiddleman shell for webadmin - 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 
Date:   Sat,  6 Feb 2016 16:20:12 +0100

middleman shell for webadmin

Diffstat:
  A web/undertaker                      |      47 +++++++++++++++++++++++++++++++

1 file changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/web/undertaker b/web/undertaker
t@@ -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 
" + sudo -u $user tomb dig -s $size /home/$user/$user; echo "Finished digging tomb
" + + sudo mkdir -p $keymount; echo "mkdir $keymount
" + sudo mount $device $keymount; echo "Mounted $device to $keymount
" + sudo mkdir $keymount/$coffindot; echo "mkdir $keymount/$coffindot
" + sudo chown -R $user:$user $keymount; echo "chown on those
" + + sudo -u $user tomb forge $keymount/$coffindot/$user.key --unsafe --tomb-pwd lalala ; \ + echo "Forged tomb's key at $keymount/$coffindot/$user.key
" + sudo -u $user tomb lock /home/$user/$user -k $keymount/$coffindot/$user.key --unsafe --tomb-pwd lalala ; \ + echo "Locked tomb with the key
" + + sudo umount $keymount; sudo rmdir $keymount; echo "Unmounted usb key
" +fi + +if [[ $happenz == "REVOKE" ]]; then + + sudo mount $device $keymount + if ! [[ -d $keymount/$coffindot ]]; then + echo "No valid $coffindot dir. Exiting..."; exit + fi + + + +fi