]> gitweb.fluxo.info Git - firma.git/commitdiff
complementacao da funcao newlist, nova funcao gpg_args
authorrhatto <rhatto>
Tue, 2 Aug 2005 20:02:40 +0000 (20:02 +0000)
committerrhatto <rhatto>
Tue, 2 Aug 2005 20:02:40 +0000 (20:02 +0000)
firma

diff --git a/firma b/firma
index 411a3127973c6eda728713da6756dda223c24916..433d6c126a5d1f08fca1277d01ad6675a522578a 100755 (executable)
--- 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