mandos-client — Client for Mandos


mandos-client [ --connect ADDRESS:PORT | -c ADDRESS:PORT ]
[ --interface NAME [,NAME...] | -i NAME [,NAME...] ...]
[ --pubkey FILE | -p FILE ]
[ --seckey FILE | -s FILE ]
[ --tls-privkey FILE | -t FILE ]
[ --tls-pubkey FILE | -T FILE ]
[ --priority STRING ]
[ --dh-bits BITS ]
[ --dh-params FILE ]
[ --delay SECONDS ]
[ --retry SECONDS ]
[ --network-hook-dir DIR ]
[ --debug ]

mandos-client { --help | -? }

mandos-client --usage

mandos-client { --version | -V }


mandos-client is a client program that communicates with mandos(8) to get a password. In slightly more detail, this client program brings up network interfaces, uses the interfaces’ IPv6 link-local addresses to get network connectivity, uses Zeroconf to find servers on the local network, and communicates with servers using TLS with a raw public key to ensure authenticity and confidentiality. This client program keeps running, trying all servers on the network, until it receives a satisfactory reply or a TERM signal. After all servers have been tried, all servers are periodically retried. If no servers are found it will wait indefinitely for new servers to appear.

The network interfaces are selected like this: If any interfaces are specified using the --interface option, those interface are used. Otherwise, mandos-client will use all interfaces that are not loopback interfaces, are not point-to-point interfaces, are capable of broadcasting and do not have the NOARP flag (see netdevice(7)). (If the --connect option is used, point-to-point interfaces and non-broadcast interfaces are accepted.) If any used interfaces are not up and running, they are first taken up (and later taken down again on program exit).

Before network interfaces are selected, all network hooks are run; see the section called “NETWORK HOOKS”.

This program is not meant to be run directly; it is really meant to run as a plugin of the Mandos plugin-runner(8mandos), which runs in the initial RAM disk environment because it is specified as a keyscript in the crypttab(5) file.


The purpose of this is to enable remote and unattended rebooting of client host computer with an encrypted root file system. See the section called “OVERVIEW” for details.


This program is commonly not invoked from the command line; it is normally started by the Mandos plugin runner, see plugin-runner(8mandos). Any command line options this program accepts are therefore normally provided by the plugin runner, and not directly.


Do not use Zeroconf to locate servers. Connect directly to only one specified Mandos server. Note that an IPv6 address has colon characters in it, so the last colon character is assumed to separate the address from the port number.

Normally, Zeroconf would be used to locate Mandos servers, in which case this option would only be used when testing and debugging.

--interface=NAME [,NAME...], -i NAME [,NAME...]

Comma separated list of network interfaces that will be brought up and scanned for Mandos servers to connect to. The default is the empty string, which will automatically use all appropriate interfaces.

If the --connect option is used, and exactly one interface name is specified (except none), this specifies the interface to use to connect to the address given.

Note that since this program will normally run in the initial RAM disk environment, the interface must be an interface which exists at that stage. Thus, the interface can normally not be a pseudo-interface such as br0 or tun0; such interfaces will not exist until much later in the boot process, and can not be used by this program, unless created by a network hook — see the section called “NETWORK HOOKS”.

NAME can be the string none; this will make mandos-client only bring up interfaces specified before this string. This is not recommended, and only meant for advanced users.

--pubkey=FILE, -p FILE

OpenPGP public key file name. The default name is /conf/conf.d/mandos/pubkey.txt.

--seckey=FILE, -s FILE

OpenPGP secret key file name. The default name is /conf/conf.d/mandos/seckey.txt.

--tls-pubkey=FILE, -T FILE

TLS raw public key file name. The default name is /conf/conf.d/mandos/tls-pubkey.pem.

--tls-privkey=FILE, -t FILE

TLS secret key file name. The default name is /conf/conf.d/mandos/tls-privkey.pem.


GnuTLS priority string for the TLS handshake. The default is SECURE128​:!CTYPE-X.509​:+CTYPE-RAWPK​:!RSA​:!VERS-ALL​:+VERS-TLS1.3​:%PROFILE_ULTRA when using raw public keys in TLS, and SECURE256​:!CTYPE-X.509​:+CTYPE-OPENPGP​:!RSA​:+SIGN-DSA-SHA256 when using OpenPGP keys in TLS,. See gnutls_priority_init(3) for the syntax. Warning: changing this may make the TLS handshake fail, making server-client communication impossible. Changing this option may also make the network traffic decryptable by an attacker.


