aboutsummaryrefslogtreecommitdiff
path: root/firma
diff options
context:
space:
mode:
authorrhatto <rhatto>2005-08-02 20:02:40 +0000
committerrhatto <rhatto>2005-08-02 20:02:40 +0000
commit6ba8b0298767b54fe144b78adfc2e4f43cbff580 (patch)
tree3fb382278da8e030291678135fcd7b7bd909084e /firma
parent5b015a32499a5e4663dcbd0dffd3f23f2aafe9c1 (diff)
downloadfirma-6ba8b0298767b54fe144b78adfc2e4f43cbff580.tar.gz
firma-6ba8b0298767b54fe144b78adfc2e4f43cbff580.tar.bz2
complementacao da funcao newlist, nova funcao gpg_args
Diffstat (limited to 'firma')
-rwxr-xr-xfirma50
1 files changed, 32 insertions, 18 deletions
diff --git a/firma b/firma
index 411a312..433d6c1 100755
--- a/firma
+++ b/firma
@@ -141,7 +141,7 @@ $(echo -e "$PASSWD\n${GPG_MESSAGE[@]}" | $GPGDECRYPT 2> /dev/null)" | sed -e 's/
}
function message_list_return {
-# send a bouce message
+# send a bounce message
# $1: sender email (usually $FROMADD)
# sorry no identation :P
echo "
@@ -196,8 +196,6 @@ function newlist {
mkdir "$CONFIG_PATH" # || (echo "error creating $CONFIG_PATH: installation aborted"; exit 1)
echo "creating list config file and will ask some questions."
- GPGDIR="$CONFIG_PATH"
-
read -p "path to nail command (eg, /usr/bin/nail): " MAIL
read -p "path to gpg binary (eg, /usr/bin/gpg): " GPG
@@ -207,7 +205,8 @@ function newlist {
# todo: please no utf-8 (see DETAILS)
read -p "list email (eg, firma@domain.tld): " LISTNAME
- read -p "list admins emails (space delimited)" LISTADMIN
+ read -p "list admins emails (space delimited): " LISTADMIN
+ read -p "list description (fake?): " DESCRIPTION
read -p "password for list keyring (use a huge one): " PASSWD
# todo: key specs (size, expiry date...)
@@ -217,13 +216,26 @@ function newlist {
chown root.root $CONFIG
chmod 600 $CONFIG
if [ -f $CONFIG ]; then
+ gpg_args
echo -e "MAIL=$MAIL\nGPG=$GPG\nGPGDIR=$GPGDIR\nLISTNAME=$LISTNAME\nLISTADMIN=$LISTADMIN\nPASSWD=$PASSWD" > $CONFIG
echo "now generating your keyring..."
- # re-eval GPGCOMMAND
- # todo: GPGFLAGS depende de GPGDIR
- GPGCOMMAND="$GPG $GPGFLAGS"
- $GPGCOMMAND --gen-key
- # ...
+
+ $GPGCOMMAND --gen-key <<EOF
+
+ Key-Type: DSA
+ Key-Length: 1024
+ Subkey-Type: ELG-E
+ Subkey-Length: 1024
+
+ Name-Real: $DESCRIPTION
+ Name-Email: $LISTNAME
+
+ Expire-Date: 0
+ Passphrase: $PASSWD
+ %commit
+
+EOF
+
fi
else
echo error creating $CONFIG_FILE: list already exists
@@ -231,6 +243,15 @@ function newlist {
fi
}
+function gpg_args {
+ # declare GPG variables
+ GPGFLAGS="--quiet --homedir $GPGDIR --batch --no-tty --no-use-agent --no-permission-warning"
+ GPGCOMMAND="$GPG $GPGFLAGS"
+ GPGLIST="$GPGCOMMAND --list-keys --with-colons"
+ GPGDECRYPT="$GPGCOMMAND --passphrase-fd 0 --decrypt"
+ GPGENCRYPT="$GPGCOMMAND --passphrase-fd 0 --always-trust --encrypt --sign --armor --recipient"
+}
+
# main -
# command line checking
if [ -z $2 ]; then
@@ -254,15 +275,8 @@ declare -a GPG_MESSAGE
declare n
export LANG=en_US
-# declare GPG variables
-GPGFLAGS="--quiet --homedir $GPGDIR --batch --no-tty --no-use-agent --no-permission-warning"
-GPGCOMMAND="$GPG $GPGFLAGS"
-GPGLIST="$GPGCOMMAND --list-keys --with-colons"
-GPGDECRYPT="$GPGCOMMAND --passphrase-fd 0 --decrypt"
-GPGENCRYPT="$GPGCOMMAND --passphrase-fd 0 --always-trust --encrypt --sign --armor --recipient"
-
-# then check the config
-check_config
+# get gpg parameters and check the config
+gpg_args ; check_config
# command line parsing
if [[ $1 == "-c" ]]; then