/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 Hogeborn
  • Date: 2008-09-06 16:33:08 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080906163308-ciy82qw6jollqrjd
* plugins.d/mandos-client.xml (NAME, OVERVIEW, EXIT STATUS): Improved
                                                             wording.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
VERSION="1.0"
24
24
 
25
 
KEYDIR="/etc/mandos"
 
25
KEYDIR="/etc/keys/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" ] || [ -e "$PUBKEYFILE" ]; } \
152
 
        && [ "$FORCE" -eq 0 ]; then
 
151
    if [ \( -e "$SECKEYFILE" -o -e "$PUBKEYFILE" \) \
 
152
        -a "$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 027
 
187
umask 077
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 -n -e '/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
 
257
        | sed --quiet \
 
258
        --expression='/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
258
259
    
259
260
    test -n "$FINGERPRINT"
260
261
    
262
263
    
263
264
    stty -echo
264
265
    echo -n "Enter passphrase: " >&2
265
 
    sed -e '1q' \
 
266
    head --lines=1 | tr --delete '\n' \
266
267
        | gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
267
268
        --homedir "$RINGDIR" --trust-model always --armor --encrypt \
268
269
        --recipient "$FINGERPRINT" --comment "$FILECOMMENT" \
276
277
        fingerprint = $FINGERPRINT
277
278
        secret =
278
279
EOF
279
 
    sed -n -e '
 
280
    sed --quiet --expression='
280
281
        /^-----BEGIN PGP MESSAGE-----$/,/^-----END PGP MESSAGE-----$/{
281
282
            /^$/,${
282
283
                # Remove 24-bit Radix-64 checksum