Sets the number of bits to use for the prime number in the TLS Diffie-Hellman key exchange. The default value is selected automatically based on the GnuTLS security profile set in its priority string. Note that if the --dh-params option is used, the values from that file will be used instead.


Specifies a PEM-encoded PKCS#3 file to read the parameters needed by the TLS Diffie-Hellman key exchange from. If this option is not given, or if the file for some reason could not be used, the parameters will be generated on startup, which will take some time and processing power. Those using servers running under time, power or processor constraints may want to generate such a file in advance and use this option.


After bringing a network interface up, the program waits for the interface to arrive in a running state before proceeding. During this time, the kernel log level will be lowered to reduce clutter on the system console, alleviating any other plugins which might be using the system console. This option sets the upper limit of seconds to wait. The default is 2.5 seconds.


All Mandos servers are tried repeatedly until a password is received. This value specifies, in seconds, how long between each successive try for the same server. The default is 10 seconds.


Network hook directory. The default directory is /lib/mandos/network-hooks.d.


Enable debug mode. This will enable a lot of output to standard error about what the program is doing. The program will still perform all other functions normally.

It will also enable debug mode in the Avahi and GnuTLS libraries, making them print large amounts of debugging output.

--help, -?

Gives a help message about options and their meanings.


Gives a short usage message.

--version, -V

Prints the program version.


This is part of the Mandos system for allowing computers to have encrypted root file systems and at the same time be capable of remote and/or unattended reboots. The computers run a small client program in the initial RAM disk environment which will communicate with a server over a network. All network communication is encrypted using TLS. The clients are identified by the server using a TLS key; each client has one unique to it. The server sends the clients an encrypted password. The encrypted password is decrypted by the clients using a separate OpenPGP key, and the password is then used to unlock the root file system, whereupon the computers can continue booting normally.

This program is the client part. It is a plugin started by plugin-runner(8mandos) which will run in an initial RAM disk environment.

This program could, theoretically, be used as a keyscript in /etc/crypttab, but it would then be impossible to enter a password for the encrypted root disk at the console, since this program does not read from the console at all. This is why a separate plugin runner (plugin-runner(8mandos)) is used to run both this program and others in in parallel, one of which (password-prompt(8mandos)) will prompt for passwords on the system console.


This program will exit with a successful (zero) exit status if a server could be found and the password received from it could be successfully decrypted and output on standard output. The program will exit with a non-zero exit status only if a critical error occurs. Otherwise, it will forever connect to any discovered Mandos servers, trying to get a decryptable password and print it.



This environment variable will be assumed to contain the directory containing any helper executables. The use and nature of these helper executables, if any, is purposely not documented.

This program does not use any other environment variables, not even the ones provided by cryptsetup(8).


If a network interface like a bridge or tunnel is required to find a Mandos server, this requires the interface to be up and running before mandos-client starts looking for Mandos servers. This can be accomplished by creating a network hook program, and placing it in a special directory.

Before the network is used (and again before program exit), any runnable programs found in the network hook directory are run with the argument start or stop. This should bring up or down, respectively, any network interface which mandos-client should use.


A network hook must be an executable file, and its name must consist entirely of upper and lower case letters, digits, underscores, periods, and hyphens.

A network hook will receive one argument, which can be one of the following:


This should make the network hook create (if necessary) and bring up a network interface.


This should make the network hook take down a network interface, and delete it if it did not exist previously.


This should make the network hook print, one file per line, all the files needed for it to run. (These files will be copied into the initial RAM filesystem.) Typical use is for a network hook which is a shell script to print its needed binaries.

It is not necessary to print any non-executable files already in the network hook directory, these will be copied implicitly if they otherwise satisfy the name requirements.


This should make the network hook print, on separate lines, all the kernel modules needed for it to run. (These modules will be copied into the initial RAM filesystem.) For instance, a tunnel interface needs the tun module.

The network hook will be provided with a number of environment variables:


The network hook directory, specified to mandos-client by the --network-hook-dir option. Note: this should always be used by the network hook to refer to itself or any files in the hook directory it may require.


The network interfaces, as specified to mandos-client by the --interface option, combined to one string and separated by commas. If this is set, and does not contain the interface a hook will bring up, there is no reason for a hook to continue.


This will be the same as the first argument; i.e. start, stop, files, or modules.


This will be the 1 if the --debug option is passed to mandos-client, otherwise 0.


This will be the same as the --delay option passed to mandos-client. Is only set if MODE is start or stop.


This will be the same as the --connect option passed to mandos-client. Is only set if --connect is passed and MODE is start or stop.

