/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-05 07:11:24 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905071124-9dq11jq5rfd6zfxf
* Makefile: Changed to use symbolic instead of octal modes throughout.
  (KEYDIR): New variable for the key directory.
  (install-server): Bug fix: remove "--parents" from install args.
  (install-client): Bug fix: - '' -  Also create key directory.  Do
                    not chmod plugin dir.  Create custom plugin directory
                    if not the same as normal plugin directory.  Add
                    "--dir" option to "mandos-keygen".  Add note about
                    running "mandos-keygen --password".
  (uninstall-server): Do not depend on the installed server binary,
                      since this made it impossible to do a purge
                      after an uninstall.
  (purge-client): Shred seckey.txt.  Use $(KEYDIR).

* README: Improved wording.

* initramfs-tools-hook: Use a loop to find prefix.  Also find keydir.
                        Remove "${DESTDIR}" from "copy_exec".  Do not
                        try to copy literal "*" if no custom plugins
                        are found.  Copy key files from keydir, not
                        config dir.  Only repair mode on directories
                        that actually exist.  Do not run chmod if
                        nothing needs repairing.

* plugin-runner.conf: New file.

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