/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 plugins.d/mandos-client.xml

  • Committer: Teddy Hogeborn
  • Date: 2012-06-13 22:06:57 UTC
  • mto: This revision was merged to the branch mainline in revision 596.
  • Revision ID: teddy@recompile.se-20120613220657-qvq7c7nrndl3t413
* plugins.d/mandos-client.c (get_flags): Don't clobber errno.
  (up_interface): Removed; replaced with "interface_is_up".
  (interface_is_up, interface_is_running,
   lower_privileges_permanently, take_down_interface): New.
  (bring_up_interface): Return "error_t".  Use new functions
                        "interface_is_up", "get_flags", and
                        "interface_is_running".
  (main): Save all interfaces either autodetected or specified with
          --interface in argz vector "interfaces".  Save interfaces to
          take down on exit in argz vector "interfaces_to_take_down".
          Save interface names for DEVICE variable to network hooks as
          argz_vector "interfaces_hooks".  Bug fix: Be privileged
          while stopping network hooks.
* plugins.d/mandos-client.xml (SYNOPSIS): Changed --interface synopsis.
  (DESCRIPTION): Updated to document use of all interfaces.
  (OPTIONS): Updated description of "--interface".
* network-hooks.d/bridge: Parse comma-separated DEVICE environment
                          variable.
* network-hooks.d/openvpn: - '' -
* network-hooks.d/wireless: - '' -

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 "mandos-client">
5
 
<!ENTITY TIMESTAMP "2011-10-03">
 
5
<!ENTITY TIMESTAMP "2012-06-13">
6
6
<!ENTITY % common SYSTEM "../common.ent">
7
7
%common;
8
8
]>
33
33
    <copyright>
34
34
      <year>2008</year>
35
35
      <year>2009</year>
36
 
      <year>2011</year>
 
36
      <year>2012</year>
37
37
      <holder>Teddy Hogeborn</holder>
38
38
      <holder>Björn Påhlsson</holder>
39
39
    </copyright>
64
64
        ><replaceable>PORT</replaceable></option></arg>
65
65
      </group>
66
66
      <sbr/>
67
 
      <group>
 
67
      <group rep='repeat'>
68
68
        <arg choice="plain"><option>--interface
69
 
        <replaceable>NAME</replaceable></option></arg>
70
 
        <arg choice="plain"><option>-i
71
 
        <replaceable>NAME</replaceable></option></arg>
 
69
        <replaceable>NAME</replaceable><arg rep='repeat'
 
70
        >,<replaceable>NAME</replaceable></arg></option></arg>
 
71
        <arg choice="plain"><option>-i <replaceable>NAME</replaceable
 
72
        ><arg rep='repeat'>,<replaceable>NAME</replaceable></arg
 
73
        ></option></arg>
72
74
      </group>
73
75
      <sbr/>
74
76
      <group>
102
104
      </arg>
103
105
      <sbr/>
104
106
      <arg>
 
107
        <option>--network-hook-dir
 
108
        <replaceable>DIR</replaceable></option>
 
109
      </arg>
 
110
      <sbr/>
 
111
      <arg>
105
112
        <option>--debug</option>
106
113
      </arg>
107
114
    </cmdsynopsis>
132
139
      communicates with <citerefentry><refentrytitle
133
140
      >mandos</refentrytitle><manvolnum>8</manvolnum></citerefentry>
134
141
      to get a password.  In slightly more detail, this client program
135
 
      brings up a network interface, uses the interface’s IPv6
136
 
      link-local address to get network connectivity, uses Zeroconf to
137
 
      find servers on the local network, and communicates with servers
138
 
      using TLS with an OpenPGP key to ensure authenticity and
 
142
      brings up network interfaces, uses the interfaces’ IPv6
 
143
      link-local addresses to get network connectivity, uses Zeroconf
 
144
      to find servers on the local network, and communicates with
 
145
      servers using TLS with an OpenPGP key to ensure authenticity and
139
146
      confidentiality.  This client program keeps running, trying all
140
147
      servers on the network, until it receives a satisfactory reply
141
148
      or a TERM signal.  After all servers have been tried, all
143
150
      will wait indefinitely for new servers to appear.
