/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
	"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY COMMANDNAME "mandos-client">
<!ENTITY TIMESTAMP "2009-01-24">
<!ENTITY % common SYSTEM "../common.ent">
%common;
]>

<refentry xmlns:xi="http://www.w3.org/2001/XInclude">
  <refentryinfo>
    <title>Mandos Manual</title>
    <!-- NWalsh’s docbook scripts use this to generate the footer: -->
    <productname>Mandos</productname>
    <productnumber>&version;</productnumber>
    <date>&TIMESTAMP;</date>
    <authorgroup>
      <author>
	<firstname>Björn</firstname>
	<surname>Påhlsson</surname>
	<address>
	  <email>belorn@fukt.bsnet.se</email>
	</address>
      </author>
      <author>
	<firstname>Teddy</firstname>
	<surname>Hogeborn</surname>
	<address>
	  <email>teddy@fukt.bsnet.se</email>
	</address>
      </author>
    </authorgroup>
    <copyright>
      <year>2008</year>
      <year>2009</year>
      <holder>Teddy Hogeborn</holder>
      <holder>Björn Påhlsson</holder>
    </copyright>
    <xi:include href="../legalnotice.xml"/>
  </refentryinfo>
  
  <refmeta>
    <refentrytitle>&COMMANDNAME;</refentrytitle>
    <manvolnum>8mandos</manvolnum>
  </refmeta>
  
  <refnamediv>
    <refname><command>&COMMANDNAME;</command></refname>
    <refpurpose>
      Client for <application>Mandos</application>
    </refpurpose>
  </refnamediv>
  
  <refsynopsisdiv>
    <cmdsynopsis>
      <command>&COMMANDNAME;</command>
      <group>
	<arg choice="plain"><option>--connect
	<replaceable>ADDRESS</replaceable><literal>:</literal
	><replaceable>PORT</replaceable></option></arg>
	<arg choice="plain"><option>-c
	<replaceable>ADDRESS</replaceable><literal>:</literal
	><replaceable>PORT</replaceable></option></arg>
      </group>
      <sbr/>
      <group>
	<arg choice="plain"><option>--interface
	<replaceable>NAME</replaceable></option></arg>
	<arg choice="plain"><option>-i
	<replaceable>NAME</replaceable></option></arg>
      </group>
      <sbr/>
      <group>
	<arg choice="plain"><option>--pubkey
	<replaceable>FILE</replaceable></option></arg>
	<arg choice="plain"><option>-p
	<replaceable>FILE</replaceable></option></arg>
      </group>
      <sbr/>
      <group>
	<arg choice="plain"><option>--seckey
	<replaceable>FILE</replaceable></option></arg>
	<arg choice="plain"><option>-s
	<replaceable>FILE</replaceable></option></arg>
      </group>
      <sbr/>
      <arg>
	<option>--priority <replaceable>STRING</replaceable></option>
      </arg>
      <sbr/>
      <arg>
	<option>--dh-bits <replaceable>BITS</replaceable></option>
      </arg>
      <sbr/>
      <arg>
	<option>--debug</option>
      </arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>&COMMANDNAME;</command>
      <group choice="req">
	<arg choice="plain"><option>--help</option></arg>
	<arg choice="plain"><option>-?</option></arg>
      </group>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>&COMMANDNAME;</command>
      <arg choice="plain"><option>--usage</option></arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>&COMMANDNAME;</command>
      <group choice="req">
	<arg choice="plain"><option>--version</option></arg>
	<arg choice="plain"><option>-V</option></arg>
      </group>
    </cmdsynopsis>
  </refsynopsisdiv>
  
  <refsect1 id="description">
    <title>DESCRIPTION</title>
    <para>
      <command>&COMMANDNAME;</command> is a client program that
      communicates with <citerefentry><refentrytitle
      >mandos</refentrytitle><manvolnum>8</manvolnum></citerefentry>
      to get a password.  It brings up a network interface, uses its
      IPv6 link-local address to get network connectivity, uses
      Zeroconf to find servers, and uses TLS with an OpenPGP key to
      ensure authenticity and confidentiality.  It keeps running,
      trying all servers on the network, until it receives a
      satisfactory reply or a TERM signal is received.
    </para>
    <para>
      This program is not meant to be run directly; it is really meant
      to run as a plugin of the <application>Mandos</application>
      <citerefentry><refentrytitle>plugin-runner</refentrytitle>
      <manvolnum>8mandos</manvolnum></citerefentry>, which runs in the
      initial <acronym>RAM</acronym> disk environment because it is
      specified as a <quote>keyscript</quote> in the <citerefentry>
      <refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum>
      </citerefentry> file.
    </para>
  </refsect1>
  
  <refsect1 id="purpose">
    <title>PURPOSE</title>
    <para>
      The purpose of this is to enable <emphasis>remote and unattended
      rebooting</emphasis> of client host computer with an
      <emphasis>encrypted root file system</emphasis>.  See <xref
      linkend="overview"/> for details.
    </para>
  </refsect1>
  
  <refsect1 id="options">
    <title>OPTIONS</title>
    <para>
      This program is commonly not invoked from the command line; it
      is normally started by the <application>Mandos</application>
      plugin runner, see <citerefentry><refentrytitle
      >plugin-runner</refentrytitle><manvolnum>8mandos</manvolnum>
      </citerefentry>.  Any command line options this program accepts
      are therefore normally provided by the plugin runner, and not
      directly.
    </para>
    
    <variablelist>
      <varlistentry>
	<term><option>--connect=<replaceable
	>ADDRESS</replaceable><literal>:</literal><replaceable
	>PORT</replaceable></option></term>
	<term><option>-c
	<replaceable>ADDRESS</replaceable><literal>:</literal
	><replaceable>PORT</replaceable></option></term>
	<listitem>
	  <para>
	    Do not use Zeroconf to locate servers.  Connect directly
	    to only one specified <application>Mandos</application>
	    server.  Note that an IPv6 address has colon characters in
	    it, so the <emphasis>last</emphasis> colon character is
	    assumed to separate the address from the port number.
	  </para>
	  <para>
	    This option is normally only useful for testing and
	    debugging.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--interface=
	<replaceable>NAME</replaceable></option></term>
	<term><option>-i
	<replaceable>NAME</replaceable></option></term>
	<listitem>
	  <para>
	    Network interface that will be brought up and scanned for
	    Mandos servers to connect to.  The default it
	    <quote><literal>eth0</literal></quote>.
	  </para>
	  <para>
	    If the <option>--connect</option> option is used, this
	    specifies the interface to use to connect to the address
	    given.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--pubkey=<replaceable
	>FILE</replaceable></option></term>
	<term><option>-p
	<replaceable>FILE</replaceable></option></term>
	<listitem>
	  <para>
	    OpenPGP public key file name.  The default name is
	    <quote><filename>/conf/conf.d/mandos/pubkey.txt</filename
	    ></quote>.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--seckey=<replaceable
	>FILE</replaceable></option></term>
	<term><option>-s
	<replaceable>FILE</replaceable></option></term>
	<listitem>
	  <para>
	    OpenPGP secret key file name.  The default name is
	    <quote><filename>/conf/conf.d/mandos/seckey.txt</filename
	    ></quote>.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--priority=<replaceable
	>STRING</replaceable></option></term>
	<listitem>
	  <xi:include href="../mandos-options.xml"
		      xpointer="priority"/>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--dh-bits=<replaceable
	>BITS</replaceable></option></term>
	<listitem>
	  <para>
	    Sets the number of bits to use for the prime number in the
	    TLS Diffie-Hellman key exchange.  Default is 1024.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--debug</option></term>
	<listitem>
	  <para>
	    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.
	  </para>
	  <para>
	    It will also enable debug mode in the Avahi and GnuTLS
	    libraries, making them print large amounts of debugging
	    output.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--help</option></term>
	<term><option>-?</option></term>
	<listitem>
	  <para>
	    Gives a help message about options and their meanings.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--usage</option></term>
	<listitem>
	  <para>
	    Gives a short usage message.
	  </para>
	</listitem>
      </varlistentry>
      
      <varlistentry>
	<term><option>--version</option></term>
	<term><option>-V</option></term>
	<listitem>
	  <para>
	    Prints the program version.
	  </para>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
  
  <refsect1 id="overview">
    <title>OVERVIEW</title>
    <xi:include href="../overview.xml"/>
    <para>
      This program is the client part.  It is a plugin started by
      <citerefentry><refentrytitle>plugin-runner</refentrytitle>
      <manvolnum>8mandos</manvolnum></citerefentry> which will run in
      an initial <acronym>RAM</acronym> disk environment.
    </para>
    <para>
      This program could, theoretically, be used as a keyscript in
      <filename>/etc/crypttab</filename>, 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 (<citerefentry>
      <refentrytitle>plugin-runner</refentrytitle>
      <manvolnum>8mandos</manvolnum></citerefentry>) is used to run
      both this program and others in in parallel,
      <emphasis>one</emphasis> of which will prompt for passwords on
      the system console.
    </para>
  </refsect1>
  
  <refsect1 id="exit_status">
    <title>EXIT STATUS</title>
    <para>
      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 new
      <application>Mandos</application> servers as they appear, trying
      to get a decryptable password and print it.
    </para>
  </refsect1>
  
  <refsect1 id="environment">
    <title>ENVIRONMENT</title>
    <para>
      This program does not use any environment variables, not even
      the ones provided by <citerefentry><refentrytitle
      >cryptsetup</refentrytitle><manvolnum>8</manvolnum>
    </citerefentry>.
    </para>
  </refsect1>
  
  <refsect1 id="files">
    <title>FILES</title>
    <variablelist>
      <varlistentry>
	<term><filename>/conf/conf.d/mandos/pubkey.txt</filename
	></term>
	<term><filename>/conf/conf.d/mandos/seckey.txt</filename
	></term>
	<listitem>
	  <para>
	    OpenPGP public and private key files, in <quote>ASCII
	    Armor</quote> format.  These are the default file names,
	    they can be changed with the <option>--pubkey</option> and
	    <option>--seckey</option> options.
	  </para>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
  
