trefactor installation - coffin - secure lan file storage on a device
 (HTM) git clone git://parazyd.org/coffin.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 8ceaaa6ae295fa51e824de63f4e86e6633e8ad45
 (DIR) parent 0c26ca5a864dd457ec0b76639df21f333ffcd6d9
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Thu,  6 Oct 2016 12:52:33 +0200
       
       refactor installation
       
       Diffstat:
         M Makefile                            |      27 +++++++++++++++++++++++++++
         M README.md                           |       4 ++--
         M config.mk                           |       4 +++-
         D extra/Makefile                      |      12 ------------
         D extra/apachedav                     |      14 --------------
         A extra/coffin-initd                  |      36 +++++++++++++++++++++++++++++++
         D extra/coffin.init                   |      37 -------------------------------
         D extra/coffin.key                    |      52 -------------------------------
         D extra/coffin.pem                    |      31 -------------------------------
         A extra/dav_apache                    |      14 ++++++++++++++
         D extra/gen.sh                        |      32 -------------------------------
         A extra/genssl.sh                     |      35 +++++++++++++++++++++++++++++++
         A extra/setup_features.sh             |      92 +++++++++++++++++++++++++++++++
         M helpers/makehook                    |      43 ++++++++++++++-----------------
         M sacrist                             |       3 +++
         D wallet/bindhook                     |       1 -
       
       16 files changed, 231 insertions(+), 206 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       t@@ -14,6 +14,13 @@ OBJ = ${BIN:=.o}
        SRC = ${BIN:=.c}
        
        all: options tomb
       +        @sed -i 's:^DAEMON=.*:DAEMON=${DESTDIR}${PREFIX}/coffin/bin/coffin:' \
       +                extra/coffin-initd
       +        @sed -i 's:^path+=.*:path+=(${DESTDIR}${PREFIX}/coffin/bin):' \
       +                sacrist
       +        @sed -i -e 's:^                SSLCertificateFile.*:                SSLCertificateFile ${DESTDIR}${PREFIX}/coffin/share/coffin.pem:' \
       +                -e 's:^                SSLCertificateKeyFile.*:                SSLCertificateKeyFile ${DESTDIR}${PREFIX}/coffin/share/coffin.key:' \
       +                extra/dav_apache
        
        options:
                @echo coffin build options:
       t@@ -31,10 +38,21 @@ options:
        ${OBJ}: config.mk
        
        tomb: ${BIN} ${OBJ}
       +        @sed -i 's:^path+=.*:path+=( /sbin /usr/sbin ${DESTDIR}${PREFIX}/coffin/bin ):' \
       +                tomb
        
        clean:
                @echo cleaning
                @rm -f ${BIN} ${OBJ}
       +        @sed -i 's:^DAEMON=.*:DAEMON=:' \
       +                extra/coffin-initd
       +        @sed -i 's:^path+=.*:path+=():' \
       +                sacrist
       +        @sed -i -e 's:^                SSLCertificateFile.*:                SSLCertificateFile:' \
       +                -e 's:^                SSLCertificateKeyFile.*:                SSLCertificateKeyFile:' \
       +                extra/dav_apache
       +        @sed -i 's:^path+=.*:path+=( /sbin /usr/sbin ):' \
       +                tomb
        
        dist: clean
                @echo creating dist tarball
       t@@ -54,10 +72,19 @@ install: all
                @mkdir ${DESTDIR}${PREFIX}/coffin/share
                @cp -f coffin sacrist tomb ${BIN} ${DESTDIR}${PREFIX}/coffin/bin/
                @cp -rf zlibs zuper ${DESTDIR}${PREFIX}/coffin/share/
       +        @echo installing features
       +        @./extra/setup_features.sh install ${FEATURES}
       +        @cp -f extra/coffin.key ${DESTDIR}${PREFIX}/coffin/share/
       +        @cp -f extra/coffin.pem ${DESTDIR}${PREFIX}/coffin/share/
       +        @echo installing initscript
       +        @cp -f extra/coffin-initd /etc/init.d/coffin
        
        
        uninstall:
                @echo removing coffin from ${DESTDIR}${PREFIX}
                @rm -rf ${DESTDIR}${PREFIX}/coffin
       +        @rm -f /etc/init.d/coffin
       +        @echo uninstalling features
       +        @./extra/setup_features.sh uninstall ${FEATURES}
        
        .PHONY: all options tomb clean dist install uninstall
 (DIR) diff --git a/README.md b/README.md
       t@@ -41,9 +41,9 @@ device.
        
        ## Usage
        After installation, you will end up with an initscript in /etc/init.d/coffin
       -You can start coffin by issuing `/etc/init.d/coffin start` as root  and the
       +You can start coffin by issuing `/etc/init.d/coffin start` as root and the
        watch script will begin to watch your /dev for new devices. You can see
       -coffin's output by issuing (as root) `tail -f /var/run/coffin.out`
       +coffin's output by issuing (as root) `tail -f /var/log/coffin`
        
        ### Hooks
        Hooks are oneliners written on your USB key which will trigger actions
 (DIR) diff --git a/config.mk b/config.mk
       t@@ -3,8 +3,10 @@
        
        VERSION=0.4
        
       -# customize below to fit your system
       +# remove a feature to disable it
       +FEATURES = webdav ssh
        
       +# customize below to fit your system
        PREFIX = /usr/local
        MANPREFIX = ${PREFIX}/share/man
        
 (DIR) diff --git a/extra/Makefile b/extra/Makefile
       t@@ -1,12 +0,0 @@
       -all:
       -        @./gen.sh
       -
       -clean:
       -        rm -f coffin.key
       -        rm -f coffin.pem
       -
       -install:
       -        @./conf.sh snowman
       -
       -uninstall:
       -        @./conf.sh unsnowman
 (DIR) diff --git a/extra/apachedav b/extra/apachedav
       t@@ -1,14 +0,0 @@
       -<IfModule mod_ssl.c>
       -        <VirtualHost _default_:443>
       -                # Apache2.4 configuration file for coffin's WebDAV
       -                # Will be additionally filled up after you use it.
       -
       -                ServerAdmin dav@coffin
       -                DocumentRoot /var/www/html
       -
       -                SSLEngine on
       -                SSLCertificateFile /etc/ssl/coffin/coffin.pem
       -                SSLCertificateKeyFile /etc/ssl/coffin/coffin.key
       -
       -        </VirtualHost>
       -</IfModule>
 (DIR) diff --git a/extra/coffin-initd b/extra/coffin-initd
       t@@ -0,0 +1,36 @@
       +#!/bin/sh
       +### BEGIN INIT INFO
       +# Provides:          coffin
       +# Required-Start:    $all
       +# Short-Description: Starts the coffin daemon
       +### END INIT INFO
       +
       +DAEMON=
       +AME=coffin
       +DESC="coffin daemon"
       +
       +test -x $DAEMON || exit 0
       +
       +case "$1" in
       +        start)
       +                echo "Starting $DESC..."
       +                start-stop-daemon \
       +                        --start \
       +                        --background \
       +                        --make-pidfile \
       +                        --pidfile /var/run/coffin.pid \
       +                        --exec $DAEMON
       +                ;;
       +        stop)
       +                echo "Stopping $DESC..."
       +                start-stop-daemon \
       +                        --stop \
       +                        --pidfile /var/run/coffin.pid
       +                ;;
       +        *)
       +                echo "Usage: $0 {start|stop}" >&2
       +                exit 1
       +                ;;
       +esac
       +
       +exit 0
 (DIR) diff --git a/extra/coffin.init b/extra/coffin.init
       t@@ -1,37 +0,0 @@
       -#!/bin/sh
       -### BEGIN INIT INFO
       -# Provides:          coffin
       -# Required-Start:    $all
       -# Short-Description: Starts the coffin daemon
       -### END INIT INFO
       -
       -PATH=/usr/local/coffin/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
       -DAEMON=/usr/local/coffin/bin/coffin
       -NAME=coffin
       -DESC="coffin daemon"
       -
       -test -x $DAEMON || exit 0
       -
       -case "$1" in
       -        start)
       -                echo "Starting $DESC..."
       -                start-stop-daemon \
       -                        --start \
       -                        --background \
       -                        --make-pidfile \
       -                        --pidfile /var/run/coffin.pid \
       -                        --exec $DAEMON
       -                ;;
       -        stop)
       -                echo "Stopping $DESC..."
       -                start-stop-daemon \
       -                        --stop \
       -                        --pidfile /var/run/coffin.pid
       -                ;;
       -        *)
       -                echo "Usage: $0 {start|stop}" >&2
       -                exit 1
       -                ;;
       -esac
       -
       -exit 0
 (DIR) diff --git a/extra/coffin.key b/extra/coffin.key
       t@@ -1,52 +0,0 @@
       ------BEGIN PRIVATE KEY-----
       -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
       -/n3lc+LNbXwBbp3pK0SccBuBN5u2gw==
       ------END PRIVATE KEY-----
 (DIR) diff --git a/extra/coffin.pem b/extra/coffin.pem
       t@@ -1,31 +0,0 @@
       ------BEGIN CERTIFICATE-----
       -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
       ------END CERTIFICATE-----
 (DIR) diff --git a/extra/dav_apache b/extra/dav_apache
       t@@ -0,0 +1,14 @@
       +<IfModule mod_ssl.c>
       +        <VirtualHost _default_:443>
       +                ## Apache2.4 configuration file for coffin's WebDAV
       +                ## Will be additionally filled up after you use it.
       +
       +                ServerAdmin dav@coffin
       +                DocumentRoot /var/www/html
       +
       +                SSLEngine on
       +                SSLCertificateFile
       +                SSLCertificateKeyFile
       +
       +        </VirtualHost>
       +</IfModule>
 (DIR) diff --git a/extra/gen.sh b/extra/gen.sh
       t@@ -1,32 +0,0 @@
       -#!/bin/sh
       -#
       -# Copyright (c) 2016 Dyne.org Foundation
       -# coffin is written and maintained by parazyd <parazyd@dyne.org>
       -#
       -# This file is part of coffin
       -#
       -# This source code is free software: you can redistribute it and/or modify
       -# it under the terms of the GNU General Public License as published by
       -# the Free Software Foundation, either version 3 of the License, or
       -# (at your option) any later version.
       -#
       -# This software is distributed in the hope that it will be useful,
       -# but WITHOUT ANY WARRANTY; without even the implied warranty of
       -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       -# GNU General Public License for more details.
       -#
       -# You should have received a copy of the GNU General Public License
       -# along with this source code. If not, see <http://www.gnu.org/licenses/>.
       -
       -# generate ssl cert for webdav
       -openssl req -x509 -nodes -days 3650 -newkey rsa:4096 \
       -        -keyout coffin.key -out coffin.pem
       -
       -fprint=`openssl x509 -noout -in ./coffin.pem -fingerprint \
       -        | awk -F\= '{print $2}'`
       -
       -echo "#############################"
       -echo "Successfully generated coffin's SSL certificate!"
       -echo "The fingerprint is: \033[0;32m${fprint}"
       -echo "\033[0mCompare it and/or set it as trusted when you connect to coffin."
       -echo "#############################"
 (DIR) diff --git a/extra/genssl.sh b/extra/genssl.sh
       t@@ -0,0 +1,35 @@
       +#!/bin/sh
       +#
       +# Copyright (c) 2016 Dyne.org Foundation
       +# coffin is written and maintained by Ivan J. <parazyd@dyne.org>
       +#
       +# This file is part of coffin
       +#
       +# This source code is free software: you can redistribute it and/or modify
       +# it under the terms of the GNU General Public License as published by
       +# the Free Software Foundation, either version 3 of the License, or
       +# (at your option) any later version.
       +#
       +# This software is distributed in the hope that it will be useful,
       +# but WITHOUT ANY WARRANTY; without even the implied warranty of
       +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       +# GNU General Public License for more details.
       +#
       +# You should have received a copy of the GNU General Public License
       +# along with this source code. If not, see <http://www.gnu.org/licenses/>.
       +
       +# generate ssl cert for webdav
       +openssl req -x509 -nodes -days 3650 -newkey rsa:4096 \
       +        -keyout coffin.key -out coffin.pem
       +
       +fprint=$(openssl x509 -noout -in ./coffin.pem -fingerprint \
       +        | awk -F\= '{print $2}')
       +
       +cat <<EOM
       +
       +#############################
       +Successfully generated coffin's SSL certificate!
       +The fingerprint is: ${fprint}
       +Compare it and/or set it as trusted when you connect to coffin.
       +#############################
       +EOM
 (DIR) diff --git a/extra/setup_features.sh b/extra/setup_features.sh
       t@@ -0,0 +1,92 @@
       +#!/usr/bin/env zsh
       +#
       +# Copyright (c) 2016 Dyne.org Foundation
       +# coffin is written and maintained by Ivan J. <parazyd@dyne.org>
       +#
       +# This file is part of coffin
       +#
       +# This source code is free software: you can redistribute it and/or modify
       +# it under the terms of the GNU General Public License as published by
       +# the Free Software Foundation, either version 3 of the License, or
       +# (at your option) any later version.
       +#
       +# This software is distributed in the hope that it will be useful,
       +# but WITHOUT ANY WARRANTY; without even the implied warranty of
       +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       +# GNU General Public License for more details.
       +#
       +# You should have received a copy of the GNU General Public License
       +# along with this source code. If not, see <http://www.gnu.org/licenses/>.
       +
       +features="$@"
       +
       +[[ $UID = 0 ]] || { print "(!!) this script should be ran as root";exit 1 }
       +
       +if [[ $1 == install ]]; then
       +        $(grep '^coffin' /etc/group) || groupadd coffin
       +        [[ $features =~ webdav ]]    && setup-webdav on
       +        [[ $features =~ ssh ]]       && setup-ssh on
       +elif [[ $1 == uninstall ]]; then
       +        $(grep '^coffin' /etc/group) && groupdel coffin
       +        [[ $features =~ webdav ]]    && setup-webdav off
       +        [[ $features =~ ssh ]]       && setup-ssh off
       +fi
       +
       +
       +## {{{ webdav
       +detect-webserver() {
       +        command -v apache2  >/dev/null && webserver=apache && return 0
       +        command -v nginx    >/dev/null && webserver=nginx  && return 1
       +        command -v lighttpd >/dev/null && webserver=lighty && return 1
       +
       +        return 1
       +}
       +
       +setup-webdav() {
       +        detect-webserver || {
       +                echo "(!!) no supported webservers found, sorry"
       +                exit 1 }
       +
       +        if [[ $1 == on ]]; then
       +                ./$(dirname $0)/genssl.sh
       +                ${webserver}-enable
       +        elif [[ $1 == off ]]; then
       +                ${webserver}-disable
       +        fi
       +}
       +## {{{ apache2
       +apache-enable() {
       +        echo "(*) setting up apache2"
       +
       +        cat <<EOF >> /etc/apache2/apache2.conf
       +
       +<Directory /media/>
       +        Options Indexes
       +        AllowOverride none
       +        Require all granted
       +</Directory>
       +DAVLockDB /etc/apache2/DAV/DAVLock
       +EOF
       +
       +        for i in ssl dav dav_fs dav_lock auth_digest; do
       +                a2enmod $i
       +        done
       +}
       +apache-disable() {
       +        echo "(*) unsetting apache2"
       +        for i in auth_digest dav_lock dav_fs dav ssl; do
       +                a2dismod $i
       +        done
       +
       +        echo "(*) to remove apache leftovers, remove <Directory /media/> and
       +              DAVLockDB parts from /etc/apache2/apache2.conf (at the bottom)"
       +}
       +## }}}
       +## {{{ nginx
       +## }}}
       +## {{{ lighttpd
       +## }}}
       +## }}}
       +
       +## {{{ ssh
       +## }}}
 (DIR) diff --git a/helpers/makehook b/helpers/makehook
       t@@ -1,7 +1,7 @@
        #!/usr/bin/env bash
        #
        # Copyright (c) 2016 Dyne.org Foundation
       -# coffin is written and maintained by parazyd <parazyd@dyne.org>
       +# coffin is written and maintained by Ivan J. <parazyd@dyne.org>
        #
        # This file is part of coffin
        #
       t@@ -21,29 +21,32 @@
        hooks="hook"
        davfile="davpasswd"
        ttab="ttab"
       -system=`uname -o`
       +system=$(uname -o)
        
        gendav() {
                if [[ $system == "GNU/Linux" ]]; then
       -                daventry=`echo -n "${undertaker}:WebDAV:" \
       +                daventry=$(echo -n "${undertaker}:WebDAV:" \
                                && echo -n "${undertaker}:WebDAV:${davpass}" \
                                | md5sum \
       -                        | awk '{print $1}'`
       +                        | awk '{print $1}'
       +                )
       +
                elif [[ $system == "Darwin" ]]; then
       -                daventry=`echo -n "${undertaker}:WebDAV:" \
       +                daventry=$(echo -n "${undertaker}:WebDAV:" \
                                && echo -n "${undertaker}:WebDAV:${davpass}" \
                                | md5 \
       -                        | awk '{print $NF}'`
       +                        | awk '{print $NF}'
       +                )
                fi
        }
        
        successmsg() {
       -        cat <<EOF
       +        cat <<EOM
        
        Your hook has been created successfully. Plug your USB key into the coffin to
        execute it, or rerun this script to create another hook.
        
       -EOF
       +EOM
        }
        
        genhook() {
       t@@ -104,16 +107,12 @@ happenz() {
        
                                read -r -p "Please input the password you will use to access your tomb: " davpass
        
       -                        genhook create
       -                        [[ $? = 0 ]] && {
       -                                successmsg
       -                        }
       +                        genhook create && successmsg
                                ;;
                # }}}
                # {{{ delete
                        2)
       -                        echo -e "\n"
       -                        echo "Deleting an exising tomb..."
       +                        echo -e "\nDeleting an exising tomb...\n"
        
                                read -p "Please input the username you used to create the tomb: " undertaker
                                re='^[A-Za-z0-9]+$'
       t@@ -130,11 +129,7 @@ happenz() {
        
                                # NOTE: possibly include prompt for webdav password
        
       -                        genhook delete
       -                        [[ $? = 0 ]] && {
       -                                successmsg
       -                        }
       -
       +                        genhook delete && successmsg
                                ;;
                # }}}
                        3)
       t@@ -175,7 +170,7 @@ happenz() {
                                        exec $0
                                }
        
       -                        tombsize=20 # NOTE: could possibly be less
       +                        tombsize=20 ## NOTE: could possibly be less
        
                                read -r -p "Please input the password you will use to access your tomb: " davpass
        
       t@@ -186,12 +181,12 @@ happenz() {
                                ;;
                        0)
        
       -                        printf "Quitting...\"
       -                        exit
       +                        echo -e "Quitting...\n"
       +                        exit 0
                                ;;
                        *)
       -                        printf "\nNo valid option. Exiting...\n"
       -                        exit
       +                        echo -e "\nNo valid option. Exiting...\n"
       +                        exit 1
                                ;;
                esac
        }
 (DIR) diff --git a/sacrist b/sacrist
       t@@ -37,6 +37,9 @@ vars+=(KEYMOUNT COFFINDOT TTAB HOOKS)
        vars+=(keypass undertaker tombid)
        vars+=(happenz device keyuuid)
        
       +## zsh magic
       +path+=()
       +
        source $R/../share/zlibs/features
        source $R/../share/zlibs/hooks
        source $R/../share/zlibs/keyfiles
 (DIR) diff --git a/wallet/bindhook b/wallet/bindhook
       t@@ -1 +0,0 @@
       -wallets        .bitcoin/wallets