/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 debian/mandos-client.postinst

  • Committer: Teddy Hogeborn
  • Date: 2015-07-20 03:03:33 UTC
  • Revision ID: teddy@recompile.se-20150720030333-203m2aeblypcsfte
Bug fix for GnuTLS 3: be compatible with old 2048-bit DSA keys.

The mandos-keygen program in Mandos version 1.6.0 and older generated
2048-bit DSA keys, and when GnuTLS uses these it has trouble
connecting using the Mandos default priority string.  This was
previously fixed in Mandos 1.6.2, but the bug reappeared when using
GnuTLS 3, so the default priority string has to change again; this
time also the Mandos client has to change its default, so now the
server and the client should use the same default priority string:

SECURE256:!CTYPE-X.509:+CTYPE-OPENPGP:!RSA:+SIGN-DSA-SHA256

* mandos (main/server_defaults): Changed default priority string.
* mandos-options.xml (/section/para[id="priority_compat"]): Removed.
  (/section/para[id="priority"]): Changed default priority string.
* mandos.conf ([DEFAULT]/priority): - '' -
* mandos.conf.xml (OPTIONS/priority): Refer to the id "priority"
                                      instead of "priority_compat".
* mandos.xml (OPTIONS/--priority): - '' -
* plugins.d/mandos-client.c (main): Changed default priority string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    fi
51
51
}
52
52
 
53
 
# Create client key pairs
54
 
create_keys(){
55
 
    # If the OpenPGP key files do not exist, generate all keys using
56
 
    # mandos-keygen
57
 
    if ! [ -r /etc/keys/mandos/pubkey.txt \
58
 
              -a -r /etc/keys/mandos/seckey.txt ]; then
59
 
        mandos-keygen
60
 
        gpg-connect-agent KILLAGENT /bye || :
61
 
        return 0
62
 
    fi
63
 
 
64
 
    # If the TLS keys already exists, do nothing
65
 
    if [ -r /etc/keys/mandos/tls-privkey.pem \
66
 
            -a -r /etc/keys/mandos/tls-pubkey.pem ]; then
67
 
        return 0
68
 
    fi
69
 
 
70
 
    # If this is an upgrade from an old installation, the TLS keys
71
 
    # will not exist; create them.
72
 
 
73
 
    # First try certtool from GnuTLS
74
 
    if ! certtool --generate-privkey --password='' \
75
 
         --outfile /etc/keys/mandos/tls-privkey.pem \
76
 
         --sec-param ultra --key-type=ed25519 --pkcs8 --no-text \
77
 
         2>/dev/null; then
78
 
        # Otherwise try OpenSSL
79
 
        if ! openssl genpkey -algorithm X25519 \
80
 
             -out /etc/keys/mandos/tls-privkey.pem; then
81
 
            rm --force /etc/keys/mandos/tls-privkey.pem
82
 
            # None of the commands succeded; give up
83
 
            return 1
84
 
        fi
85
 
    fi
86
 
 
87
 
    local umask=$(umask)
88
 
    umask 077
89
 
    # First try certtool from GnuTLS
90
 
    if ! certtool --password='' \
91
 
         --load-privkey=/etc/keys/mandos/tls-privkey.pem \
92
 
         --outfile=/etc/keys/mandos/tls-pubkey.pem --pubkey-info \
93
 
         --no-text 2>/dev/null; then
94
 
        # Otherwise try OpenSSL
95
 
        if ! openssl pkey -in /etc/keys/mandos/tls-privkey.pem \
96
 
             -out /etc/keys/mandos/tls-pubkey.pem -pubout; then
97
 
            rm --force /etc/keys/mandos/tls-pubkey.pem
98
 
            # None of the commands succeded; give up
99
 
            umask $umask
100
 
            return 1
101
 
        fi
102
 
    fi
103
 
    umask $umask
 
53
# Create client key pair
 
54
create_key(){
 
55
    if [ -r /etc/keys/mandos/pubkey.txt \
 
56
        -a -r /etc/keys/mandos/seckey.txt ]; then
 
57
        return 0
 
58
    fi
 
59
    mandos-keygen
104
60
}
105
61
 
106
62
create_dh_params(){
131
87
case "$1" in
132
88
    configure)
133
89
        add_mandos_user "$@"
134
 
        create_keys "$@"
 
90
        create_key "$@"
135
91
        create_dh_params "$@" || :
136
92
        update_initramfs "$@"
137
 
        if dpkg --compare-versions "$2" lt-nl "1.7.10-1"; then
138
 
            PLUGINHELPERDIR=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)/mandos/plugin-helpers
139
 
            if ! dpkg-statoverride --list "$PLUGINHELPERDIR" \
140
 
                 >/dev/null 2>&1; then
141
 
                chmod u=rwx,go= -- "$PLUGINHELPERDIR"
142
 
            fi
143
 
            if ! dpkg-statoverride --list /etc/mandos/plugin-helpers \
144
 
                 >/dev/null 2>&1; then
145
 
                chmod u=rwx,go= -- /etc/mandos/plugin-helpers
146
 
            fi
147
 
        fi
148
93
        ;;
149
94
    abort-upgrade|abort-deconfigure|abort-remove)
150
95
        ;;