144
151
    </para>
145
152
    <para>
 
153
      The network interfaces are selected like this: If any interfaces
 
154
      are specified using the <option>--interface</option> option,
 
155
      those interface are used.  Otherwise,
 
156
      <command>&COMMANDNAME;</command> will use all interfaces that
 
157
      are not loopback interfaces, are not point-to-point interfaces,
 
158
      are capable of broadcasting and do not have the NOARP flag (see
 
159
      <citerefentry><refentrytitle>netdevice</refentrytitle>
 
160
      <manvolnum>7</manvolnum></citerefentry>).  (If the
 
161
      <option>--connect</option> option is used, point-to-point
 
162
      interfaces and non-broadcast interfaces are accepted.)  If any
 
163
      used interfaces are not up and running, they are first taken up
 
164
      (and later taken down again on program exit).
 
165
    </para>
 
166
    <para>
 
167
      Before network interfaces are selected, all <quote>network
 
168
      hooks</quote> are run; see <xref linkend="network-hooks"/>.
 
169
    </para>
 
170
    <para>
146
171
      This program is not meant to be run directly; it is really meant
147
172
      to run as a plugin of the <application>Mandos</application>
148
173
      <citerefentry><refentrytitle>plugin-runner</refentrytitle>
206
231
        <replaceable>NAME</replaceable></option></term>
207
232
        <listitem>
208
233
          <para>
209
 
            Network interface that will be brought up and scanned for
210
 
            Mandos servers to connect to.  The default is the empty
211
 
            string, which will automatically choose an appropriate
212
 
            interface.
 
234
            Comma separated list of network interfaces that will be
 
235
            brought up and scanned for Mandos servers to connect to.
 
236
            The default is the empty string, which will automatically
 
237
            use all appropriate interfaces.
213
238
          </para>
214
239
          <para>
215
240
            If the <option>--connect</option> option is used, this
220
245
            Note that since this program will normally run in the
221
246
            initial RAM disk environment, the interface must be an
222
247
            interface which exists at that stage.  Thus, the interface
223
 
            can not be a pseudo-interface such as <quote>br0</quote>
224
 
            or <quote>tun0</quote>; such interfaces will not exist
225
 
            until much later in the boot process, and can not be used
226
 
            by this program.
 
248
            can normally not be a pseudo-interface such as
 
249
            <quote>br0</quote> or <quote>tun0</quote>; such interfaces
 
250
            will not exist until much later in the boot process, and
 
251
            can not be used by this program, unless created by a
 
252
            <quote>network hook</quote> — see <xref
 
253
            linkend="network-hooks"/>.
227
254
          </para>
228
255
          <para>
229
256
            <replaceable>NAME</replaceable> can be the string
288
315
        >SECONDS</replaceable></option></term>
289
316
        <listitem>
290
317
          <para>
291
 
            After bringing the network interface up, the program waits
 
318
            After bringing a network interface up, the program waits
292
319
            for the interface to arrive in a <quote>running</quote>
293
320
            state before proceeding.  During this time, the kernel log
294
321
            level will be lowered to reduce clutter on the system
311
338
          </para>
312
339
        </listitem>
313
340
      </varlistentry>
 
341
 
 
342
      <varlistentry>
 
343
        <term><option>--network-hook-dir=<replaceable
 
344
        >DIR</replaceable></option></term>
 
345
        <listitem>
 
346
          <para>
 
347
            Network hook directory.  The default directory is
 
348
            <quote><filename class="directory"
 
349
            >/lib/mandos/network-hooks.d</filename></quote>.
 
350
          </para>
 
351
        </listitem>
 
352
      </varlistentry>
314
353
      
315
354
      <varlistentry>
316
355
        <term><option>--debug</option></term>
377
416
      <refentrytitle>plugin-runner</refentrytitle>
378
417
      <manvolnum>8mandos</manvolnum></citerefentry>) is used to run
379
418
      both this program and others in in parallel,
380
 
      <emphasis>one</emphasis> of which will prompt for passwords on
381
 
      the system console.
 