<!--   <refsect1 id="bugs"> -->
<!--     <title>BUGS</title> -->
<!--     <para> -->
<!--     </para> -->
<!--   </refsect1> -->
  
  <refsect1 id="example">
    <title>EXAMPLE</title>
    <para>
      Note that normally, command line options will not be given
      directly, but via options for the Mandos <citerefentry
      ><refentrytitle>plugin-runner</refentrytitle>
      <manvolnum>8mandos</manvolnum></citerefentry>.
    </para>
    <informalexample>
      <para>
	Normal invocation needs no options, if the network interface
	is <quote>eth0</quote>:
      </para>
      <para>
	<userinput>&COMMANDNAME;</userinput>
      </para>
    </informalexample>
    <informalexample>
      <para>
	Search for Mandos servers (and connect to them) using another
	interface:
      </para>
      <para>
	<!-- do not wrap this line -->
	<userinput>&COMMANDNAME; --interface eth1</userinput>
      </para>
    </informalexample>
    <informalexample>
      <para>
	Run in debug mode, and use a custom key:
      </para>
      <para>

<!-- do not wrap this line -->
<userinput>&COMMANDNAME; --debug --pubkey keydir/pubkey.txt --seckey keydir/seckey.txt</userinput>

      </para>
    </informalexample>
    <informalexample>
      <para>
	Run in debug mode, with a custom key, and do not use Zeroconf
	to locate a server; connect directly to the IPv6 address
	<quote><systemitem class="ipaddress"
	>2001:db8:f983:bd0b:30de:ae4a:71f2:f672</systemitem></quote>,
	port 4711, using interface eth2:
      </para>
      <para>

