/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 intro.xml

  • Committer: teddy at recompile
  • Date: 2020-02-09 03:38:33 UTC
  • Revision ID: teddy@recompile.se-20200209033833-2la1pujrnv2m0so4
Use reallocarray() if available, or check for overflow

* dracut-module/password-agent.c (add_to_queue): Check for overflow.
  (test_add_to_queue_overflow): New test.
* plugin-runner.c (add_to_char_array, main): Use reallocarray().
* plugins.d/plymouth.c (exec_and_wait): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
 
3
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
4
<!ENTITY TIMESTAMP "2019-08-04">
 
5
<!ENTITY % common SYSTEM "common.ent">
 
6
%common;
 
7
]>
 
8
 
 
9
<refentry xmlns:xi="http://www.w3.org/2001/XInclude">
 
10
   <refentryinfo>
 
11
    <title>Mandos Manual</title>
 
12
    <!-- NWalsh’s docbook scripts use this to generate the footer: -->
 
13
    <productname>Mandos</productname>
 
14
    <productnumber>&version;</productnumber>
 
15
    <date>&TIMESTAMP;</date>
 
16
    <authorgroup>
 
17
      <author>
 
18
        <firstname>Björn</firstname>
 
19
        <surname>Påhlsson</surname>
 
20
        <address>
 
21
          <email>belorn@recompile.se</email>
 
22
        </address>
 
23
      </author>
 
24
      <author>
 
25
        <firstname>Teddy</firstname>
 
26
        <surname>Hogeborn</surname>
 
27
        <address>
 
28
          <email>teddy@recompile.se</email>
 
29
        </address>
 
30
      </author>
 
31
    </authorgroup>
 
32
    <copyright>
 
33
      <year>2011</year>
 
34
      <year>2012</year>
 
35
      <year>2013</year>
 
36
      <year>2014</year>
 
37
      <year>2015</year>
 
38
      <year>2016</year>
 
39
      <year>2017</year>
 
40
      <year>2018</year>
 
41
      <year>2019</year>
 
42
      <holder>Teddy Hogeborn</holder>
 
43
      <holder>Björn Påhlsson</holder>
 
44
    </copyright>
 
45
    <xi:include href="legalnotice.xml"/>
 
46
  </refentryinfo>
 
47
  
 
48
  <refmeta>
 
49
    <refentrytitle>intro</refentrytitle>
 
50
    <manvolnum>8mandos</manvolnum>
 
51
  </refmeta>
 
52
  
 
53
  <refnamediv>
 
54
    <refname>intro</refname>
 
55
    <refpurpose>
 
56
      Introduction to the Mandos system
 
57
    </refpurpose>
 
58
  </refnamediv>
 
59
  
 
60
  <refsect1 id="description">
 
61
    <title>DESCRIPTION</title>
 
62
    <para>
 
63
      This is the the Mandos system, which allows computers to have
 
64
      encrypted root file systems and at the same time be capable of
 
65
      remote and/or unattended reboots.
 
66
    </para>
 
67
    <para>
 
68
      The computers run a small client program in the initial RAM disk
 
69
      environment which will communicate with a server over a network.
 
70
      All network communication is encrypted using TLS.  The clients
 
71
      are identified by the server using a TLS public key; each client
 
72
      has one unique to it.  The server sends the clients an encrypted
 
73
      password.  The encrypted password is decrypted by the clients
 
74
      using a separate OpenPGP key, and the password is then used to
 
75
      unlock the root file system, whereupon the computers can
 
76
      continue booting normally.
 
77
    </para>
 
78
  </refsect1>
 
79
  
 
80
  <refsect1 id="introduction">
 
81
    <title>INTRODUCTION</title>
 
82
    <para>
 
83
      <!-- This paragraph is a combination and paraphrase of two
 
84
           quotes from the 1995 movie “The Usual Suspects”. -->
 
85
      You know how it is.  You’ve heard of it happening.  The Man
 
86
      comes and takes away your servers, your friends’ servers, the
 
87
      servers of everybody in the same hosting facility. The servers
 
88
      of their neighbors, and their neighbors’ friends.  The servers
 
89
      of people who owe them money.  And like
 
90
      <emphasis>that</emphasis>, they’re gone.  And you doubt you’ll
 
91
      ever see them again.
 
92
    </para>
 
93
    <para>
 
94
      That is why your servers have encrypted root file systems.
 
95
      However, there’s a downside.  There’s no going around it:
 
