/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-keygen

  • Committer: Teddy Hogeborn
  • Date: 2008-09-04 21:42:02 UTC
  • mfrom: (24.1.89 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20080904214202-md7u3n1yqng8vz82
* Makefile (run-client): Do not depend on the key ring files.
  (keydir/secring.gpg, keydir/pubring.gpg): Removed.
  (confdir/mandos.conf): Install with proper mode.
  (confdir/clients.conf): - '' -

* mandos-keygen: Use a temporary directory with key ring files instead
                 of separate temporary key ring files.  Removed
                 "--no-random-seed" and "--no-permission-warning" from
                 all gpg invocations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
VERSION="1.0"
24
24
 
25
 
KEYDIR="/etc/keys/mandos"
 
25
KEYDIR="/etc/mandos"
26
26
KEYTYPE=DSA
27
27
KEYLENGTH=2048
28
28
SUBKEYTYPE=ELG-E
148
148
        [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|*) FORCE=0;;
149
149
    esac
150
150
    
151
 
    if [ \( -e "$SECKEYFILE" -o -e "$PUBKEYFILE" \) \
152
 
        -a "$FORCE" -eq 0 ]; then
 
151
    if { [ -e "$SECKEYFILE" ] || [ -e "$PUBKEYFILE" ]; } \
 
152
        && [ "$FORCE" -eq 0 ]; then
153
153
        echo "Refusing to overwrite old key files; use --force" >&2
154
154
        exit 1
155
155
    fi
184
184
stty echo; \
185
185
" EXIT
186
186
 
187
 
umask 077
 
187
umask 027
188
188
 
189
189
if [ "$mode" = keygen ]; then
190
190
    # Create batch file for GnuPG
254
254
    FINGERPRINT="`gpg --quiet --batch --no-tty --no-options \
255
255
        --enable-dsa2 --homedir \"$RINGDIR\" --trust-model always \
256
256
        --fingerprint --with-colons \
257
 
        | sed --quiet \
258
 
        --expression='/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
 
257
        | sed -n -e '/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
259
258
    
260
259
    test -n "$FINGERPRINT"
261
260
    
263
262
    
264
263
    stty -echo
265
264
    echo -n "Enter passphrase: " >&2
266
 
    head --lines=1 | tr --delete '\n' \
 
265
    sed -e '1q' \
267
266
        | gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
268
267
        --homedir "$RINGDIR" --trust-model always --armor --encrypt \
269
268
        --recipient "$FINGERPRINT" --comment "$FILECOMMENT" \
277
276
        fingerprint = $FINGERPRINT
278
277
        secret =
279
278
EOF
280
 
    sed --quiet --expression='
 
279
    sed -n -e '
281
280
        /^-----BEGIN PGP MESSAGE-----$/,/^-----END PGP MESSAGE-----$/{
282
281
            /^$/,${
283
282
                # Remove 24-bit Radix-64 checksum