<!-- do not wrap this line -->
<userinput>&COMMANDNAME; --debug --pubkey keydir/pubkey.txt --seckey keydir/seckey.txt --connect 2001:db8:f983:bd0b:30de:ae4a:71f2:f672:4711 --interface eth2</userinput>

      </para>
    </informalexample>
  </refsect1>
  
  <refsect1 id="security">
    <title>SECURITY</title>
    <para>
      This program is set-uid to root, but will switch back to the
      original (and presumably non-privileged) user and group after
      bringing up the network interface.
    </para>
    <para>
      To use this program for its intended purpose (see <xref
      linkend="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
      <acronym>RAM</acronym> 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.
    </para>
    <para>
      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 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 <citerefentry><refentrytitle
      >mandos</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
    </para>
    <para>
      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, unlike unencrypted
      <acronym>ICMP</acronym> echo (<quote>ping</quote>) replies.
    </para>
    <para>
      <emphasis>Note</emphasis>: This makes it completely insecure to
      have <application >Mandos</application> clients which dual-boot
      to another operating system which is <emphasis>not</emphasis>
      trusted to keep the initial <acronym>RAM</acronym> disk image
      confidential.
    </para>
  </refsect1>
  
  <refsect1 id="see_also">
    <title>SEE ALSO</title>
    <para>
      <citerefentry><refentrytitle>cryptsetup</refentrytitle>
      <manvolnum>8</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>crypttab</refentrytitle>
      <manvolnum>5</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>mandos</refentrytitle>
      <manvolnum>8</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>password-prompt</refentrytitle>
      <manvolnum>8mandos</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>plugin-runner</refentrytitle>
      <manvolnum>8mandos</manvolnum></citerefentry>
    </para>
    <variablelist>
      <varlistentry>
	<term>
	  <ulink url="http://www.zeroconf.org/">Zeroconf</ulink>
	</term>
	<listitem>
	  <para>
	    Zeroconf is the network protocol standard used for finding
	    Mandos servers on the local network.
	  </para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  <ulink url="http://www.avahi.org/">Avahi</ulink>
	</term>
      <listitem>
	<para>
	  Avahi is the library this program calls to find Zeroconf
	  services.
	</para>
      </listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  <ulink url="http://www.gnu.org/software/gnutls/"
	  >GnuTLS</ulink>
	</term>
      <listitem>
	<para>
	  GnuTLS is the library this client uses to implement TLS for
	  communicating securely with the server, and at the same time
	  send the public OpenPGP key to the server.
	</para>
      </listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  <ulink url="http://www.gnupg.org/related_software/gpgme/"
		 >GPGME</ulink>
	</term>
	<listitem>
	  <para>
	    GPGME is the library used to decrypt the OpenPGP data sent
	    by the server.
	  </para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  RFC 4291: <citetitle>IP Version 6 Addressing
	  Architecture</citetitle>
	</term>
	<listitem>
	  <variablelist>
	    <varlistentry>
	      <term>Section 2.2: <citetitle>Text Representation of
	      Addresses</citetitle></term>
	      <listitem><para/></listitem>
	    </varlistentry>
	    <varlistentry>
	      <term>Section 2.5.5.2: <citetitle>IPv4-Mapped IPv6
	      Address</citetitle></term>
	      <listitem><para/></listitem>
	    </varlistentry>
	    <varlistentry>
	    <term>Section 2.5.6, <citetitle>Link-Local IPv6 Unicast
	    Addresses</citetitle></term>
	    <listitem>
	      <para>
		This client uses IPv6 link-local addresses, which are
		immediately usable since a link-local addresses is
		automatically assigned to a network interfaces when it
		is brought up.
	      </para>
	    </listitem>
	    </varlistentry>
	  </variablelist>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  RFC 4346: <citetitle>The Transport Layer Security (TLS)
	  Protocol Version 1.1</citetitle>
	</term>
      <listitem>
	<para>
	  TLS 1.1 is the protocol implemented by GnuTLS.
	</para>
      </listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  RFC 4880: <citetitle>OpenPGP Message Format</citetitle>
	</term>
      <listitem>
	<para>
	  The data received from the server is binary encrypted
	  OpenPGP data.
	</para>
      </listitem>
      </varlistentry>
      <varlistentry>
	<term>
	  RFC 5081: <citetitle>Using OpenPGP Keys for Transport Layer
	  Security</citetitle>
	</term>
      <listitem>
	<para>
	  This is implemented by GnuTLS and used by this program so
	  that OpenPGP keys can be used.
	</para>
      </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
</refentry>

<!-- Local Variables: -->
<!-- time-stamp-start: "<!ENTITY TIMESTAMP [\"']" -->
<!-- time-stamp-end: "[\"']>" -->
<!-- time-stamp-format: "%:y-%02m-%02d" -->
<!-- End: -->