96
      rebooting is a pain.  Dragging out that rarely-used keyboard and
 
97
      screen and unraveling cables behind your servers to plug them in
 
98
      to type in that password is messy, especially if you have many
 
99
      servers.  There are some people who do clever things like using
 
100
      serial line consoles and daisy-chain it to the next server, and
 
101
      keep all the servers connected in a ring with serial cables,
 
102
      which will work, if your servers are physically close enough.
 
103
      There are also other out-of-band management solutions, but with
 
104
      <emphasis>all</emphasis> these, you still have to be on hand and
 
105
      manually type in the password at boot time.  Otherwise the
 
106
      server just sits there, waiting for a password.
 
107
    </para>
 
108
    <para>
 
109
      Wouldn’t it be great if you could have the security of encrypted
 
110
      root file systems and still have servers that could boot up
 
111
      automatically if there was a short power outage while you were
 
112
      asleep?  That you could reboot at will, without having someone
 
113
      run over to the server to type in the password?
 
114
    </para>
 
115
    <para>
 
116
      Well, with Mandos, you (almost) can!  The gain in convenience
 
117
      will only be offset by a small loss in security.  The setup is
 
118
      as follows:
 
119
    </para>
 
120
    <para>
 
121
      The server will still have its encrypted root file system.  The
 
122
      password to this file system will be stored on another computer
 
123
      (henceforth known as the Mandos server) on the same local
 
124
      network.  The password will <emphasis>not</emphasis> be stored
 
125
      in plaintext, but encrypted with OpenPGP.  To decrypt this
 
126
      password, a key is needed.  This key (the Mandos client key)
 
127
      will not be stored there, but back on the original server
 
128
      (henceforth known as the Mandos client) in the initial RAM disk
 
129
      image.  Oh, and all network Mandos client/server communications
 
130
      will be encrypted, using TLS (SSL).
 
131
    </para>
 
132
    <para>
 
133
      So, at boot time, the Mandos client will ask for its encrypted
 
134
      data over the network, decrypt the data to get the password, use
 
135
      the password to decrypt the root file system, and the client can
 
136
      then continue booting.
 
137
    </para>
 
138
    <para>
 
139
      Now, of course the initial RAM disk image is not on the
 
140
      encrypted root file system, so anyone who had physical access
 
141
      could take the Mandos client computer offline and read the disk
 
142
      with their own tools to get the authentication keys used by a
 
143
      client.  <emphasis>But</emphasis>, by then the Mandos server
 
144
      should notice that the original server has been offline for too
 
145
      long, and will no longer give out the encrypted key.  The timing
 
146
      here is the only real weak point, and the method, frequency and
 
147
      timeout of the server’s checking can be adjusted to any desired
 
148
      level of paranoia.
 
149
    </para>
 
150
    <para>
 
151
      (The encrypted keys on the Mandos server is on its normal file
 
152
      system, so those are safe, provided the root file system of
 
153
      <emphasis>that</emphasis> server is encrypted.)
 
154
    </para>
 
155
  </refsect1>
 
156
  
 
157
  <refsect1 id="faq">
 
158
    <title>FREQUENTLY ASKED QUESTIONS</title>
 
159
    <para>
 
160
      Couldn’t the security be defeated by…
 
161
    </para>
 
162
    <refsect2 id="quick">
 
163
      <title>Grabbing the Mandos client key from the
 
164
      initrd <emphasis>really quickly</emphasis>?</title>
 
165
    <para>
 
166
      This, as mentioned above, is the only real weak point.  But if
 
167
      you set the timing values tight enough, this will be really
 
168
      difficult to do.  An attacker would have to physically
 
169
      disassemble the client computer, extract the key from the
 
170
      initial RAM disk image, and then connect to a <emphasis>still
 
171
      online</emphasis> Mandos server to get the encrypted key, and do
 
172
      all this <emphasis>before</emphasis> the Mandos server timeout
 
173
      kicks in and the Mandos server refuses to give out the key to
 
174
      anyone.
 
175
    </para>
 
176
    <para>
 
177
      Now, as the typical procedure seems to be to barge in and turn
 
178
      off and grab <emphasis>all</emphasis> computers, to maybe look
 
179
      at them months later, this is not likely.  If someone does that,
 
180
      the whole system <emphasis>will</emphasis> lock itself up
 
181
      completely, since Mandos servers are no longer running.
 
182
    </para>
 
183
    <para>
 
