commit 9b059e9c831a05a416e9eb724e36f307c629d6db
parent fc8af9c29e62100f30d25f3c19e6b38554fc542b
Author: parazyd <parazyd@dyne.org>
Date: Mon, 16 May 2016 17:15:48 +0200
change structure of makefiles and coffin config
Diffstat:
13 files changed, 117 insertions(+), 312 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,18 +1,11 @@
all:
- @./conf/config.sh checkdep
make -C src
- @./conf/config.sh gen-ssl
- @./conf/config.sh gen-init
install:
make -C src install
- @./conf/config.sh snowman
clean:
make -C src clean
- rm -f conf/initscript-*.init
- rm -f conf/coffin.pem
- rm -f conf/coffin.key
uninstall:
- @./conf/config.sh unsnowman
+ make -C src uninstall
diff --git a/conf/config.sh b/conf/config.sh
@@ -1,197 +0,0 @@
-#!/usr/bin/env zsh
-#
-# configuration script for coffin. run only through Makefile
-#
-# ~ parazyd
-
-# `make`
-[[ $1 == "checkdep" ]] && {
- missing=()
- which apache2 >/dev/null || missing+=(apache)
- which cryptsetup >/dev/null || missing+=(cryptsetup)
- which inotifywatch >/dev/null || missing+=(inotify-tools)
- which wipe >/dev/null || missing+=(wipe)
- which pinentry >/dev/null || missing+=(pinentry)
- which pwgen >/dev/null || missing+=(pwgen)
- which gettext >/dev/null || missing+=(gettext)
- which openssl >/dev/null || missing+=(openssl)
-# Optional:
-# which haveged || missing+=(haveged)
-# which sshfs || missing+=(sshfs)
-# which dcfldd || missing+=(dcfldd)
- (( $#missing == 0 )) || {
- for i in $missing; do
- print "$i is missing."
- done
- print "Please install and retry."
- return 1
- }
- print "All dependencies solved, run 'make install' as root"
- print "to install and configure coffin on this device."
- return 0
-}
-
-# `make install`
-[[ $1 == "snowman" || $1 == "unsnowman" ]] && {
- [[ $UID = 0 ]] || {
- print "You must run this as root!"
- return 1
- }
-}
-
-edit-sudo() {
- if [[ $1 == "add" ]]; then
- print "%coffin `hostname`=(ALL) NOPASSWD: ALL" | (EDITOR="tee -a" visudo)
- [[ $? = 0 ]] && print "Added coffin group to sudoers"
- elif [[ $1 == "remove" ]]; then
- tmp=`sed '/^%coffin / d' /etc/sudoers`
- print $tmp | (EDITOR="tee" visudo)
- [[ $? = 0 ]] && print "####################\nRemoved coffin group from sudoers"
- fi
-}
-
-[[ $1 == "gen-init" ]] && {
- # TODO: ckdistro; different ones
- distro=deb
- pushd `pwd`/conf
- cat <<EOF | tee tempinit
-#!/bin/bash
-
-### BEGIN INIT INFO
-# Provides: coffin
-# Required-Start: \$all
-### END INIT INFO
-
-# Author: parazyd <parazyd@dyne.org>
-
-NAME=coffin
-DESC="coffin daemon"
-COFFINDIR=/usr/local/share/coffin
-DAEMON=\$COFFINDIR/bin/\$NAME
-EOF
- cat tempinit init.skel > initscript-$distro.init
- rm tempinit
-}
-
-apachemods() {
- if [[ $1 == "on" ]]; then
- mods=(ssl dav dav_fs dav_lock auth_digest)
- for i in $mods; do
- a2enmod $i # NOTE: a2en* is only on debian
- done
- elif [[ $1 == "off" ]]; then
- mods=(auth_digest dav_lock dav_fs dav ssl)
- for i in $mods; do
- a2dismod $i
- done
- fi
- return 0
-}
-
-[[ $1 == "gen-ssl" ]] && {
- pushd `pwd`/conf
- openssl req -x509 -nodes -days 3650 -newkey rsa:4096 \
- -keyout coffin.key -out coffin.pem
- return 0
-}
-
-update-init() {
- # TODO: rearrange this into another function and add other distros
- # update-rc.d
- #
-}
-
-ckdistro() {
- which apt-get >/dev/null && distro=deb
- which emerge >/dev/null && distro=gentoo
-}
-
-# because all cool software has snowmen in them
-[[ $1 == "snowman" ]] && {
- pushd `pwd`/conf
-
- ckdistro
-
- [[ `grep 'coffin' /etc/group` ]] || groupadd coffin
- gpasswd -a www-data coffin
-
- install -Dm440 coffin.pem /etc/ssl/coffin/coffin.pem
- install -Dm400 coffin.key /etc/ssl/coffin/coffin.key
- print "Done!"
-
- # apache
- install -Dm775 -g www-data -d /etc/apache2/DAV
- [[ `grep '^DAVLockDB ' /etc/apache2/apache2.conf` ]] || {
- cat << EOF >> /etc/apache2/apache2.conf
-<Directory /media/>
- Options Indexes
- AllowOverride None
- Require all granted
-</Directory>
-DAVLockDB /etc/apache2/DAV/DAVLock
-EOF
- }
- install -Dm600 davpasswd /etc/apache2/DAV/davpasswd
- install -Dm640 apachedav /etc/apache2/sites-available/coffindav.conf
-
- apachemods on
-
- # [[ -f /etc/apache2/sites-enabled/000-default.conf ]] && a2dissite 000-default.conf
- [[ -f /etc/apache2/sites-enabled/coffindav.conf ]] || a2ensite coffindav.conf
-
- /etc/init.d/apache2 restart
- [[ -f /etc/init.d/ssh ]] && { /etc/init.d/ssh start }
-
- edit-sudo add
-
- install -Dm770 -g coffin -d /home/graveyard
-
- install -Dm755 initscript-$distro.init /etc/init.d/coffin
-
- print "######################################"
- print "Successfully installed and configured coffin!"
- print "You can start it with '/etc/init.d/coffin start'"
-
- print "######################################"
- fprint=`openssl x509 -noout -in /etc/ssl/coffin/coffin.pem -fingerprint \
- | awk -F\= '{print $2}'`
- print "The fingerptint of your SSL certificate is: $fprint"
- print "Compare it and/or set is as trusted when you connect to coffin."
- print "######################################"
-
- popd
- return 0
-}
-
-# `make uninstall`
-[[ $1 == "unsnowman" ]] && {
- print "Uninstalling coffin. Why? Why? Why?"
- print "*cries*\n"
-
- /etc/init.d/coffin stop
-
- # comment if you wish to keep apache
- revert=true
- [[ $revert == "true" ]] && {
- a2dissite coffindav.conf
- #a2ensite 000-default.conf
- rm -rv /etc/apache2/DAV
- rm -v /etc/apache2/sites-available/coffindav.conf
- rm -rv /etc/ssl/coffin
-
- apachemods off
-
- sed -i '/^DAVLockDB / d' /etc/apache2/apache2.conf
- [[ $? = 0 ]] && print "removed entry from apache2.conf"
- /etc/init.d/apache2 restart
- }
-
- # groupdel coffin
- gpasswd -d www-data coffin
- edit-sudo remove
-
- rm -rv /usr/local/share/coffin
- rm -v /etc/init.d/coffin
-
- update-init
-}
diff --git a/conf/init.skel b/conf/init.skel
@@ -1,21 +0,0 @@
-test -x $DAEMON || exit 0
-
-case "$1" in
- start)
- echo "Starting $DESC..."
- nohup $DAEMON > /var/run/coffin.out &
- ;;
- stop)
- echo "Stopping $DESC..."
- pid=`cat /var/run/coffin.pid 2>/dev/null`
- kill $pid && rm /var/run/coffin.pid && rm /var/run/coffin.out
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
-esac
-exit 0
-
-# vim: syntax=sh ts=4 sw=4 sts=4 sr noet
diff --git a/src/Makefile b/src/Makefile
@@ -1,15 +1,21 @@
-PREFIX = /usr/local/share/coffin/bin
+PREFIX = /usr/local/coffin/bin
all:
$(CC) -O2 -o tomb-kdb-pbkdf2 pbkdf2.c -lgcrypt
$(CC) -O2 -o tomb-kdb-pbkdf2-getiter benchmark.c -lgcrypt
$(CC) -O2 -o tomb-kdb-pbkdf2-gensalt gen_salt.c -lgcrypt
$(CC) -O2 -o tomb-kdb-hexencode hexencode.c
+ make -C extra
clean:
- rm -f tomb-kdb-pbkdf2 tomb-kdb-pbkdf2-getiter tomb-kdb-pbkdf2-gensalt tomb-kdb-hexencode
+ rm -f tomb-kdb-pbkdf2
+ rm -f tomb-kdb-pbkdf2-getiter
+ rm -f tomb-kdb-pbkdf2-gensalt
+ rm -f tomb-kdb-hexencode
+ make -C extra clean
install:
+ make -C extra install
install -Dm755 coffin ${PREFIX}/coffin
install -Dm755 sacrist ${PREFIX}/sacrist
install -Dm755 zlibs/features ${PREFIX}/zlibs/features
@@ -24,3 +30,41 @@ install:
install -Dm755 tomb-kdb-pbkdf2-getiter ${PREFIX}/tomb-kdb-pbkdf2-getiter
install -Dm755 tomb-kdb-pbkdf2-gensalt ${PREFIX}/tomb-kdb-pbkdf2-gensalt
install -Dm755 tomb-kdb-hexencode ${PREFIX}/tomb-kdb-hexencode
+ install -Dm770 -g coffin -d /home/graveyard
+ # init
+ install -Dm755 extra/coffin.init /etc/init.d/coffin
+ # apache
+ install -Dm775 -g www-data -d /etc/apache2/DAV
+ install -Dm600 extra/davpasswd /etc/apache2/DAV/davpasswd
+ install -Dm640 extra/apachedav /etc/apache2/sites-available/coffindav.conf
+ # ssl
+ install -Dm700 -d /etc/ssl/coffin
+ install -Dm440 extra/coffin.pem /etc/ssl/coffin/coffin.pem
+ install -Dm400 extra/coffin.key /etc/ssl/coffin/coffin.key
+ @echo "To enable WebDAV, run: 'a2ensite coffindav.conf' as root."
+
+uninstall:
+ make -C extra uninstall
+ rm -f ${PREFIX}/coffin
+ rm -f ${PREFIX}/sacrist
+ rm -f ${PREFIX}/zlibs/features
+ rm -f ${PREFIX}/zlibs/hooks
+ rm -f ${PREFIX}/zlibs/keyfiles
+ rm -f ${PREFIX}/zlibs/mounts
+ rm -f ${PREFIX}/zlibs/ttab
+ rm -f ${PREFIX}/zlibs/zuper
+ rm -f ${PREFIX}/zlibs/zuper.init
+ rm -f ${PREFIX}/tomb
+ rm -f ${PREFIX}/tomb-kdb-pbkdf2
+ rm -f ${PREFIX}/tomb-kdb-pbkdf2-getiter
+ rm -f ${PREFIX}/tomb-kdb-pbkdf2-gensalt
+ rm -f ${PREFIX}/tomb-kdb-hexencode
+ # init
+ rm -f /etc/init.d/coffin
+ # apache
+ rm -rf /etc/apache2/DAV
+ rm -f /etc/apache2/sites-available/coffindav.conf
+ rm -f /etc/apache2/sites-enabled/coffindav.conf
+ # ssl
+ rm -rf /etc/ssl/coffin
+ @echo "To disable WebDAV, run: 'a2dissite coffindav.conf' as root."
diff --git a/src/coffin b/src/coffin
@@ -1,24 +1,22 @@
#!/usr/bin/env bash
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
pattern='sd[a-z][1-9]$'
coproc inotifywait --monitor --event create,delete --format '%e %w%f' /dev
diff --git a/conf/apachedav b/src/extra/apachedav
diff --git a/conf/davpasswd b/src/extra/davpasswd
diff --git a/src/sacrist b/src/sacrist
@@ -1,24 +1,22 @@
#!/usr/bin/env zsh
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
coffin_version=0.4
coffin_release_date="May/2016"
diff --git a/src/zlibs/features b/src/zlibs/features
@@ -1,24 +1,22 @@
#!/usr/bin/env zsh
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
create-webdav-hook() {
fn create-webdav-hook
diff --git a/src/zlibs/hooks b/src/zlibs/hooks
@@ -1,24 +1,22 @@
#!/usr/bin/env zsh
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
check-hooks() {
# TODO: fragmented keys, delete, backup, moar
diff --git a/src/zlibs/keyfiles b/src/zlibs/keyfiles
@@ -1,24 +1,22 @@
#!/usr/bin/env zsh
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
hash-key() {
fn hash-key
diff --git a/src/zlibs/mounts b/src/zlibs/mounts
@@ -1,24 +1,22 @@
#!/usr/bin/env zsh
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
mount-key() {
fn mount-key $*
diff --git a/src/zlibs/ttab b/src/zlibs/ttab
@@ -1,24 +1,22 @@
#!/usr/bin/env zsh
#
-# Coffin - Cryptographic office filer for important nuggets
-#
# Copyright (c) 2016 Dyne.org Foundation
+# coffin is written and maintained by parazyd <parazyd@dyne.org>
#
-# 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 Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# 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 source code is distributed in the hope that it will be useful,
+# 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. Please refer
-# to the GNU Public License for more details.
+# 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 Public License along with
-# this source code; if not, write to: Free Software Foundation, Inc.,
-# 675 Mass Ave, Cambridge, MA 02139, USA.
+# 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/>.
update-tombs() {
fn update-tombs $*