/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 dracut-module/password-agent.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:
2
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3
3
        "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4
4
<!ENTITY COMMANDNAME "password-agent">
5
 
<!ENTITY TIMESTAMP "2021-02-03">
 
5
<!ENTITY TIMESTAMP "2019-11-13">
6
6
<!ENTITY % common SYSTEM "../common.ent">
7
7
%common;
8
8
]>
32
32
    </authorgroup>
33
33
    <copyright>
34
34
      <year>2019</year>
35
 
      <year>2020</year>
36
35
      <holder>Teddy Hogeborn</holder>
37
36
      <holder>Björn Påhlsson</holder>
38
37
    </copyright>
114
113
      be a <citerefentry><refentrytitle>systemd</refentrytitle>
115
114
      <manvolnum>1</manvolnum></citerefentry> <quote>Password
116
115
      Agent</quote> (See <ulink
117
 
      url="https://systemd.io/PASSWORD_AGENTS/">Password
118
 
      Agents</ulink>).  The aim of this program is therefore to
119
 
      acquire and then send a password to some other program which
 
116
      url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
117
      >Password Agents</ulink>).  The aim of this program is therefore
 
118
      to acquire and then send a password to some other program which
120
119
      will use the password to unlock the encrypted root disk.
121
120
    </para>
122
121
    <para>
147
146
            Specify a different agent directory.  The default is
148
147
            <quote><filename class="directory"
149
148
            >/run/systemd/ask-password</filename ></quote> as per the
150
 
            <ulink url="https://systemd.io/PASSWORD_AGENTS/">Password
151
 
            Agents</ulink> specification.
 
149
            <ulink
 
150
            url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
151
            >Password Agents</ulink> specification.
152
152
          </para>
153
153
        </listitem>
154
154
      </varlistentry>
270
270
      responsible for getting a password from the Mandos client
271
271
      program itself, and to send that password to whatever is
272
272
      currently asking for a password using the systemd <ulink
273
 
      url="https://systemd.io/PASSWORD_AGENTS/">Password
274
 
      Agents</ulink> mechanism.
 
273
      url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
274
      >Password Agents</ulink> mechanism.
275
275
    </para>
276
276
    <para>To accomplish this, &COMMANDNAME; runs the
277
277
    <command>mandos-client</command> program (which is the actual
281
281
    password is acquired from the
282
282
    <replaceable>MANDOS_CLIENT</replaceable> program, sends that
283
283
    password (as per the <ulink
284
 
    url="https://systemd.io/PASSWORD_AGENTS/">Password Agents</ulink>
285
 
    specification) to all currently unanswered password questions.
 
284
    url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
285
    >Password Agents</ulink> specification) to all currently
 
286
    unanswered password questions.
286
287
    </para>
287
288
    <para>
288
289
      This program should be started (normally as a systemd service,
329
330
            <para>
330
331
              The default directory to watch for password questions as
331
332
              per the <ulink
332
 
              url="https://systemd.io/PASSWORD_AGENTS/">Password
333
 
              Agents</ulink> specification; can be changed by the
334
 
              <option>--agent-directory</option> option.
 
333
              url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
334
              >Password Agents</ulink> specification; can be changed
 
335
              by the <option>--agent-directory</option> option.
335
336
            </para>
336
337
          </listitem>
337
338
        </varlistentry>
445
446
    <variablelist>
446
447
      <varlistentry>
447
448
        <term>
448
 
          <ulink url="https://systemd.io/PASSWORD_AGENTS/">Password
449
 
          Agents</ulink>
 
449
          <ulink
 
450
              url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
 
451
              >Password Agents</ulink>
450
452
        </term>
451
453
        <listitem>
452
454
          <para>