184
      For sophisticated attackers who <emphasis>could</emphasis> do
 
185
      the clever thing, <emphasis>and</emphasis> had physical access
 
186
      to the server for enough time, it would be simpler to get a key
 
187
      for an encrypted file system by using hardware memory scanners
 
188
      and reading it right off the memory bus.
 
189
    </para>
 
190
    </refsect2>
 
191
    
 
192
    <refsect2 id="replay">
 
193
      <title>Replay attacks?</title>
 
194
      <para>
 
195
        Nope, the network stuff is all done over TLS, which provides
 
196
        protection against that.
 
197
      </para>
 
198
    </refsect2>
 
199
    
 
200
    <refsect2 id="mitm">
 
201
      <title>Man-in-the-middle?</title>
 
202
      <para>
 
203
        No.  The server only gives out the passwords to clients which
 
204
        have <emphasis>in the TLS handshake</emphasis> proven that
 
205
        they do indeed hold the private key corresponding to that
 
206
        client.
 
207
      </para>
 
208
    </refsect2>
 
209
    
 
210
    <refsect2 id="sniff">
 
211
      <title>How about sniffing the network traffic and decrypting it
 
212
      later by physically grabbing the Mandos client and using its
 
213
      key?</title>
 
214
      <para>
 
215
        We only use <acronym>PFS</acronym> (Perfect Forward Security)
 
216
        key exchange algorithms in TLS, which protects against this.
 
217
      </para>
 
218
    </refsect2>
 
219
    
 
220
    <refsect2 id="physgrab">
 
221
      <title>Physically grabbing the Mandos server computer?</title>
 
222
      <para>
 
223
        You could protect <emphasis>that</emphasis> computer the
 
224
        old-fashioned way, with a must-type-in-the-password-at-boot
 
225
        method.  Or you could have two computers be the Mandos server
 
226
        for each other.
 
227
      </para>
 
228
      <para>
 
229
        Multiple Mandos servers can coexist on a network without any
 
230
        trouble.  They do not clash, and clients will try all
 
231
        available servers.  This means that if just one reboots then
 
232
        the other can bring it back up, but if both reboot at the same
 
233
        time they will stay down until someone types in the password
 
234
        on one of them.
 
235
      </para>
 
236
    </refsect2>
 
237
    
 
238
    <refsect2 id="fakecheck">
 
239
      <title>Faking checker results?</title>
 
240
      <para>
 
241
        If the Mandos client does not have an SSH server, the default
 
242
        is for the Mandos server to use
 
243
        <quote><literal>fping</literal></quote>, the replies to which
 
244
        could be faked to eliminate the timeout.  But this could
 
245
        easily be changed to any shell command, with any security
 
246
        measures you like.  If the Mandos client
 
247
        <emphasis>has</emphasis> an SSH server, the default
 
248
        configuration (as generated by
 
249
        <command>mandos-keygen</command> with the
 
250
        <option>--password</option> option) is for the Mandos server
 
251
        to use an <command>ssh-keyscan</command> command with strict
 
252
        keychecking, which can not be faked.  Alternatively, IPsec
 
253
        could be used for the ping packets, making them secure.
 
254
      </para>
 
255
    </refsect2>
 
256
  </refsect1>
 
257
  
 
258
  <refsect1 id="security">
 
259
    <title>SECURITY</title>
 
260
    <para>
 
261
      So, in summary:  The only weakness in the Mandos system is from
 
262
      people who have:
 
263
    </para>
 
264
    <orderedlist>
 
265
      <listitem>
 
266
        <para>
 
267
          The power to come in and physically take your servers,
 
268
          <emphasis>and</emphasis>
 
269
        </para>
 
270
      </listitem>
 
271
      <listitem>
 
272
        <para>
 
273
          The cunning and patience to do it carefully, one at a time,
 
274
          and <emphasis>quickly</emphasis>, faking Mandos
 
275
          client/server responses for each one before the timeout.
 
276
        </para>
 
277
      </listitem>
 
278
    </orderedlist>
 
279
    <para>
 
280
      While there are some who may be threatened by people who have
 
281
      <emphasis>both</emphasis> these attributes, they do not,
 
282
      probably, constitute the majority.
 
283
    </para>
 
284
    <para>
 
285
      If you <emphasis>do</emphasis> face such opponents, you must
 
286
      figure that they could just as well open your servers and read
 
287
      the file system keys right off the memory by running wires to
 
288
      the memory bus.
 
289
    </para>
 
290
    <para>
 
