/mandos/release

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

« back to all changes in this revision

Viewing changes to mandos-keygen

  • Committer: teddy at bsnet
  • Date: 2010-08-10 19:08:24 UTC
  • mto: (237.2.182 mandos-local)
  • mto: This revision was merged to the branch mainline in revision 270.
  • Revision ID: teddy@fukt.bsnet.se-20100810190824-5yquozxy4kh6py3f
* plugins.d/mandos-client.c: An empty interface name now means to
                             autodetect an interface; to specify no
                             particular interface, use "none".
  (sys_class_net): New global variable for the "/sys/class/net" path.
  (good_interface): New function to determine the suitability of an
                    interface.  Used by a scandir() call in main().
  (main): Changed default value for "interface" to the empty string.
          Moved "connect_to" to be a global variable.  Only take down
          and up interface if its name is not "none".
* plugins.d/mandos-client.xml (OPTIONS): Update documentation for the
                                         "--interface" option.

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-2010 Teddy Hogeborn
6
 
# Copyright © 2008-2010 Björn Påhlsson
 
5
# Copyright © 2008,2009 Teddy Hogeborn
 
6
# Copyright © 2008,2009 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.2"
 
24
VERSION="1.0.14"
25
25
 
26
26
KEYDIR="/etc/keys/mandos"
27
27
KEYTYPE=DSA
217
217
        %commit
218
218
        EOF
219
219
    
220
 
    if tty --quiet; then
221
 
        cat <<-EOF
222
 
        Note: Due to entropy requirements, key generation could take
223
 
        anything from a few minutes to SEVERAL HOURS.  Please be
224
 
        patient and/or supply the system with more entropy if needed.
225
 
        EOF
226
 
        echo -n "Started: "
227
 
        date
228
 
    fi
229
 
    
230
220
    # Generate a new key in the key rings
231
221
    gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
232
222
        --homedir "$RINGDIR" --trust-model always \
233
223
        --gen-key "$BATCHFILE"
234
224
    rm --force "$BATCHFILE"
235
225
    
236
 
    if tty --quiet; then
237
 
        echo -n "Finished: "
238
 
        date
239
 
    fi
240
 
    
241
226
    # Backup any old key files
242
227
    if cp --backup=numbered --force "$SECKEYFILE" "$SECKEYFILE" \
243
228
        2>/dev/null; then
293
278
        stty -echo
294
279
        echo -n "Enter passphrase: " >&2
295
280
        first="$(head --lines=1 | tr --delete '\n')"
296
 
        echo >&2
297
 
        echo -n "Repeat passphrase: " >&2
 
281
        echo -n -e "\nRepeat passphrase: " >&2
298
282
        second="$(head --lines=1 | tr --delete '\n')"
299
283
        echo >&2
300
284
        stty echo
301
285
        if [ "$first" != "$second" ]; then
302
 
            echo "Passphrase mismatch" >&2
 
286
            echo -e "Passphrase mismatch" >&2
303
287
            touch "$RINGDIR"/mismatch
304
288
        else
305
289
            echo -n "$first"