/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 Hogeborn
  • Date: 2021-03-21 20:46:40 UTC
  • Revision ID: teddy@recompile.se-20210321204640-lpsyen8jr9lw1jma
Some cleanup of GnuTLS interface

Rename opaque internal GnuTLS structures named *_int to also start
with underscore (_), as is the custom in Python programs.

Decode byte strings from UTF-8 where needed.  (Fixing, among other
things, all "DEBUG: GnuTLS" lines having a "b'" prefix in Python 3.)

Simplify calling C functions by:
1. Using the "_as_parameter_" attribute to store the ctypes object.
2. Creating and using helper classes to automatically create pointers
   or cast typed pointers to pointers to void.
3. Providing the "from_param()" method on relevant classes.

Remove "restype" attribute on C functions where "errcheck" attribute
is already set.

* mandos (gnutls.session_int): Rename to start with "_".
  (gnutls.openpgp_crt_int): - '' -
  (gnutls.Error.__init__): Decode byte string from gnutls.strerror().
  (gnutls.PointerTo): New helper class.
  (gnutls.CastToVoidPointer): - '' -
  (gnutls.With_from_param): - '' -
  (gnutls.Credentials): Inherit from "With_from_param" and store the
  ctypes object in the "_as_parameter_" attribute instead of
  "_c_object".
  (gnutls._error_code): Use "gnutls.E_SUCCESS" instead of the unadorned
  numerical constant "0".
  (gnutls._retry_on_error): - '' -
  (gnutls.priority_set_direct.argtypes): Use "ClientSession" instead
  of "session_t", and change all callers to match.
  (gnutls.init.argtypes): Use "PointerTo(ClientSession)" instead of
  "ctypes.POINTER(session_t)", and change all callers to match.
  (gnutls.set_default_priority.argtypes): Use "ClientSession" instead
  of "session_t", and change all callers to match.
  (gnutls.record_send.argtypes): - '' -
  (gnutls.certificate_allocate_credentials.argtypes): Use
  "PointerTo(Credentials)" instead of
  "ctypes.POINTER(certificate_credentials_t)", and change all callers
  to match.
  (gnutls.certificate_free_credentials.argtypes): Use "Credentials"
  instead of "certificate_credentials_t", and change all callers to
  match.
  (gnutls.handshake_set_private_extensions.argtypes): Use
  "ClientSession" instead of "session_t", and change all callers to
  match.
  (gnutls.credentials_set.argtypes): Use
  "CastToVoidPointer(Credentials)" instead of "ctypes.c_void_p", and
  change all callers to match.
  (gnutls.certificate_type_get.argtypes): Use "ClientSession" instead
  of "session_t", and change all callers to match.
  (gnutls.certificate_get_peers.argtypes): - '' -
  (gnutls.deinit.argtypes): - '' -
  (gnutls.handshake.argtypes): - '' -
  (gnutls.handshake.restype): Change from "_error_code" to
  "ctypes.c_int".
  (gnutls.transport_set_ptr.argtypes): Use "ClientSession" instead of
  "session_t", and change all callers to match.
  (gnutls.bye.argtypes): - '' -
  (gnutls.bye.restype): Change from "_error_code" to "ctypes.c_int".
  (gnutls.certificate_type_get2.argtypes): Use "ClientSession" instead
  of "session_t", and change all callers to match.
  (ClientHandler.handle): Decode "key_id" bytes to string before
  logging it in the debug log.
  (main.debug_gnutls): Decode GnuTLS log message from bytes to string
  before logging it in the debug log.

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 "2019-07-24">
 
5
<!ENTITY TIMESTAMP "2021-02-03">
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>
35
36
      <holder>Teddy Hogeborn</holder>
36
37
      <holder>Björn Påhlsson</holder>
37
38
    </copyright>
113
114
      be a <citerefentry><refentrytitle>systemd</refentrytitle>
114
115
      <manvolnum>1</manvolnum></citerefentry> <quote>Password
115
116
      Agent</quote> (See <ulink
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
 
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
119
120
      will use the password to unlock the encrypted root disk.
120
121
    </para>
121
122
    <para>
146
147
            Specify a different agent directory.  The default is
147
148
            <quote><filename class="directory"
148
149
            >/run/systemd/ask-password</filename ></quote> as per the
149
 
            <ulink
150
 
            url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
151
 
            >Password Agents</ulink> specification.
 
150
            <ulink url="https://systemd.io/PASSWORD_AGENTS/">Password
 
151
            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://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
274
 
      >Password Agents</ulink> mechanism.
 
273
      url="https://systemd.io/PASSWORD_AGENTS/">Password
 
274
      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://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
285
 
    >Password Agents</ulink> specification) to all currently
286
 
    unanswered password questions.
 
284
    url="https://systemd.io/PASSWORD_AGENTS/">Password Agents</ulink>
 
285
    specification) to all currently unanswered password questions.
287
286
    </para>
288
287
    <para>
289
288
      This program should be started (normally as a systemd service,
330
329
            <para>
331
330
              The default directory to watch for password questions as
332
331
              per the <ulink
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.
 
332
              url="https://systemd.io/PASSWORD_AGENTS/">Password
 
333
              Agents</ulink> specification; can be changed by the
 
334
              <option>--agent-directory</option> option.
336
335
            </para>
337
336
          </listitem>
338
337
        </varlistentry>
401
400
      <para>
402
401
 
403
402
<!-- do not wrap this line -->
404
 
<userinput>&COMMANDNAME; -- /lib/mandos/mandos-client --pubkey=/etc/mandos/keys/pubkey.txt --seckey=/etc/mandos/keys/seckey.txt --tls-pubkey=/etc/mandos/keys/tls-pubkey.pem --tls-privkey=/etc/mandos/keys/tls-privkey.pem</userinput>
 
403
<userinput>&COMMANDNAME; -- /lib/mandos/plugins.d/mandos-client --pubkey=/etc/mandos/keys/pubkey.txt --seckey=/etc/mandos/keys/seckey.txt --tls-pubkey=/etc/mandos/keys/tls-pubkey.pem --tls-privkey=/etc/mandos/keys/tls-privkey.pem</userinput>
405
404
 
406
405
      </para>
407
406
    </informalexample>
446
445
    <variablelist>
447
446
      <varlistentry>
448
447
        <term>
449
 
          <ulink
450
 
              url="https://www.freedesktop.org/wiki/Software/systemd/PasswordAgents/"
451
 
              >Password Agents</ulink>
 
448
          <ulink url="https://systemd.io/PASSWORD_AGENTS/">Password
 
449
          Agents</ulink>
452
450
        </term>
453
451
        <listitem>
454
452
          <para>