291
      What Mandos is designed to protect against is
 
292
      <emphasis>not</emphasis> such determined, focused, and competent
 
293
      attacks, but against the early morning knock on your door and
 
294
      the sudden absence of all the servers in your server room.
 
295
      Which it does nicely.
 
296
    </para>
 
297
  </refsect1>
 
298
  
 
299
  <refsect1 id="plugins">
 
300
    <title>PLUGINS</title>
 
301
    <para>
 
302
      In the early designs, the
 
303
      <citerefentry><refentrytitle>mandos-client</refentrytitle
 
304
      ><manvolnum>8mandos</manvolnum></citerefentry> program (which
 
305
      retrieves a password from the Mandos server) also prompted for a
 
306
      password on the terminal, in case a Mandos server could not be
 
307
      found.  Other ways of retrieving a password could easily be
 
308
      envisoned, but this multiplicity of purpose was seen to be too
 
309
      complex to be a viable way to continue.  Instead, the original
 
310
      program was separated into <citerefentry><refentrytitle
 
311
      >mandos-client</refentrytitle><manvolnum>8mandos</manvolnum
 
312
      ></citerefentry> and <citerefentry><refentrytitle
 
313
      >password-prompt</refentrytitle><manvolnum>8mandos</manvolnum
 
314
      ></citerefentry>, and a <citerefentry><refentrytitle
 
315
      >plugin-runner</refentrytitle><manvolnum>8mandos</manvolnum
 
316
      ></citerefentry> exist to run them both in parallel, allowing
 
317
      the first successful plugin to provide the password.  This
 
318
      opened up for any number of additional plugins to run, all
 
319
      competing to be the first to find a password and provide it to
 
320
      the plugin runner.
 
321
    </para>
 
322
    <para>
 
323
      Four additional plugins are provided:
 
324
    </para>
 
325
    <variablelist>
 
326
      <varlistentry>
 
327
        <term>
 
328
          <citerefentry><refentrytitle>plymouth</refentrytitle>
 
329
          <manvolnum>8mandos</manvolnum></citerefentry>
 
330
        </term>
 
331
        <listitem>
 
332
          <para>
 
333
            This prompts for a password when using <citerefentry>
 
334
            <refentrytitle>plymouth</refentrytitle><manvolnum
 
335
            >8</manvolnum></citerefentry>.
 
336
          </para>
 
337
        </listitem>
 
338
      </varlistentry>
 
339
      <varlistentry>
 
340
        <term>
 
341
          <citerefentry><refentrytitle>usplash</refentrytitle>
 
342
          <manvolnum>8mandos</manvolnum></citerefentry>
 
343
        </term>
 
344
        <listitem>
 
345
          <para>
 
346
            This prompts for a password when using <citerefentry>
 
347
            <refentrytitle>usplash</refentrytitle><manvolnum
 
348
            >8</manvolnum></citerefentry>.
 
349
          </para>
 
350
        </listitem>
 
351
      </varlistentry>
 
352
      <varlistentry>
 
353
        <term>
 
354
          <citerefentry><refentrytitle>splashy</refentrytitle>
 
355
          <manvolnum>8mandos</manvolnum></citerefentry>
 
356
        </term>
 
357
        <listitem>
 
358
          <para>
 
359
            This prompts for a password when using <citerefentry>
 
360
            <refentrytitle>splashy</refentrytitle><manvolnum
 
361
            >8</manvolnum></citerefentry>.
 
362
          </para>
 
363
        </listitem>
 
364
      </varlistentry>
 
365
      <varlistentry>
 
366
        <term>
 
367
          <citerefentry><refentrytitle>askpass-fifo</refentrytitle>
 
368
          <manvolnum>8mandos</manvolnum></citerefentry>
 
369
        </term>
 
370
        <listitem>
 
371
          <para>
 
372
            To provide compatibility with the "askpass" program from
 
373
            cryptsetup, this plugin listens to the same FIFO as
 
374
            askpass would do.
 
375
          </para>
 
376
        </listitem>
 
377
      </varlistentry>
 
378
    </variablelist>
 
379
    <para>
 
380
      More plugins can easily be written and added by the system
 
381
      administrator; see the section called "WRITING PLUGINS" in
 
382
      <citerefentry><refentrytitle>plugin-runner</refentrytitle>
 
383
      <manvolnum>8mandos</manvolnum></citerefentry> to learn the
 
384
      plugin requirements.
 
385
    </para>
 
