/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-19 13:50:22 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080919135022-214t21hetv8jgv0y
* debian/mandos-client.docs: New.  Add README and TODO file.
* debian/mandos.docs: - '' -

* debian/mandos-client.links: New.  Create plugin-runner.conf(5) link.

* debian/rules (DH_VERBOSE): Commented out.
               Removed commented-out unused dh_* stuff.  Removed
               "dh_makeshlibs".

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
35
35
KEYCOMMENT_ORIG="$KEYCOMMENT"
36
36
mode=keygen
37
37
 
 
38
if [ ! -d "$KEYDIR" ]; then
 
39
    KEYDIR="/etc/mandos/keys"
 
40
fi
 
41
 
38
42
# Parse options
39
43
TEMP=`getopt --options vhd:t:l:n:e:c:x:f \
40
44
    --longoptions version,help,password,dir:,type:,length:,subtype:,sublength:,name:,email:,comment:,expire:,force \
148
152
        [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|*) FORCE=0;;
149
153
    esac
150
154
    
151
 
    if { [ -e "$SECKEYFILE" ] || [ -e "$PUBKEYFILE" ]; } \
152
 
        && [ "$FORCE" -eq 0 ]; then
 
155
    if [ \( -e "$SECKEYFILE" -o -e "$PUBKEYFILE" \) \
 
156
        -a "$FORCE" -eq 0 ]; then
153
157
        echo "Refusing to overwrite old key files; use --force" >&2
154
158
        exit 1
155
159
    fi
184
188
stty echo; \
185
189
" EXIT
186
190
 
187
 
umask 027
 
191
umask 077
188
192
 
189
193
if [ "$mode" = keygen ]; then
190
194
    # Create batch file for GnuPG
254
258
    FINGERPRINT="`gpg --quiet --batch --no-tty --no-options \
255
259
        --enable-dsa2 --homedir \"$RINGDIR\" --trust-model always \
256
260
        --fingerprint --with-colons \
257
 
        | sed -n -e '/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
 
261
        | sed --quiet \
 
262
        --expression='/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
258
263
    
259
264
    test -n "$FINGERPRINT"
260
265
    
262
267
    
263
268
    stty -echo
264
269
    echo -n "Enter passphrase: " >&2
265
 
    sed -e '1q' \
 
270
    head --lines=1 | tr --delete '\n' \
266
271
        | gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
267
272
        --homedir "$RINGDIR" --trust-model always --armor --encrypt \
268
273
        --recipient "$FINGERPRINT" --comment "$FILECOMMENT" \
276
281
        fingerprint = $FINGERPRINT
277
282
        secret =
278
283
EOF
279
 
    sed -n -e '
 
284
    sed --quiet --expression='
280
285
        /^-----BEGIN PGP MESSAGE-----$/,/^-----END PGP MESSAGE-----$/{
281
286
            /^$/,${
282
287
                # Remove 24-bit Radix-64 checksum