/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.README.Debian

  • Committer: Teddy Hogeborn
  • Date: 2019-08-02 22:16:53 UTC
  • Revision ID: teddy@recompile.se-20190802221653-ic1iko9hbefzwsk7
Fix bug in server Debian package: Fails to start on first install

There has been a very long-standing bug where installation of the
server (the "mandos" Debian package) would fail to start the server
properly right after installation.  It would work on manual (re)start
after installation, or after reboot, and even after package purge and
reinstall, it would then work the first time.  The problem, it turns
out, is when the new "_mandos" user (and corresponding group) is
created, the D-Bus server is not reloaded, and is therefore not aware
of that user, and does not recognize the user and group name in the
/etc/dbus-1/system.d/mandos.conf file.  The Mandos server, when it
tries to start and access the D-Bus, is then not permitted to connect
to its D-Bus bus name, and disables D-Bus use as a fallback measure;
i.e. the server works, but it is not controllable via D-Bus commands
(via mandos-ctl or mandos-monitor).  The next time the D-Bus daemon is
reloaded for any reason, the new user & group would become visible to
the D-Bus daemon and after that, any restart of the Mandos server
would succeed and it would bind to its D-Bus name properly, and
thereby be visible and controllable by mandos-ctl & mandos-monitor.
This was mostly invisible when using sysvinit, but systemd makes the
problem visible since the systemd service file for the Mandos server
is configured to not consider the Mandos server "started" until the
D-Bus name has been bound; this makes the starting of the service wait
for 90 seconds and then fail with a timeout error.

Fixing this should also make the Debian CI autopkgtest tests work.

* debian/mandos.postinst (configure): After creating (or renaming)
                                      user & group, reload D-Bus
                                      daemon (if present).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This file documents the next steps to take after installation of the
 
2
Debian package, and also contain some notes specific to the Debian
 
3
packaging which are not also in the manual.
 
4
 
1
5
* Adding a Client Password to the Server
2
6
  
3
7
  The server must be given a password to give back to the client on
16
20
  is possible to verify that the correct password will be received by
17
21
  this client by running the command, on the client:
18
22
  
19
 
        /usr/lib/mandos/plugins.d/mandos-client \
 
23
        MANDOSPLUGINHELPERDIR=/usr/lib/$(dpkg-architecture \
 
24
        -qDEB_HOST_MULTIARCH)/mandos/plugin-helpers \
 
25
        /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH \
 
26
        )/mandos/plugins.d/mandos-client \
20
27
                --pubkey=/etc/keys/mandos/pubkey.txt \
21
 
                --seckey=/etc/keys/mandos/seckey.txt; echo
 
28
                --seckey=/etc/keys/mandos/seckey.txt \
 
29
                --tls-privkey=/etc/keys/mandos/tls-privkey.pem \
 
30
                --tls-pubkey=/etc/keys/mandos/tls-pubkey.pem; echo
22
31
  
23
32
  This command should retrieve the password from the server, decrypt
24
33
  it, and output it to standard output.  There it can be verified to
36
45
  automatically detected.  If this should result in incorrect
37
46
  interfaces, edit the DEVICE setting in the
38
47
  "/etc/initramfs-tools/initramfs.conf" file.  (The default setting is
39
 
  empty, meaning it will autodetect the interface.)  *If* the DEVICE
 
48
  empty, meaning it will autodetect the interfaces.)  *If* the DEVICE
40
49
  setting is changed, it will be necessary to update the initrd image
41
 
  by running the command
 
50
  by running this command:
42
51
  
 
52
        (For initramfs-tools:)
43
53
        update-initramfs -k all -u
 
54
        
 
55
        (For dracut:)
 
56
        dpkg-reconfigure dracut
44
57
  
45
58
  The device can also be overridden at boot time on the Linux kernel
46
59
  command line using the sixth colon-separated field of the "ip="
51
64
  Note that since the network interfaces are used in the initial RAM
52
65
  disk environment, the network interfaces *must* exist at that stage.
53
66
  Thus, an interface can *not* be a pseudo-interface such as "br0" or
54
 
  "tun0"; instead, only real interfaces (such as "eth0") can be used.
55
 
  This can be overcome by writing a "network hook" program to create
56
 
  an interface (see mandos-client(8mandos)) and placing it in
57
 
  "/etc/mandos/network-hooks.d", from where it will be copied into the
58
 
  initial RAM disk.  Example network hook scripts can be found in
59
 
  "/usr/share/doc/mandos-client/examples/network-hooks.d".
 
67
  "tun0"; instead, only real interfaces (such as "enp1s0" or "eth0")
 
68
  can be used. This can be overcome by writing a "network hook"
 
69
  program to create an interface (see mandos-client(8mandos)) and
 
70
  placing it in "/etc/mandos/network-hooks.d", from where it will be
 
71
  copied into the initial RAM disk.  Example network hook scripts can
 
72
  be found in "/usr/share/doc/mandos-client/examples/network-hooks.d".
60
73
 
61
74
* User-Supplied Plugins
62
75
  
64
77
  to the normal Mandos plugins.  When adding or changing plugins, do
65
78
  not forget to update the initital RAM disk image:
66
79
  
 
80
        (For initramfs-tools:)
67
81
        update-initramfs -k all -u
 
82
        
 
83
        (For dracut:)
 
84
        dpkg-reconfigure dracut
68
85
 
69
86
* Do *NOT* Edit "/etc/crypttab"
70
87
  
83
100
  "mandos=connect:<IP_ADDRESS>:<PORT_NUMBER>" on the kernel command
84
101
  line.
85
102
  
86
 
  For very advanced users, it it possible to specify simply
 
103
  For very advanced users, it is possible to specify simply
87
104
  "mandos=connect" on the kernel command line to make the system only
88
105
  set up the network (using the data in the "ip=" option) and not pass
89
106
  any extra "--connect" options to mandos-client at boot.  For this to
90
107
  work, "--options-for=mandos-client:--connect=<ADDRESS>:<PORT>" needs
91
108
  to be manually added to the file "/etc/mandos/plugin-runner.conf".
92
109
 
93
 
 -- Teddy Hogeborn <teddy@recompile.se>, Sun, 23 Jun 2013 17:31:53 +0200
 
110
* Diffie-Hellman Parameters
 
111
 
 
112
  On installation, a file with Diffie-Hellman parameters,
 
113
  /etc/keys/mandos/dhparams.pem, will be generated and automatically
 
114
  installed into the initital RAM disk image and also used by the
 
115
  Mandos Client on boot.  If different parameters are needed for
 
116
  policy or other reasons, simply replace the existing dhparams.pem
 
117
  file and update the initital RAM disk image.
 
118
 
 
119
 -- Teddy Hogeborn <teddy@recompile.se>, Mon, 15 Jul 2019 16:47:02 +0200