20
20
# Update the initial RAM file system image
23
if [ -x /usr/sbin/update-initramfs ]; then
24
update-initramfs -u -k all
23
update-initramfs -u -k all
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
55
# Create client key pair
57
if [ -r /etc/keys/mandos/pubkey.txt \
58
-a -r /etc/keys/mandos/seckey.txt ]; then
61
if [ -x /usr/sbin/mandos-keygen ]; then
53
# Create client key pairs
55
# If the OpenPGP key files do not exist, generate all keys using
57
if ! [ -r /etc/keys/mandos/pubkey.txt \
58
-a -r /etc/keys/mandos/seckey.txt ]; then
60
gpg-connect-agent KILLAGENT /bye || :
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
70
# If this is an upgrade from an old installation, the TLS keys
71
# will not exist; create them.
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 \
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
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
66
106
create_dh_params(){
67
if [ -r /etc/keys/mandos/client-dhparams.pem ]; then
107
if [ -r /etc/keys/mandos/dhparams.pem ]; then
70
110
# Create a Diffe-Hellman parameters file
85
125
sed --in-place --expression='1i-----BEGIN DH PARAMETERS-----' \
87
cp --archive "$DHFILE" /etc/keys/mandos/client-dhparams.pem
127
cp --archive "$DHFILE" /etc/keys/mandos/dhparams.pem
93
133
add_mandos_user "$@"
95
135
create_dh_params "$@" || :
96
136
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"
143
if ! dpkg-statoverride --list /etc/mandos/plugin-helpers \
144
>/dev/null 2>&1; then
145
chmod u=rwx,go= -- /etc/mandos/plugin-helpers
98
149
abort-upgrade|abort-deconfigure|abort-remove)