/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: Björn Påhlsson
  • Date: 2010-10-02 18:28:21 UTC
  • mfrom: (237.4.6 mandos-release)
  • mto: This revision was merged to the branch mainline in revision 453.
  • Revision ID: belorn@fukt.bsnet.se-20101002182821-cazexo9y46o0g72o
Merge from release branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
3
3
# Mandos key generator - create a new OpenPGP key for a Mandos client
4
4
5
 
# Copyright © 2008,2009 Teddy Hogeborn
6
 
# Copyright © 2008,2009 Björn Påhlsson
 
5
# Copyright © 2008-2010 Teddy Hogeborn
 
6
# Copyright © 2008-2010 Björn Påhlsson
7
7
8
8
# This program is free software: you can redistribute it and/or modify
9
9
# it under the terms of the GNU General Public License as published by
21
21
# Contact the authors at <mandos@fukt.bsnet.se>.
22
22
23
23
 
24
 
VERSION="1.0.8"
 
24
VERSION="1.2.1"
25
25
 
26
26
KEYDIR="/etc/keys/mandos"
27
27
KEYTYPE=DSA
195
195
stty echo; \
196
196
" EXIT
197
197
 
 
198
set -e
 
199
 
198
200
umask 077
199
201
 
200
202
if [ "$mode" = keygen ]; then
217
219
        %commit
218
220
        EOF
219
221
    
 
222
    if tty --quiet; then
 
223
        cat <<-EOF
 
224
        Note: Due to entropy requirements, key generation could take
 
225
        anything from a few minutes to SEVERAL HOURS.  Please be
 
226
        patient and/or supply the system with more entropy if needed.
 
227
        EOF
 
228
        echo -n "Started: "
 
229
        date
 
230
    fi
 
231
    
220
232
    # Generate a new key in the key rings
221
233
    gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
222
234
        --homedir "$RINGDIR" --trust-model always \
223
235
        --gen-key "$BATCHFILE"
224
236
    rm --force "$BATCHFILE"
225
237
    
 
238
    if tty --quiet; then
 
239
        echo -n "Finished: "
 
240
        date
 
241
    fi
 
242
    
226
243
    # Backup any old key files
227
244
    if cp --backup=numbered --force "$SECKEYFILE" "$SECKEYFILE" \
228
245
        2>/dev/null; then
278
295
        stty -echo
279
296
        echo -n "Enter passphrase: " >&2
280
297
        first="$(head --lines=1 | tr --delete '\n')"
281
 
        echo -n -e "\nRepeat passphrase: " >&2
 
298
        echo >&2
 
299
        echo -n "Repeat passphrase: " >&2
282
300
        second="$(head --lines=1 | tr --delete '\n')"
283
301
        echo >&2
284
302
        stty echo
285
303
        if [ "$first" != "$second" ]; then
286
 
            echo -e "Passphrase mismatch" >&2
 
304
            echo "Passphrase mismatch" >&2
287
305
            touch "$RINGDIR"/mismatch
288
306
        else
289
307
            echo -n "$first"