/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 mandos-clients.conf.xml

  • Committer: teddy at recompile
  • Date: 2020-04-05 21:30:59 UTC
  • Revision ID: teddy@recompile.se-20200405213059-fb2a61ckqynrmatk
Fix file descriptor leak in mandos-client

When the local network has Mandos servers announcing themselves using
real, globally reachable, IPv6 addresses (i.e. not link-local
addresses), but there is no router on the local network providing IPv6
RA (Router Advertisement) packets, the client cannot reach the server
by normal means, since the client only has a link-local IPv6 address,
and has no usable route to reach the server's global IPv6 address.
(This is not a common situation, and usually only happens when the
router itself reboots and runs a Mandos client, since it cannot then
give RA packets to itself.)  The client code has a solution for
this, which consists of adding a temporary local route to reach the
address of the server during communication, and removing this
temporary route afterwards.

This solution with a temporary route works, but has a file descriptor
leak; it leaks one file descriptor for each addition and for each
removal of a route.  If one server requiring an added route is present
on the network, but no servers gives a password, making the client
retry after the default ten seconds, and we furthermore assume a
default 1024 open files limit, the client runs out of file descriptors
after about 90 minutes, after which time the client process will be
useless and fail to retrieve any passwords, necessitating manual
password entry via the keyboard.

Fix this by eliminating the file descriptor leak in the client.

* plugins.d/mandos-client.c (add_delete_local_route): Do
  close(devnull) also in parent process, also if fork() fails, and on
  any failure in child process.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
        "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4
4
<!ENTITY CONFNAME "mandos-clients.conf">
5
5
<!ENTITY CONFPATH "<filename>/etc/mandos/clients.conf</filename>">
6
 
<!ENTITY TIMESTAMP "2016-06-23">
 
6
<!ENTITY TIMESTAMP "2019-02-10">
7
7
<!ENTITY % common SYSTEM "common.ent">
8
8
%common;
9
9
]>
41
41
      <year>2014</year>
42
42
      <year>2015</year>
43
43
      <year>2016</year>
 
44
      <year>2017</year>
 
45
      <year>2018</year>
 
46
      <year>2019</year>
44
47
      <holder>Teddy Hogeborn</holder>
45
48
      <holder>Björn Påhlsson</holder>
46
49
    </copyright>
184
187
            >--</option> %%(host)s</literal></quote>.  Note that
185
188
            <command>mandos-keygen</command>, when generating output
186
189
            to be inserted into this file, normally looks for an SSH
187
 
            server on the Mandos client, and, if it find one, outputs
 
190
            server on the Mandos client, and, if it finds one, outputs
188
191
            a <option>checker</option> option to check for the
189
 
            client’s key fingerprint – this is more secure against
 
192
            client’s SSH key fingerprint – this is more secure against
190
193
            spoofing.
191
194
          </para>
192
195
          <para>
237
240
      </varlistentry>
238
241
      
239
242
      <varlistentry>
 
243
        <term><option>key_id<literal> = </literal
 
244
        ><replaceable>HEXSTRING</replaceable></option></term>
 
245
        <listitem>
 
246
          <para>
 
247
            This option is <emphasis>optional</emphasis>.
 
248
          </para>
 
249
          <para>
 
250
            This option sets the certificate key ID that identifies
 
251
            the public key that clients authenticate themselves with
 
252
            through TLS.  The string needs to be in hexadecimal form,
 
253
            but spaces or upper/lower case are not significant.
 
254
          </para>
 
255
        </listitem>
 
256
      </varlistentry>
 
257
      
 
258
      <varlistentry>
240
259
        <term><option><literal>host = </literal><replaceable
241
260
        >STRING</replaceable></option></term>
242
261
        <listitem>
312
331
          <para>
313
332
            If present, this option must be set to a string of
314
333
            base64-encoded binary data.  It will be decoded and sent
315
 
            to the client matching the above
316
 
            <option>fingerprint</option>.  This should, of course, be
317
 
            OpenPGP encrypted data, decryptable only by the client.
 
334
            to the client matching the above <option>key_id</option>
 
335
            or <option>fingerprint</option>.  This should, of course,
 
336
            be OpenPGP encrypted data, decryptable only by the client.
318
337
            The program <citerefentry><refentrytitle><command
319
338
            >mandos-keygen</command></refentrytitle><manvolnum
320
339
            >8</manvolnum></citerefentry> can, using its
415
434
        <quote><literal>created</literal></quote>,
416
435
        <quote><literal>enabled</literal></quote>,
417
436
        <quote><literal>expires</literal></quote>,
 
437
        <quote><literal>key_id</literal></quote>,
418
438
        <quote><literal>fingerprint</literal></quote>,
419
439
        <quote><literal>host</literal></quote>,
420
440
        <quote><literal>interval</literal></quote>,
477
497
 
478
498
# Client "foo"
479
499
[foo]
 
500
key_id = 788cd77115cd0bb7b2d5e0ae8496f6b48149d5e712c652076b1fd2d957ef7c1f
480
501
fingerprint =  7788 2722 5BA7 DE53 9C5A  7CFA 59CF F7CD BD9A 5920
481
502
secret =
482
503
        hQIOA6QdEjBs2L/HEAf/TCyrDe5Xnm9esa+Pb/vWF9CUqfn4srzVgSu234
499
520
 
500
521
# Client "bar"
501
522
[bar]
 
523
key_id = F90C7A81D72D1EA69A51031A91FF8885F36C8B46D155C8C58709A4C99AE9E361
502
524
fingerprint = 3e393aeaefb84c7e89e2f547b3a107558fca3a27
503
525
secfile = /etc/mandos/bar-secret
504
526
timeout = PT15M