386
  </refsect1>
 
387
 
 
388
  <refsect1 id="systemd">
 
389
    <title>SYSTEMD</title>
 
390
    <para>
 
391
      More advanced startup systems like <citerefentry><refentrytitle
 
392
      >systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
 
393
      already have their own plugin-like mechanisms for allowing
 
394
      multiple agents to independently retrieve a password and deliver
 
395
      it to the subsystem requesting a password to unlock the root
 
396
      file system.  On these systems, it would make no sense to run
 
397
      <citerefentry><refentrytitle>plugin-runner</refentrytitle
 
398
      ><manvolnum>8mandos</manvolnum></citerefentry>, the plugins of
 
399
      which would largely duplicate the work of (and conflict with)
 
400
      the existing systems prompting for passwords.
 
401
    </para>
 
402
    <para>
 
403
      As for <citerefentry><refentrytitle>systemd</refentrytitle
 
404
      ><manvolnum>1</manvolnum></citerefentry> in particular, it has
 
405
      its own <ulink
 
406
      url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
407
      >Password Agents</ulink> system.  Mandos uses this via its
 
408
      <citerefentry><refentrytitle>password-agent</refentrytitle
 
409
      ><manvolnum>8mandos</manvolnum></citerefentry> program, which
 
410
      is run instead of <citerefentry><refentrytitle
 
411
      >plugin-runner</refentrytitle><manvolnum>8mandos</manvolnum
 
412
      ></citerefentry> when <citerefentry><refentrytitle
 
413
      >systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
 
414
      is used during system startup.
 
415
    </para>
 
416
  </refsect1>
 
417
  <refsect1 id="bugs">
 
418
    <title>BUGS</title>
 
419
    <xi:include href="bugs.xml"/>
 
420
  </refsect1>
 
421
  
 
422
  <refsect1 id="see_also">
 
423
    <title>SEE ALSO</title>
 
424
    <para>
 
425
      <citerefentry><refentrytitle>mandos</refentrytitle>
 
426
      <manvolnum>8</manvolnum></citerefentry>,
 
427
      <citerefentry><refentrytitle>mandos.conf</refentrytitle>
 
428
      <manvolnum>5</manvolnum></citerefentry>,
 
429
      <citerefentry><refentrytitle>mandos-clients.conf</refentrytitle>
 
430
      <manvolnum>5</manvolnum></citerefentry>,
 
431
      <citerefentry><refentrytitle>mandos-ctl</refentrytitle>
 
432
      <manvolnum>8</manvolnum></citerefentry>,
 
433
      <citerefentry><refentrytitle>mandos-monitor</refentrytitle>
 
434
      <manvolnum>8</manvolnum></citerefentry>,
 
435
      <citerefentry><refentrytitle>plugin-runner</refentrytitle>
 
436
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
437
      <citerefentry><refentrytitle>password-agent</refentrytitle>
 
438
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
439
      <citerefentry><refentrytitle>mandos-client</refentrytitle>
 
440
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
441
      <citerefentry><refentrytitle>password-prompt</refentrytitle>
 
442
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
443
      <citerefentry><refentrytitle>plymouth</refentrytitle>
 
444
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
445
      <citerefentry><refentrytitle>usplash</refentrytitle>
 
446
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
447
      <citerefentry><refentrytitle>splashy</refentrytitle>
 
448
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
449
      <citerefentry><refentrytitle>askpass-fifo</refentrytitle>
 
450
      <manvolnum>8mandos</manvolnum></citerefentry>,
 
451
      <citerefentry><refentrytitle>mandos-keygen</refentrytitle>
 
452
      <manvolnum>8</manvolnum></citerefentry>
 
453
    </para>
 
454
    <variablelist>
 
455
      <varlistentry>
 
456
        <term>
 
457
          <ulink url="https://www.recompile.se/mandos">Mandos</ulink>
 
458
        </term>
 
459
        <listitem>
 
460
          <para>
 
461
            The Mandos home page.
 
462
          </para>
 
463
        </listitem>
 
464
      </varlistentry>
 
465
    </variablelist>
 
466
  </refsect1>
 
467
</refentry>
 
468
<!-- Local Variables: -->
 
469
<!-- time-stamp-start: "<!ENTITY TIMESTAMP [\"']" -->
 
470
<!-- time-stamp-end: "[\"']>" -->
 
471
<!-- time-stamp-format: "%:y-%02m-%02d" -->
 
472
<!-- End: -->