diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-22 12:11:54 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-22 12:11:54 -0200 |
commit | e8c773aa03892bc905eefe8831c04b67c7978f6a (patch) | |
tree | 1807a63ea0213e1bfc92573e3d1cd5e1ed9f6062 /misc/poc/firma-0.1.6 | |
parent | 94e278671116bf229dca6932e0d6d1d7fc4edefc (diff) | |
download | firma-e8c773aa03892bc905eefe8831c04b67c7978f6a.tar.gz firma-e8c773aa03892bc905eefe8831c04b67c7978f6a.tar.bz2 |
Misc cleanup
Diffstat (limited to 'misc/poc/firma-0.1.6')
-rwxr-xr-x | misc/poc/firma-0.1.6 | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/misc/poc/firma-0.1.6 b/misc/poc/firma-0.1.6 deleted file mode 100755 index 239c9a5..0000000 --- a/misc/poc/firma-0.1.6 +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash -# -# firma v0.2: simple encrypted mailing list aliases -# feedback: rhatto@riseup.net | GPL -# -# list configuration is passed through a config file, -# where you put PARAMETER=value (whithout spaces) -# -# MAIL= path for mail program -# GPG= path for gnupg binary -# TMP= where you want the temp files -# LISTNAME= list email -# GPGDIR= gpg dir for the lists' keyring -# PASSWD= passwd for the lists' keyring -# FOOTER= message footer -# ALLOWSENDKEY = set to 1 if you want people automatically receive the list -# key requesting through listname-request@example.tld -# with subject: key -# -# design / todo: -# -# - list-request: -# - key (allow send key) -# - help -# - subscribe: exchange pubkey -# - unsubscribe -# - strings -# - check signatures -# - create list -# - archive (optional) -# - logfile (optional) -# - gpg --no-tty --display-charset --utf8-strings ? -# -# sintax: firma -c || firma config-file -# -c: create a new list -# config-file: parse the email from stdin -# with the parameters specified in the -# config-file -# -# fix: -# -# - special chars -# - id's recipient selection -# - -fuction _refresh_cache { - rm $1 $1.gpg - touch $1; chmod 600 $1; - touch $1.gpg; chmod 600 $TMP.gpg; -} - -function _process_message { - # get the headers - FROM=$(grep -m 1 ^From: $1 | cut -f 2 -d :) - DATE=$(grep -m 1 ^Date: $1) - SUBJECT=$(grep -m 1 ^Subject: $1) - - # detect the encrypted message - sed -n '/-----BEGIN PGP MESSAGE-----/,/-----END PGP MESSAGE-----/p' $1 >> $1.gpg - - # encrypting and sending for each recipient on the list - for EMAIL in $($GPGLIST | grep pub | cut -d "<" -f 2 | sed -e 's/>//' | grep @ | grep -v $LISTNAME); do - - echo "$PASSWD - Message from: $FROM - $SUBJECT - $DATE - - $(echo "$PASSWD" | $GPGDECRYPT $1.gpg) - - --- - $FOOTER - " | sed -e 's/=20$//' | $GPGENCRYPT $EMAIL | $MAIL -r $LISTNAME $EMAIL - done -} - -function _process_request { - - # todo: support subjects like "key ", etc - FROM=$(grep -m 1 ^From: $1 | cut -f 2 -d :) - REQUEST=$(grep -m 1 ^Subject: $1) - if [[ $REQUEST == "key" ]]; then - if [[ $ALLOWSENDKEY == 1 ]]; then - # send key to From: recipient - else - # dont send the key; return error message - fi - else if [[ $REQUEST == "subscribe" ]]; then - # check if user put its pubkey and - # ask the list for subscribe From: recipient - else if [[ $REQUEST == "unsubscribe" ]]; then - # unsubscribe and advise the list - else - # error message - fi - -} - -function _process { - - # eval the config file - source $1 - - GPGCOMMAND="$GPG -q --homedir $GPGDIR" - GPGLIST="$GPGCOMMAND --list-keys" - GPGDECRYPT="$GPGCOMMAND --decrypt" - GPGENCRYPT="$GPGCOMMAND --always-trust --hidden-recipient --textmode -e -s -a -r" - - # clear the cache before read the message - _refresh_cache $TMP - - # todo: use an array - while read STDIN; do - echo $STDIN >> $TMP - done - - # check with action is requested depending on the To: field - TO=$(grep -m 1 ^To: $) - if [[ $TO == $LISTNAME ]]; then _process_message $TMP; - else _process_request $TMP; - fi - - # clear after process - _refresh_cache $TMP - -} - -function newlist { - - LISTHOME = - LISTNANE = - ... - - $GPGCOMMAND --gen-key - -} - -# check sintax -if [[ $1 = "-c" ]]; then - _newlist; -else if [ -f $1 ]; - then _process $1; -else - echo sintax: $0 [-c] [config-file]; -fi - -rm $TMP $TMP.gpg |