coffin

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

commit 936eaabdf97d76a188d416cb1addb41247fa44f5
parent 490b71a2cd862f90538d3cf1ea5b26d6124881c4
Author: parazyd <parazyd@dyne.org>
Date:   Mon,  7 Mar 2016 21:13:51 +0100

ssh(fs) implementation

Diffstat:
Mbin/sacrist | 24++++++++++++++++++++----
Mgmakehook | 16++++++++++++++++
2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/bin/sacrist b/bin/sacrist @@ -145,18 +145,34 @@ _create_new_tomb() { if [[ $entry =~ webdav && -f $coffindot/webdav.conf ]]; then _msg info "Found WebDAV data. Setting up..." - cat $coffindot/davinfo >> /etc/apache2/davpasswd - _msg info "Wrote to davpasswd" + if [[ -f $coffindot/davinfo ]]; then + cat $coffindot/davinfo >> /etc/apache2/davpasswd + rm $coffindot/davinfo + gpasswd -a www-data $undertaker + _msg info "Wrote to davpasswd" + fi sed -i -e :a -e '$d;N;2,3ba' -e 'P;D' /etc/apache2/sites-available/tomboxdav.conf - cat webdav.conf >> /etc/apache2/sites-available/tomboxdav.conf + cat $coffindot/webdav.conf >> /etc/apache2/sites-available/tomboxdav.conf _msg info "Wrote to tomboxdav.conf" - gpasswd -a www-data $undertaker + rm $coffindot/webdav.conf /etc/init.d/apache2 restart _msg info "Done setting up WebDAV!" else _msg info "No WebDAV data found. Continuing..." fi + if [[ $entry =~ sshfs && -f $coffindot/sshpubkey ]]; then + _msg info "Found SSH info. Setting up..." + mkdir -p /home/$undertaker/.ssh + cat $coffindot/sshpubkey >> /home/$undertaker/.ssh/authorized_keys + chown -R $undertaker:$undertaker /home/$undertaker/.ssh + _msg info "Wrote to authorized_keys" + rm $coffindot/sshpubkey + _msg info "Done setting up SSH." + else + _msg info "No SSH data found. Continuing..." + fi + sudo -u $undertaker $tomb dig -s $tombsize $graveyard/$tombid.tomb sudo -u $undertaker $tomb forge $graveyard/$tombid.key --unsafe --tomb-pwd "$keypass" sudo -u $undertaker $tomb lock $graveyard/$tombid.tomb -k $graveyard/$tombid.key \ diff --git a/gmakehook b/gmakehook @@ -173,6 +173,11 @@ function _clean { # }}} # {{{ zenity dialogs +function _fsel { + --window-icon="$MONMORT" \ + --file-selection \ + --title="$1" +} function _zenques { zenity \ --window-icon="$MONMORT" \ @@ -334,6 +339,15 @@ function _create { fi fi + if [[ $feats =~ "sshfs" ]]; then + _zenques "Do you already have an SSH key setup for your user?" + if [[ $? = 1 ]]; then + sshpubkey=$(_fsel "Select your SSH pubkey you want to use.") + else + sshpubkey="" + fi + fi + TOMBHOOKS=$(_zenques "Choose 'Yes' if you want to edit your tomb's bind-hooks and post-hooks") if [[ $? = 0 ]]; then bindhook=$(zenity \ @@ -376,6 +390,7 @@ function _create { else print "create:${UNDERTAKER}:${TOMBNAME}:${TOMBSIZE}:${feats}" | sudo tee $hooks if [[ $feats =~ "webdav" ]]; then; _writedavinfo; fi + if [[ -n $sshpubkey ]]; then; cp $sshpubkey ./sshpubkey ; fi if [[ -n $bindhook ]]; then print "$bindhook" | sudo tee $coffindot/bindhooks fi @@ -388,6 +403,7 @@ function _create { else print "create:${UNDERTAKER}:${TOMBNAME}:${TOMBSIZE}:${feats}" | sudo tee $hooks if [[ $feats =~ "webdav" ]]; then; _writedavinfo; fi + if [[ -n $sshpubkey ]]; then; cp $sshpubkey $coffindot/sshpubkey ; fi if [[ -n $bindhook ]]; then print "$bindhook" | sudo tee $coffindot/bindhooks fi