=== modified file 'Makefile' --- Makefile 2008-08-12 21:28:42 +0000 +++ Makefile 2008-08-12 23:13:41 +0000 @@ -10,7 +10,7 @@ # For info about _FORTIFY_SOURCE, see # FORTIFY=-D_FORTIFY_SOURCE=2 # -fstack-protector-all -#COVERAGE=-fprofile-arcs -ftest-coverage +#COVERAGE=--coverage OPTIMIZE=-Os LANGUAGE=-std=gnu99 === modified file 'TODO' --- TODO 2008-08-12 16:47:22 +0000 +++ TODO 2008-08-12 23:13:41 +0000 @@ -2,9 +2,6 @@ * [#A] README file -* [#A] COPYING file - [[file:/usr/share/common-licenses/GPL-3][GPLv3]] - * Mandos-client ** [#A] Change syntax for arguments ** [#A] Man page: man8/mandos-client.8mandos @@ -60,9 +57,9 @@ ** Use asprintf instead of malloc and memcpy? ** IPv4 support ** use strsep instead of strtok? -** Do not depend on GPG key rings on disk - This would mean creating new GPG key rings with GPGME by importing - the key files from scratch on every program start. +** Do not depend on GnuPG key rings on disk + This would mean creating new GnuPG key rings with GPGME by + importing the key files from scratch on every program start. * Password-prompt ** [#A] Man page: man8/password-prompt.8mandos === modified file 'mandos-keygen' --- mandos-keygen 2008-08-12 19:47:50 +0000 +++ mandos-keygen 2008-08-12 23:13:41 +0000 @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/sh -e # -# Mandos key generator - create new OpenPGP keys for Mandos clients +# Mandos key generator - create a new OpenPGP key for a Mandos client # # Copyright © 2007-2008 Teddy Hogeborn & Björn Påhlsson # @@ -20,6 +20,8 @@ # Contact the authors at . # +VERSION="1.0" + KEYDIR="/etc/mandos" KEYTYPE=DSA KEYLENGTH=1024 @@ -31,10 +33,34 @@ KEYCOMMENT_ORIG="$KEYCOMMENT" # Parse options -TEMP=`getopt --options d:t:l:n:e:c:x:f \ - --longoptions dir:,type:,length:,name:,email:,comment:,expire:,force \ +TEMP=`getopt --options vhd:t:l:n:e:c:x:f \ + --longoptions version,help,dir:,type:,length:,name:,email:,comment:,expire:,force \ --name "$0" -- "$@"` +help(){ +cat <&2; exit 1;; esac @@ -100,7 +128,7 @@ exit 1 fi -# Set lines for GPG batch file +# Set lines for GnuPG batch file if [ -n "$KEYCOMMENT" ]; then KEYCOMMENTLINE="Name-Comment: $KEYCOMMENT" fi @@ -113,9 +141,10 @@ SECRING="`mktemp -t mandos-gpg-secring.XXXXXXXXXX`" PUBRING="`mktemp -t mandos-gpg-pubring.XXXXXXXXXX`" +# Remove temporary files on exit trap "rm --force $PUBRING $BATCHFILE; shred --remove $SECRING" EXIT -# Create batch file for GPG +# Create batch file for GnuPG cat >"$BATCHFILE" </dev/null; then shred --remove "$SECKEYFILE" @@ -154,6 +186,7 @@ FILECOMMENT="$FILECOMMENT <$KEYEMAIL>" fi +# Export keys from key rings to key files gpg --no-random-seed-file --quiet --batch --no-tty --armor \ --no-default-keyring --secret-keyring "$SECRING" \ --keyring "$PUBRING" --export-options export-minimal \ @@ -164,3 +197,9 @@ --keyring "$PUBRING" --export-options export-minimal \ --comment "$FILECOMMENT" --output "$PUBKEYFILE" \ --export + +trap - EXIT + +# Remove the key rings +shred --remove "$SECRING" +rm --force "$PUBRING"