A hook may not read from standard input, and should be restrictive in printing to standard output or standard error unless VERBOSITY is 1.


/conf/conf.d/mandos/pubkey.txt, /conf/conf.d/mandos/seckey.txt

OpenPGP public and private key files, in ASCII Armor format. These are the default file names, they can be changed with the --pubkey and --seckey options.

/conf/conf.d/mandos/tls-pubkey.pem, /conf/conf.d/mandos/tls-privkey.pem

Public and private raw key files, in PEM format. These are the default file names, they can be changed with the --tls-pubkey and --tls-privkey options.


Directory where network hooks are located. Change this with the --network-hook-dir option. See the section called “NETWORK HOOKS”.


Please report bugs to the Mandos development mailing list: (subscription required). Note that this list is public. The developers can be reached privately at (OpenPGP key fingerprint 153A 37F1 0BBA 0435 987F 2C4A 7223 2973 CA34 C2C4 for encrypted mail).


Note that normally, command line options will not be given directly, but via options for the Mandos plugin-runner(8mandos).

Normal invocation needs no options, if the network interfaces can be automatically determined:


Search for Mandos servers (and connect to them) using one specific interface:

mandos-client --interface eth1

Run in debug mode, and use custom keys:

mandos-client --debug --pubkey keydir/pubkey.txt --seckey keydir/seckey.txt --tls-pubkey keydir/tls-pubkey.pem --tls-privkey keydir/tls-privkey.pem

Run in debug mode, with custom keys, and do not use Zeroconf to locate a server; connect directly to the IPv6 link-local address fe80::aede:48ff:fe71:f6f2, port 4711, using interface eth2:

mandos-client --debug --pubkey keydir/pubkey.txt --seckey keydir/seckey.txt --tls-pubkey keydir/tls-pubkey.pem --tls-privkey keydir/tls-privkey.pem --connect fe80::aede:48ff:fe71:f6f2:4711 --interface eth2


This program assumes that it is set-uid to root, and will switch back to the original (and presumably non-privileged) user and group after bringing up the network interface.

To use this program for its intended purpose (see the section called “PURPOSE”), the password for the root file system will have to be given out to be stored in a server computer, after having been encrypted using an OpenPGP key. This encrypted data which will be stored in a server can only be decrypted by the OpenPGP key, and the data will only be given out to those clients who can prove they actually have that key. This key, however, is stored unencrypted on the client side in its initial RAM disk image file system. This is normally readable by all, but this is normally fixed during installation of this program; file permissions are set so that no-one is able to read that file.

The only remaining weak point is that someone with physical access to the client hard drive might turn off the client computer, read the OpenPGP and TLS keys directly from the hard drive, and communicate with the server. To safeguard against this, the server is supposed to notice the client disappearing and stop giving out the encrypted data. Therefore, it is important to set the timeout and checker interval values tightly on the server. See mandos(8).

It will also help if the checker program on the server is configured to request something from the client which can not be spoofed by someone else on the network, like SSH server key fingerprints, and unlike unencrypted ICMP echo (ping) replies.

Note: This makes it completely insecure to have Mandos clients which dual-boot to another operating system which is not trusted to keep the initial RAM disk image confidential.


intro(8mandos), cryptsetup(8), crypttab(5), mandos(8), password-prompt(8mandos), plugin-runner(8mandos)


Zeroconf is the network protocol standard used for finding Mandos servers on the local network.


Avahi is the library this program calls to find Zeroconf services.


GnuTLS is the library this client uses to implement TLS for communicating securely with the server, and at the same time send the public key to the server.


GPGME is the library used to decrypt the OpenPGP data sent by the server.

RFC 4291: IP Version 6 Addressing Architecture
Section 2.2: Text Representation of Addresses

Section IPv4-Mapped IPv6 Address

Section 2.5.6, Link-Local IPv6 Unicast Addresses

This client uses IPv6 link-local addresses, which are immediately usable since a link-local addresses is automatically assigned to a network interface when it is brought up.

RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2

TLS 1.2 is the protocol implemented by GnuTLS.

RFC 4880: OpenPGP Message Format

The data received from the server is binary encrypted OpenPGP data.

RFC 7250: Using Raw Public Keys in Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)

This is implemented by GnuTLS in version 3.6.6 and is, if present, used by this program so that raw public keys can be used.

RFC 6091: Using OpenPGP Keys for Transport Layer Security

This is implemented by GnuTLS before version 3.6.0 and is, if present, used by this program so that OpenPGP keys can be used.