/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: Teddy Hogeborn
  • Date: 2008-09-05 23:39:07 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905233907-3rz7kuwyjwma0pjx
* Makefile (confdir/clients.conf): Tighten permissions to "u=rw".
  (install-server): Set mode of "/etc/mandos/clients.conf" to
                             "u=rw".
  (install-client): Set mode of "/etc/mandos/plugins.d" to "u=rwx".
  (uninstall-client): Also remove "/usr/lib/mandos/plugins.d/usplash",
                "/usr/share/initramfs-tools/scripts/local-top/mandos",
                      and "/etc/keys/mandos".
  (purge-server): Also remove "/var/run/mandos.pid".

* initramfs-tools-hook: Use "install" instead of "mkdir".  Change
                        owner of "/lib/mandos/plugins.d" and key
                        files.  Bug fix: do not repair permissions of
                        "/lib/mandos/plugins.d".  Bug fix: Really
                        avoid deliberately unreadable files and/or
                        directories.

* mandos-keygen (umask): Changed to "077".

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
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