419
      <emphasis>one</emphasis> of which (<citerefentry>
 
420
      <refentrytitle>password-prompt</refentrytitle>
 
421
      <manvolnum>8mandos</manvolnum></citerefentry>) will prompt for
 
422
      passwords on the system console.
382
423
    </para>
383
424
  </refsect1>
384
425
  
405
446
    </para>
406
447
  </refsect1>
407
448
  
 
449
  <refsect1 id="network-hooks">
 
450
    <title>NETWORK HOOKS</title>
 
451
    <para>
 
452
      If a network interface like a bridge or tunnel is required to
 
453
      find a Mandos server, this requires the interface to be up and
 
454
      running before <command>&COMMANDNAME;</command> starts looking
 
455
      for Mandos servers.  This can be accomplished by creating a
 
456
      <quote>network hook</quote> program, and placing it in a special
 
457
      directory.
 
458
    </para>
 
459
    <para>
 
460
      Before the network is used (and again before program exit), any
 
461
      runnable programs found in the network hook directory are run
 
462
      with the argument <quote><literal>start</literal></quote> or
 
463
      <quote><literal>stop</literal></quote>.  This should bring up or
 
464
      down, respectively, any network interface which
 
465
      <command>&COMMANDNAME;</command> should use.
 
466
    </para>
 
467
    <refsect2 id="hook-requirements">
 
468
      <title>REQUIREMENTS</title>
 
469
      <para>
 
470
        A network hook must be an executable file, and its name must
 
471
        consist entirely of upper and lower case letters, digits,
 
472
        underscores, periods, and hyphens.
 
473
      </para>
 
474
      <para>
 
475
        A network hook will receive one argument, which can be one of
 
476
        the following:
 
477
      </para>
 
478
      <variablelist>
 
479
        <varlistentry>
 
480
          <term><literal>start</literal></term>
 
481
          <listitem>
 
482
            <para>
 
483
              This should make the network hook create (if necessary)
 
484
              and bring up a network interface.
 
485
            </para>
 
486
          </listitem>
 
487
        </varlistentry>
 
488
        <varlistentry>
 
489
          <term><literal>stop</literal></term>
 
490
          <listitem>
 
491
            <para>
 
492
              This should make the network hook take down a network
 
493
              interface, and delete it if it did not exist previously.
 
494
            </para>
 
495
          </listitem>
 
496
        </varlistentry>
 
497
        <varlistentry>
 
498
          <term><literal>files</literal></term>
 
499
          <listitem>
 
500
            <para>
 
501
              This should make the network hook print, <emphasis>one
 
502
              file per line</emphasis>, all the files needed for it to
 
503
              run.  (These files will be copied into the initial RAM
 
504
              filesystem.)  Typical use is for a network hook which is
 
505
              a shell script to print its needed binaries.
 
506
            </para>
 
507
            <para>
 
508
              It is not necessary to print any non-executable files
 
509
              already in the network hook directory, these will be
 
510
              copied implicitly if they otherwise satisfy the name
 
511
              requirement.
 
512
            </para>
 
513
          </listitem>
 
514
        </varlistentry>
 
515
        <varlistentry>
 
516
          <term><literal>modules</literal></term>
 
517
          <listitem>
 
518
            <para>
 
519
              This should make the network hook print, <emphasis>on
 
520
              separate lines</emphasis>, all the kernel modules needed
 
521
              for it to run.  (These modules will be copied into the
 
522
              initial RAM filesystem.)  For instance, a tunnel
 
523
              interface needs the
 
524
              <quote><literal>tun</literal></quote> module.
 
525
            </para>
 
526
          </listitem>
 
527
        </varlistentry>
 
528
      </variablelist>
 
529
      <para>
 
530
        The network hook will be provided with a number of environment
 
531
        variables:
 
532
      </para>
 
533
      <variablelist>
 
534
        <varlistentry>
 
535
          <term><envar>MANDOSNETHOOKDIR</envar></term>
 
536
          <listitem>
 
537
            <para>
 
538
              The network hook directory, specified to
 
539
              <command>&COMMANDNAME;</command> by the
 
540
              <option>--network-hook-dir</option> option.  Note: this
 
541
              should <emphasis>always</emphasis> be used by the
 
