/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: 2018-08-19 14:06:55 UTC
  • Revision ID: teddy@recompile.se-20180819140655-ghsl0d4jsx8xwg44
Move UMASK setting to more proper place

* Makefile (install-client-nokey): Also install new conf files
  "initramfs-tools-conf".
* debian/mandos-client.dirs: Add "usr/share/initramfs-tools/conf.d".
* initramfs-tools-conf: New file which sets UMASK.
* initramfs-tools-hook: Change comment to correctly state new location
  of UMASK setting.
* initramfs-tools-hook-conf: Remove UMASK setting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
# Update the initial RAM file system image
21
21
update_initramfs()
22
22
{
23
 
    if [ -x /usr/sbin/update-initramfs ]; then
24
 
        update-initramfs -u -k all
25
 
    fi
 
23
    update-initramfs -u -k all
26
24
    
27
25
    if dpkg --compare-versions "$2" lt-nl "1.0.10-1"; then
28
26
        # Make old initrd.img files unreadable too, in case they were
58
56
        -a -r /etc/keys/mandos/seckey.txt ]; then
59
57
        return 0
60
58
    fi
61
 
    if [ -x /usr/sbin/mandos-keygen ]; then
62
 
        mandos-keygen
63
 
    fi
 
59
    mandos-keygen
 
60
    gpg-connect-agent KILLAGENT /bye || :
 
61
}
 
62
 
 
63
create_dh_params(){
 
64
    if [ -r /etc/keys/mandos/dhparams.pem ]; then
 
65
        return 0
 
66
    fi
 
67
    # Create a Diffe-Hellman parameters file
 
68
    DHFILE="`mktemp -t mandos-client-dh-parameters.XXXXXXXXXX.pem`"
 
69
    # First try certtool from GnuTLS
 
70
    if ! certtool --generate-dh-params --sec-param high \
 
71
         --outfile "$DHFILE"; then
 
72
        # Otherwise try OpenSSL
 
73
        if ! openssl genpkey -genparam -algorithm DH -out "$DHFILE" \
 
74
             -pkeyopt dh_paramgen_prime_len:3072; then
 
75
            # None of the commands succeded; give up
 
76
            rm -- "$DHFILE"
 
77
            return 1
 
78
        fi
 
79
    fi
 
80
    sed --in-place --expression='0,/^-----BEGIN DH PARAMETERS-----$/d' \
 
81
        "$DHFILE"
 
82
    sed --in-place --expression='1i-----BEGIN DH PARAMETERS-----' \
 
83
            "$DHFILE"
 
84
    cp --archive "$DHFILE" /etc/keys/mandos/dhparams.pem
 
85
    rm -- "$DHFILE"
64
86
}
65
87
 
66
88
case "$1" in
67
89
    configure)
68
90
        add_mandos_user "$@"
69
91
        create_key "$@"
 
92
        create_dh_params "$@" || :
70
93
        update_initramfs "$@"
 
94
        if dpkg --compare-versions "$2" lt-nl "1.7.10-1"; then
 
95
            PLUGINHELPERDIR=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)/mandos/plugin-helpers
 
96
            if ! dpkg-statoverride --list "$PLUGINHELPERDIR" \
 
97
                 >/dev/null 2>&1; then
 
98
                chmod u=rwx,go= -- "$PLUGINHELPERDIR"
 
99
            fi
 
100
            if ! dpkg-statoverride --list /etc/mandos/plugin-helpers \
 
101
                 >/dev/null 2>&1; then
 
102
                chmod u=rwx,go= -- /etc/mandos/plugin-helpers
 
103
            fi
 
104
        fi
71
105
        ;;
72
106
    abort-upgrade|abort-deconfigure|abort-remove)
73
107
        ;;