From eeb39874db4d83249aa3a6be7ef7e02c3bc63a81 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 19 Aug 2016 11:18:33 +0200 Subject: aufraeumen --- .gitignore | 6 ++---- Makefile | 10 ++++------ encedit.1.in | 53 ---------------------------------------------------- encedit.in | 52 --------------------------------------------------- greppw.1.in | 53 ---------------------------------------------------- greppw.in | 29 ---------------------------- passwort-tresor.1.in | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ passwort-tresor.in | 29 ++++++++++++++++++++++++++++ passwort-tresor.konf | 4 ++++ 9 files changed, 92 insertions(+), 197 deletions(-) delete mode 100644 encedit.1.in delete mode 100755 encedit.in delete mode 100644 greppw.1.in delete mode 100755 greppw.in create mode 100644 passwort-tresor.1.in create mode 100755 passwort-tresor.in create mode 100644 passwort-tresor.konf diff --git a/.gitignore b/.gitignore index 588bed4..3a8cb47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -encedit -encedit.1 -greppw -greppw.1 +passwort-tresor +passwort-tresor.1 diff --git a/Makefile b/Makefile index 004ce0c..7bddca0 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ MANDIR = /usr/share/man VERSION = 0.0 -all: encedit encedit.1 greppw greppw.1 +all: passwort-tresor passwort-tresor.1 %: %.in sed "s/#VERSION#/$(VERSION)/; s@#BINDIR#@$(BINDIR)@; s@#ETCDIR#@$(ETCDIR)@" $< > $@ @@ -34,14 +34,12 @@ all: encedit encedit.1 greppw greppw.1 .PHONY: install dist clean install: all - install -D -m0755 encedit $(DESTDIR)$(BINDIR)/encedit - install -D -m0644 encedit.1 $(DESTDIR)$(MANDIR)/man1/encedit.1 - install -D -m0755 greppw $(DESTDIR)$(BINDIR)/greppw - install -D -m0644 greppw.1 $(DESTDIR)$(MANDIR)/man1/greppw.1 + install -D -m0755 passwort-tresor $(DESTDIR)$(BINDIR)/passwort-tresor + install -D -m0644 passwort-tresor.1 $(DESTDIR)$(MANDIR)/man1/passwort-tresor.1 install -D -m0644 passwort-tresor.konf $(DESTDIR)$(ETCDIR)/passwort-tresor.konf clean: - rm -f encedit encedit.1 greppw greppw.1 + rm -f passwort-tresor passwort-tresor.1 dist: clean git status --porcelain 2> /dev/null | grep -q "\S" && (git add .; git commit -m"neue Version: $(VERSION)") || true diff --git a/encedit.1.in b/encedit.1.in deleted file mode 100644 index bdfb929..0000000 --- a/encedit.1.in +++ /dev/null @@ -1,53 +0,0 @@ -.TH sendmailadvanced 1 "" "sendmailadvanced #VERSION#" "" -.SH NAME -sendmailadvanced \- wrapper for sendmail which encrypts and generates stamps -.SH SYNOPSIS -\fBsendmailadvanced [options]\fP -.SH DESCRIPTION -\fBsendmailadvanced\fP encrypts emails and generates stamps either in situ or in a pipe. For that it uses \fBhashcash\fP and \fBgnupg\fP. -.SH OPTIONS -.TP -.B "\-h, \-\-hook" -Activate specified hook. -.TP -.B "\-i, \-\-inline" -Enhance email file in situ. -\fB\-\-inline \-\fP has the same effect as option \fB\-t\fP. -Conflicts with \fB\-t, \-\-no\-inline\fP. -.TP -.B "\-t, \-\-no\-inline" -Enhance email from stdin to stdout. -Conflicts with \fB\-i, \-\-inline\fP. -.TP -.B "\-e, \-\-[no\-]encrypt" -Do (not) encrypt. -.TP -.B "\-s, \-\-[no\-]stamp" -Do (not) stamp. -.SH CONFIGURATION -The configfile \fB#ETCDIR#/sendmailadvanced.conf\fP is a bash script, which defines the following variables and routines: -.TP -.B "gpg_recipient" -default recipient to encrypt to -.TP -.B "hashcash_bits" -stamp value -.TP -.B "body_header_hook" -routine printing things to put into head of (body of) email. -Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. -.TP -.B "body_footer_hook" -routine printing things to put into foot of email. -Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. -.SH FILES -.TP -.B "#BINDIR#/sendmailadvanced" -program file -.TP -.B "#ETCDIR#/sendmailadvanced.conf" -contains configuration -.SH AUTHOR -.nf -Erich Eckner -.fi diff --git a/encedit.in b/encedit.in deleted file mode 100755 index a295add..0000000 --- a/encedit.in +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -. #ETCDIR#/passwort-tresor.konf - -if [ "$1" == "" ] -then - s=$(dialog --stdout --fselect /mnt/141.35.50.159_home/Dokumente/todolist.gpg 14 70) - [ "$s" == "" ] && exit 1 - if [ "$(basename $s)" != "$(basename $s .gpg).gpg" ] - then - echo "File must end on \".gpg\", \"$s\" does not!" - exit 1 - fi -else - s="$1" - if [ $(basename $s) != $(basename $s .gpg).gpg ] - then - echo "Usage: etea encrypted.gpg" - echo " or: etea" - exit 1 - fi -fi - -if [ "$(dirname $s)" == "/mnt/141.35.50.159_home/Dokumente" ] -then - sha512sum -c ~/.sums/$(basename $s .gpg).512 || dialog --msgbox "Die Prüfsumme stimmt nicht!" 14 70 -fi - -i=0 -while [ -e /tmp/efile.$i ] || [ -e /tmp/emsg.$i ] || [ -e /tmp/ecrpt.$i ] -do - i=$[$i+1] -done - -gpg -o /tmp/efile.$i -d $s 2> /tmp/emsg.$i || exit 1 -if [ ! $(grep -c "Good signature from \"Erich Eckner \([^\"]*\)\?\"" /tmp/emsg.$i) -eq 1 ] || [ ! $(grep -c "Signature made .* using RSA key ID 0AEEC90755DA7B5A" /tmp/emsg.$i) -eq 1 ] -then - dialog --textbox /tmp/emsg.$i 14 70 -fi -touch /tmp/emsg.$i -tea /tmp/efile.$i || exit 1 -if [ ! $(ls -1t /tmp/efile.$i /tmp/emsg.$i | wc -l) -eq 2 ] || [ ! $(ls -1t /tmp/efile.$i /tmp/emsg.$i | head -n1) == "/tmp/emsg.$i" ] -then - gpg -o /tmp/ecrpt.$i -r erich@eckner.net -e -s /tmp/efile.$i || exit 1 - mv /tmp/ecrpt.$i $s 2> /dev/null || exit 1 - if [ "$(dirname $s)" == "/mnt/141.35.50.159_home/Dokumente" ] - then - sha512sum $s > ~/.sums/$(basename $s .gpg).512 - fi -fi -rm /tmp/efile.$i -rm /tmp/emsg.$i diff --git a/greppw.1.in b/greppw.1.in deleted file mode 100644 index bdfb929..0000000 --- a/greppw.1.in +++ /dev/null @@ -1,53 +0,0 @@ -.TH sendmailadvanced 1 "" "sendmailadvanced #VERSION#" "" -.SH NAME -sendmailadvanced \- wrapper for sendmail which encrypts and generates stamps -.SH SYNOPSIS -\fBsendmailadvanced [options]\fP -.SH DESCRIPTION -\fBsendmailadvanced\fP encrypts emails and generates stamps either in situ or in a pipe. For that it uses \fBhashcash\fP and \fBgnupg\fP. -.SH OPTIONS -.TP -.B "\-h, \-\-hook" -Activate specified hook. -.TP -.B "\-i, \-\-inline" -Enhance email file in situ. -\fB\-\-inline \-\fP has the same effect as option \fB\-t\fP. -Conflicts with \fB\-t, \-\-no\-inline\fP. -.TP -.B "\-t, \-\-no\-inline" -Enhance email from stdin to stdout. -Conflicts with \fB\-i, \-\-inline\fP. -.TP -.B "\-e, \-\-[no\-]encrypt" -Do (not) encrypt. -.TP -.B "\-s, \-\-[no\-]stamp" -Do (not) stamp. -.SH CONFIGURATION -The configfile \fB#ETCDIR#/sendmailadvanced.conf\fP is a bash script, which defines the following variables and routines: -.TP -.B "gpg_recipient" -default recipient to encrypt to -.TP -.B "hashcash_bits" -stamp value -.TP -.B "body_header_hook" -routine printing things to put into head of (body of) email. -Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. -.TP -.B "body_footer_hook" -routine printing things to put into foot of email. -Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. -.SH FILES -.TP -.B "#BINDIR#/sendmailadvanced" -program file -.TP -.B "#ETCDIR#/sendmailadvanced.conf" -contains configuration -.SH AUTHOR -.nf -Erich Eckner -.fi diff --git a/greppw.in b/greppw.in deleted file mode 100755 index e0b3b03..0000000 --- a/greppw.in +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -. #ETCDIR#/passwort-tresor.konf - -echo "Dienst: " -read dienst - -tmpMsg=$(mktemp /tmp/emsg.XXXXXX) - -text="$(ssh 141.35.50.159 "cat ~/Dokumente/pws.gpg" | gpg -o - -d - 2> ${tmpMsg})" - -if [ ! $(grep -c "Good signature from \"Erich Eckner \([^\"]*\)\?\"" ${tmpMsg}) -eq 1 ] || [ ! $(grep -c "Signature made .* using RSA key ID 0AEEC90755DA7B5A" ${tmpMsg}) -eq 1 ] -then - dialog --textbox ${tmpMsg} 14 70 -fi - -rm -f ${tmpMsg} - -[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="^${dienst}" -[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="${dienst}:\$" -[ $(echo -e "${text}" | grep -c "${dienst}") -eq 1 ] || exit 1 - -text="$(echo "${text}" | grep -2 "${dienst}" | tail -n2)" -echo "${text}" | head -n1 | xclip -i -echo -n "." -read dienst -echo "${text}" | tail -n1 | xclip -i -echo -n "." -read dienst diff --git a/passwort-tresor.1.in b/passwort-tresor.1.in new file mode 100644 index 0000000..bdfb929 --- /dev/null +++ b/passwort-tresor.1.in @@ -0,0 +1,53 @@ +.TH sendmailadvanced 1 "" "sendmailadvanced #VERSION#" "" +.SH NAME +sendmailadvanced \- wrapper for sendmail which encrypts and generates stamps +.SH SYNOPSIS +\fBsendmailadvanced [options]\fP +.SH DESCRIPTION +\fBsendmailadvanced\fP encrypts emails and generates stamps either in situ or in a pipe. For that it uses \fBhashcash\fP and \fBgnupg\fP. +.SH OPTIONS +.TP +.B "\-h, \-\-hook" +Activate specified hook. +.TP +.B "\-i, \-\-inline" +Enhance email file in situ. +\fB\-\-inline \-\fP has the same effect as option \fB\-t\fP. +Conflicts with \fB\-t, \-\-no\-inline\fP. +.TP +.B "\-t, \-\-no\-inline" +Enhance email from stdin to stdout. +Conflicts with \fB\-i, \-\-inline\fP. +.TP +.B "\-e, \-\-[no\-]encrypt" +Do (not) encrypt. +.TP +.B "\-s, \-\-[no\-]stamp" +Do (not) stamp. +.SH CONFIGURATION +The configfile \fB#ETCDIR#/sendmailadvanced.conf\fP is a bash script, which defines the following variables and routines: +.TP +.B "gpg_recipient" +default recipient to encrypt to +.TP +.B "hashcash_bits" +stamp value +.TP +.B "body_header_hook" +routine printing things to put into head of (body of) email. +Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. +.TP +.B "body_footer_hook" +routine printing things to put into foot of email. +Parameter \fB$1\fP was given on the console via \fB--hook $1\fP. +.SH FILES +.TP +.B "#BINDIR#/sendmailadvanced" +program file +.TP +.B "#ETCDIR#/sendmailadvanced.conf" +contains configuration +.SH AUTHOR +.nf +Erich Eckner +.fi diff --git a/passwort-tresor.in b/passwort-tresor.in new file mode 100755 index 0000000..9d6d3c6 --- /dev/null +++ b/passwort-tresor.in @@ -0,0 +1,29 @@ +#!/bin/bash + +. #ETCDIR#/passwort-tresor.konf + +echo "Dienst: " +read dienst + +tmpDir="$(mktemp -d)" + +text="$(${passwortDateiBefehl} | gpg -o - -d - 2> "${tmpDir}/")" + +if [ ! $(grep -c "Good signature from \"Erich Eckner \([^\"]*\)\?\"" ${tmpMsg}) -eq 1 ] || [ ! $(grep -c "Signature made .* using RSA key ID 0AEEC90755DA7B5A" ${tmpMsg}) -eq 1 ] +then + dialog --textbox ${tmpMsg} 14 70 +fi + +rm -f ${tmpMsg} + +[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="^${dienst}" +[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="${dienst}:\$" +[ $(echo -e "${text}" | grep -c "${dienst}") -eq 1 ] || exit 1 + +text="$(echo "${text}" | grep -2 "${dienst}" | tail -n2)" +echo "${text}" | head -n1 | xclip -i +echo -n "." +read dienst +echo "${text}" | tail -n1 | xclip -i +echo -n "." +read dienst diff --git a/passwort-tresor.konf b/passwort-tresor.konf new file mode 100644 index 0000000..168e2e0 --- /dev/null +++ b/passwort-tresor.konf @@ -0,0 +1,4 @@ +#!/bin/bash + +passwortDateiBefehl='ssh nlopc46 "cat ~/Dokumente/pws.gpg"' +passwortSummenBefehl='ssh nlopc43 "cat .sums/pws.512"' -- cgit v1.2.3