542
              network hook to refer to itself or any files in the hook
 
543
              directory it may require.
 
544
            </para>
 
545
          </listitem>
 
546
        </varlistentry>
 
547
        <varlistentry>
 
548
          <term><envar>DEVICE</envar></term>
 
549
          <listitem>
 
550
            <para>
 
551
              The network interfaces, as specified to
 
552
              <command>&COMMANDNAME;</command> by the
 
553
              <option>--interface</option> option, combined to one
 
554
              string and separated by commas.  If this is set, and
 
555
              does not contain the interface a hook will bring up,
 
556
              there is no reason for a hook to continue.
 
557
            </para>
 
558
          </listitem>
 
559
        </varlistentry>
 
560
        <varlistentry>
 
561
          <term><envar>MODE</envar></term>
 
562
          <listitem>
 
563
            <para>
 
564
              This will be the same as the first argument;
 
565
              i.e. <quote><literal>start</literal></quote>,
 
566
              <quote><literal>stop</literal></quote>,
 
567
              <quote><literal>files</literal></quote>, or
 
568
              <quote><literal>modules</literal></quote>.
 
569
            </para>
 
570
          </listitem>
 
571
        </varlistentry>
 
572
        <varlistentry>
 
573
          <term><envar>VERBOSITY</envar></term>
 
574
          <listitem>
 
575
            <para>
 
576
              This will be the <quote><literal>1</literal></quote> if
 
577
              the <option>--debug</option> option is passed to
 
578
              <command>&COMMANDNAME;</command>, otherwise
 
579
              <quote><literal>0</literal></quote>.
 
580
            </para>
 
581
          </listitem>
 
582
        </varlistentry>
 
583
        <varlistentry>
 
584
          <term><envar>DELAY</envar></term>
 
585
          <listitem>
 
586
            <para>
 
587
              This will be the same as the <option>--delay</option>
 
588
              option passed to <command>&COMMANDNAME;</command>.  Is
 
589
              only set if <envar>MODE</envar> is
 
590
              <quote><literal>start</literal></quote> or
 
591
              <quote><literal>stop</literal></quote>.
 
592
            </para>
 
593
          </listitem>
 
594
        </varlistentry>
 
595
        <varlistentry>
 
596
          <term><envar>CONNECT</envar></term>
 
597
          <listitem>
 
598
            <para>
 
599
              This will be the same as the <option>--connect</option>
 
600
              option passed to <command>&COMMANDNAME;</command>.  Is
 
601
              only set if <option>--connect</option> is passed and
 
602
              <envar>MODE</envar> is
 
603
              <quote><literal>start</literal></quote> or
 
604
              <quote><literal>stop</literal></quote>.
 
605
            </para>
 
606
          </listitem>
 
607
        </varlistentry>
 
608
      </variablelist>
 
609
      <para>
 
610
        A hook may not read from standard input, and should be
 
611
        restrictive in printing to standard output or standard error
 
612
        unless <varname>VERBOSITY</varname> is
 
613
        <quote><literal>1</literal></quote>.
 
614
      </para>
 
615
    </refsect2>
 
616
  </refsect1>
 
617
  
408
618
  <refsect1 id="files">
409
619
    <title>FILES</title>
410
620
    <variablelist>
422
632
          </para>
423
633
        </listitem>
424
634
      </varlistentry>
 
635
      <varlistentry>
 
636
        <term><filename
 
637
        class="directory">/lib/mandos/network-hooks.d</filename></term>
 
638
        <listitem>
 
639
          <para>
 
640
            Directory where network hooks are located.  Change this
 
641
            with the <option>--network-hook-dir</option> option.  See
 
642
            <xref linkend="network-hooks"/>.
 
643
          </para>
 
644
        </listitem>
 
645
      </varlistentry>
425
646
    </variablelist>
426
647
  </refsect1>
427
648
  
442
663
    <informalexample>
443
664
      <para>
444
665
        Normal invocation needs no options, if the network interface
445
 
        is <quote>eth0</quote>:
 
666
        can be automatically determined:
446
667
      </para>
447
668
      <para>
448
669
        <userinput>&COMMANDNAME;</userinput>