Fix previous commit.
[pwmd.git] / doc / pwmd.texi
blob1994689eeb0a165d0d5d42836e8d4e69ba1ff95f
1 >\input texinfo @c -*-texinfo-*- 
2 @c %**start of header 
3 @setfilename pwmd.info 
4 @settitle PWMD Manual
6 @macro manpage {a}
7 @end macro
8 @macro mansect {a}
9 @end macro
10 @macro manpause
11 @end macro
12 @macro mancont
13 @end macro
14 @c %**end of header
16 @dircategory Miscellaneous
17 @direntry
18 * pwmd: (pwmd).         Password Manager Daemon
19 @end direntry
21 @titlepage 
22 @title PWMD Manual
23 @subtitle Commands and syntax
24 @author by Ben Kibbey
25 @end titlepage
27 @c    Node, Next, Previous, Up 
28 @node Top ,     ,         , (dir) 
30 @ifinfo 
31 This manual documents @command{pwmd} version 3.1 protocol commands and
32 their syntax.
33 @end ifinfo 
35 @menu 
36 * Introduction::          Overview of pwmd.
37 * Access Control::        ACL of a single XML element.
38 * Cache Control::         Key and data file cache handling.
39 * Invoking::              Command line options.
40 * Configuration::         Configuration file options.
41 * Commands::              Protocol commands.
42 * Status Messages::       Status lines and their meaning.
43 * Target Attribute::      A kind of symbolic link.
44 * Other Attributes::      Other attributes specially handled by pwmd.
45 * Key Expiration::        What to do when a key expires.
46 * Signals::               Signals known to pwmd.
47 * Concept Index::         Index of concepts.
48 @end menu
50 @c    Node,     Next,    Previous, Up 
51 @node Introduction, Access Control,        , Top 
52 @chapter Overview of @command{pwmd} 
54 @manpage pwmd.1
55 @ifset manverb
56 .B pwmd
57 \- a univeral data server
58 @end ifset
60 @mansect synopsis
61 @ifset manverb
62 .B pwmd
63 [options] [file1] [...]
64 @end ifset
66 @mansect description
67 @dfn{Password Manager Daemon} (or @command{pwmd}) is a server that
68 applications connect to and send commands to put and get data
69 that is stored in an OpenPGP encrypted XML document. It mimics a
70 filesystem in a lot of ways including per element ACL's, but also has
71 the advantage of remote connections over TLS and a document cache. The
72 document cache is needed for a data file encrypted with keys stored on a
73 smartcard.
75 The server uses the Assuan protocol (@inforef{Implementation,,assuan}) which
76 is the same used by @command{gpg-agent}, @command{pinentry} and
77 @command{scdaemon}. It also uses @cite{libgpg-error} for error reporting with
78 @var{GPG_ERR_SOURCE_USER_1} being the error source.
79 @ifset isman
81 You can import an existing @command{pwmd} version @var{3.0.x} data file by
82 dumping the raw XML data with
83 .BR pwmd-dump(1)
84 to a file, then
85 importing that file by using @command{pwmd}'s @option{--import} command line
86 option. Please
87 see the
88 .BR pwmd-dump(1)
89 manual page for details.
91 It is recommended to read the texinfo documentation of @command{pwmd}
92 since it contains protocol commands and syntax and other details not
93 found here.
94 @end ifset
95 @manpause
97 The XML document uses the following DTD:
99 @example
100     <?xml version="1.0"?>
101     <!DOCTYPE pwmd [
102     <!ELEMENT pwmd (element*)>
103     <!ATTLIST element _name CDATA #REQUIRED>
104     ]>
105 @end example
107 The @code{pwmd} element is the document root node while all other elements
108 of the document have the name @code{element} with an attribute @code{_name}
109 whose value uniquely identifies the element at the current element tree depth.
110 It is done this way to avoid XML parsing errors for commonly used
111 characters.  A URL for example would be an invalid XML element
112 since the URI contains a @samp{:} which is also the XML
113 namespace separator.
115 As mentioned, an element name must be unique for the current element tree
116 depth. You cannot have two elements containing the same @code{_name} attribute
117 value. @command{pwmd} will stop searching for an element of an @emph{element
118 path} at the first match then continue searching for the next element of the
119 element path beginning at the child node of the matched element.
121 An @emph{element path} is a @code{TAB} delimited character string where each
122 @code{TAB} separates each element in the path.  For example, the element path
123 @code{a@code{TAB}b@code{TAB}c} has the following XML document structure:
125 @example
126         <pwmd>
127             <element _name="a">
128                 <element _name="b">
129                     <element _name="c">
130                         [... element value or content ...]
131                     </element>
132                 </element>
133             </element>
134         </pwmd>
135 @end example
137 The only restriction of an element name is that it contain no whitespace
138 characters.
140 @c    Node,     Next,    Previous, Up 
141 @node Access Control, Cache Control, Introduction, Top 
142 @chapter Access Control
144 Like a filesystem has an ACL to grant or limit access to directories or
145 files for a specific user or group, @command{pwmd} can limit a local user,
146 group or a TLS connection to a specific element path. This is done by
147 storing an ACL in the element attribute @var{_acl}. Its syntax is
148 similar to the @var{allowed} configuration parameter (@pxref{Configuration})
149 with the exception that a TLS fingerprint hash is prefixed with a
150 @code{#}.
152 Access is denied for all users that are not in the ACL of an element
153 with the exception of an invoking user (see the @var{invoking_user}). The
154 connected client must be in the ACL for each element in an element path
155 otherwise an error is returned.  As an example:
157 @example
158 <element _name="test" _acl="username,-@@wheel,root,#ABCDEF">
159         <element _name="child"/>
160 </element>
161 @end example
163 The user @code{username} would be allowed access to the @code{test} element
164 but not if it is a member of the @code{wheel} group although, the @code{root}
165 user, who may be a member of the @code{wheel} group, is allowed. The SHA-256
166 TLS fingerprint hash @code{#ABCDEF} is also allowed.  No users other than an
167 @var{invoking_user} are allowed access to the @code{child} element.
169 The first user listed in the ACL is considered the owner of the
170 element. This determines which clients may modify an @var{_acl} attribute and
171 store content for an element. An @var{invoking_user} may always modify an 
172 ACL.
174 @c    Node,     Next,    Previous, Up 
175 @node Cache Control, Invoking, Access Control, Top 
176 @chapter Cache Control
178 @mancont
179 @mansect cache notes
180 While @command{pwmd} has its own cache settings for an XML document,
181 @command{gpg-agent} has cache settings for the keys used for crypto operations
182 of a data file. Specifically the @option{ignore-cache-for-signing},
183 @option{default-cache-ttl} and @option{max-cache-ttl} options. These
184 @command{gpg-agent} options may need to be adjusted depending on your usage
185 needs. For example, the @code{OPEN} command may not require a passphrase to
186 open a data file do to the gpg-agent having a cached key even though the
187 @code{ISCACHED} command returns an error indicating the data file is not
188 cached; which usually means a passphrase would be required.
190 A copy-on-write operation is done for commands that modify the document; the
191 client that invoked the command will work on a copy of the in-memory document.
192 The first client to @code{SAVE} the changes to disk will require other clients
193 to reopen the data file do to the checksum being updated.
195 @c    Node,     Next,    Previous, Up 
196 @node Invoking, Configuration, Cache Control, Top 
197 @chapter Invoking @command{pwmd} 
199 @mansect options
200 @command{pwmd} uses GpgME for encryption, decryption and signing of the
201 OpenPGP data file. GpgME itself makes use of @command{gpg} for these
202 operations so some configuration of @command{gpg} may be needed.  Pwmd spawns
203 a separate @command{gpg-agent} process when @var{gpg_homedir}
204 (@pxref{Configuration}) is not set to an instance of an already running
205 gpg-agent. Any @command{gpg} configuration options that you need set should be
206 put in @var{~/.pwmd/.gnupg/gpg.conf} or the @var{gpg.conf} file located in
207 @var{gpg_homedir}. The same is true for the @var{gpg-agent.conf} file to set
208 any required @command{gpg-agent} options.
210 It is recommended to pass the @option{--allow-preset-passphrase}
211 option to @command{gpg-agent}. Doing so allows @command{pwmd}
212 cache pushing on startup. It is also recommended to pass the
213 @option{--allow-loopback-pinentry} to @command{gpg-agent} (this is the default
214 as of gnupg-2.1.15). This option allows a passphrase to be inquired from
215 @command{pwmd} when a @command{pinentry} is unavailable to the client
216 (@pxref{TLS}).
218 If you would like to use a keypair from your default gnupg keyring located in
219 ~/.gnupg, but would still like to use a separate gpg-agent process (the
220 default), you would need to first export the public key from the default
221 keyring then import it into the keyring that pwmd uses. You can do this by
222 first exporting the public key, then use the @option{--homedir ~/.pwmd/.gnupg}
223 option of @command{gpg} to import it into the new keyring. For private keys,
224 you would need to copy the private key associated with the exported public key
225 to @var{~/.pwmd/.gnupg/private-keys-v1.d}. If the private key is stored on
226 a smartcard you can also use the @code{KEYINFO --learn} command
227 (@pxref{KEYINFO}).
229 @cindex Running @command{pwmd} 
230 @command{pwmd} is executed as follows: 
232 @example 
233 pwmd @var{options} [ file1 ] [ @dots{} ]
234 @end example
236 Non-option arguments are data files to cache upon startup. When the data file
237 requires a passphrase for decryption a @command{pinentry} will prompt either
238 on the current TTY or from an X11 window when the @env{DISPLAY}
239 environment variable is set. @xref{Pinentry}.
241 @cindex Options 
242 @cindex Arguments 
243 The following command line options are supported:
245 @cindex Getting help 
246 @table @samp 
247 @item --debug protocol:level[,protocol:level]
248 Enable debugging output. This option can output sensitive information such as
249 passphrases and secret keys so care should be taken where the output gets
250 written to. The @var{protocol} is a single character representing the protocol
251 to log. Use @code{a} for @code{libassuan} with @var{level} being one or more
252 character flags: @code{i} for init, @code{x} for context, @code{e} for engine,
253 @code{d} for data, @code{s} for system IO or @code{c} for control.  To debug
254 @code{gpgme} use @code{g} as the @var{protocol} with @var{level} being an
255 integer from @code{1} to @code{9}. To enable @acronym{TLS} debugging output
256 use @code{t} as the @var{protocol} with @var{level} being an integer from
257 @code{1} to @code{9}. A value over @code{10} will enable all @acronym{TLS}
258 debugging output with @code{1} being the default.
260 @item --homedir directory
261 The root directory where pwmd will store its data and temporary files.  The
262 default is @file{~/.pwmd}.
264 @item --rcfile, -f rcfile
265 Specify an alternate configuration file. The default is
266 @file{~/.pwmd/config}.
268 @item --kill
269 Terminate an existing instance of pwmd. The process to terminate is determined
270 from the @option{--homedir} and @option{--rcfile} options.
272 @item --import, -I filename|-
273 Imports the XML @var{filename}. When @var{filename} is @code{-} the
274 XML is read from stdin. The XML file should be in conformance to
275 the @command{pwmd} DTD (@pxref{Introduction}). You will be prompted for
276 a passphrase to encrypt with.  The output is written to the filename specified
277 with @option{--outfile}. To make use of the imported data, place the output
278 file in @file{~/.pwmd/data}.
280 @item --output, -o filename|-
281 When importing, write the encrypted data file to @var{filename}. When
282 @var{filename} is @code{-} output will be written to stdout.
284 @item --passphrase-file, -k filename"
285 Obtain the passphrase to use when importing from the specified @var{filename}.
287 @item --keyid fingerprint[,fingerprint]
288 Specifies the fingerprint of the encryption key to use as a recipient when
289 importing. When not specified a new key-pair will be created.
291 @item --sign-keyid fingerprint
292 Specifies the fingerprint of the signing key to use for signing of the data
293 file when importing.  When not specified the signing key of the generated
294 key-pair or the signing key of the @option{--keyid} option will be used.
296 @item --symmetric, -s
297 Use symmetric or conventional encryption rather than pubic key encryption when
298 importing.  Signing is still possible by using the @option{--sign-keyid}
299 option. By default no signing is done when specifying this option.
301 @item --userid string
302 When importing, the user id used to identify the generated key. This should be
303 in the form @code{First Last <email>}.
305 @item --algo string
306 When importing, the algorithm to use when generating the new key pair. The
307 default is determined by @command{gpg}.
309 @item --expire seconds
310 When importing, the time, in seconds since epoch, when the generated key will
311 expire. Specifying @code{0} will never expire the key. The default is three
312 years.
314 @item --no-passphrase
315 When importing, don't require a passphrase for the generated key.
317 @item --disable-dump
318 Disable the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and @code{DUMP}
319 protocol commands (@pxref{Commands}). This overrides any
320 @var{disable_list_and_dump} configuration parameter (@pxref{Configuration}).
322 @item --no-fork, -n
323 Run as a foreground process and do not fork into the background.
325 @item --ignore, --force
326 Ignore cache pushing failures on startup. By default, @command{pwmd} will exit
327 if an error occurred do to an invalid passphrase or other error.
329 @item --version
330 Show the version, copyright and compile time features and exit.
332 @item --help 
333 Print a summary of options.
334 @end table
335 @manpause
337 @c    Node,     Next,    Previous, Up 
338 @node Configuration, TLS, Invoking, Top 
339 @chapter @command{pwmd} configuration file options
340 @mancont
341 @mansect configuration file
342 If no configuration file is specified with the @command{pwmd} @option{-f}
343 command line option, @command{pwmd} will read @file{~/.pwmd/config} if it
344 exists, and if not, will use defaults.  Blank lines and lines beginning with
345 @samp{#} are ignored. Some parameters may have data file specific settings by
346 placing them in a file section. A file section is declared by surrounding the
347 filename with braces (i.e., @samp{[filename]}).  Global options may be
348 specified in the @code{global} section @samp{e.g., [global]} and are the
349 default options for new or unspecified file sections.
351 A tilde @code{~} will be expanded to the home directory of the user starting
352 @command{pwmd} when contained in a parameter whose value is a filename.
354 @cindex Reloading the configuration file
355 The configuration file can be reloaded by sending the @emph{SIGHUP} signal to
356 a @command{pwmd} process. Some security sensitive settings may not be changed
357 until @command{pwmd} is restarted.
359 @cindex Global configuration options
360 The following options are only for use in the @code{[global]} section:
362 @table @samp 
363 @item socket_path = /path/to/socket
364 Listen on the specified socket. The default is @file{~/.pwmd/socket}.
366 @item socket_perms = octal_mode
367 Permissions to set after creating the socket. This will override any
368 @cite{umask(2)} setting.
370 @item backlog = integer
371 The number of connections to queue. When this limit is reached then new
372 connections will be refused. The default is @code{128}.
374 @item invoking_user = [-!]user,[-!]@@group,[-!]#SHA-256,...
375 This parameter is not to be confused with setuid or setguid upon startup. It's
376 syntax is the same as the @code{allowed} parameter except that it is a list of
377 local usernames, group names and TLS fingerprint hashes that may use the
378 @command{XPATH}, @command{XPATHATTR} and @command{DUMP} commands (except when
379 disabled with the @code{disable_list_and_dump} option) and also who may modify
380 elements that have no @code{_acl} attribute or is not listed in an
381 @code{_acl}. It is similar to the system administrator root account but for a
382 data file and element paths (@pxref{Access Control}). The default is the user
383 the executes @command{pwmd}.
385 @item invoking_file = filename
386 A file containing one entry per line. An entry has the same syntax as the
387 @code{invoking_user} parameter. When both this parameter and the
388 @code{invoking_user} parameter are specified then the @code{invoking_user}
389 parameter will behave as if the @code{invoking_file} entries have been
390 appended to the @code{invoking_user} parameter value.
392 @item strict_open = boolean
393 When @code{true}, disallow creation of a new data file when the current client
394 is not an @code{invoking_user}. The default is @code{false}.
396 @item strict_kill = boolean
397 When @code{false}, the @code{KILL} command (@pxref{KILL}) will allow killing
398 another client that is not of the same @code{UID} or TLS fingerprint of
399 the current client and when not an @code{invoking_user}. The default us
400 @code{false}.
402 @item allowed = [-!]user,[-!]@@group,[+,][-!]#SHA-256,...
403 A comma separated list of local user names, group names or TLS
404 fingerprint SHA-256 hashes (in the case of a remote client) who are
405 allowed to connect.  Groups should be prefixed with a @samp{@@}. When not
406 specified only the user who started @command{pwmd} may connect. A username,
407 group name or hash may also be prefixed with a @code{-} or @code{!} to prevent
408 access to a specific user or group in the list. The order of the list is
409 important since a user may be a member of multiple groups.
411 This parameter may also be specified in a filename section to allow or deny a
412 client to @code{OPEN} (@pxref{OPEN}) a data file. It also affects the cache
413 commands @code{CLEARCACHE} (@pxref{CLEARCACHE}) and @code{CACHETIMEOUT}
414 (@pxref{CACHETIMEOUT}). When not specified in a file section, any user that
415 can connect may also open any filename (provided they can decrypt it).
417 The following example would deny all users in group @code{primary} but
418 allow @code{username} who may be a member of @code{primary}. It will also
419 allow any TLS client except for the client with TLS fingerprint hash
420 @code{#ABCDEF}:
422 @example
423 allowed=-@@primary,username,+,!#ABCDEF
424 @end example
426 @item allowed_file = filename
427 A file containing one entry per line. An entry has the same syntax as the
428 @code{allowed} parameter. When both this parameter and the @code{allowed}
429 parameter are specified then the @code{allowed_file} entries will be appended
430 to the @code{allowed} parameter value.
432 @item encrypt_to = boolean
433 When @code{true} and @command{SAVE}'ing a data file, allow @command{gpg} to
434 append it's configured key to the list of recipients. The default is
435 @code{false} meaning that only keys specified with @command{SAVE}
436 @option{--keyid} are recipients.
438 @item always_trust = boolean
439 When @code{true}, allow encrypting to untrusted recipients or public
440 encryption keys. The default is @code{false}.
442 @item gpg_homedir = path
443 The location where @command{gpg} will store its public and private keys and
444 configuration. The default is @file{HOMEDIR/.gnupg} where @var{HOMEDIR} is the
445 default (@file{~/.pwmd}) or the value specified on the command line with the
446 @option{--homedir} command line option (@pxref{Invoking}). If you want to use
447 your standard @command{gpg} keyring then set this to @file{~/.gnupg}. Note
448 that a new instance of @command{gpg-agent} will be started when @emph{not}
449 using the standard keyring and that any configuration options for
450 @command{gpg-agent} will need to placed in
451 @file{HOMEDIR/.gnupg/gpg-agent.conf}.
453 @item disable_mlockall = boolean
454 When set to @code{false}, @cite{mlockall(2)} will be called on startup.  This
455 will use more physical memory but may also be more secure since no swapping to
456 disk will occur. The default is @var{true}. If possible, use an encrypted swap
457 file or partition and leave this set to @var{true}.
459 @item log_path = /path/to/logfile
460 Logs informational messages to the specified file. The default is
461 @file{~/.pwmd/log}.
463 @item enable_logging = boolean
464 Enable or disable logging to @var{log_path}. The default is @code{false}.
466 @item log_keepopen = boolean
467 When set to @code{false}, the log file specified with @var{log_path} will be
468 closed after writing each line. The default is @code{true}.
470 @item syslog = boolean
471 Enable logging to @cite{syslog(8)} with facility @emph{LOG_DAEMON} and priority
472 @emph{LOG_INFO}. The default is @code{false}.
474 @item log_level = level
475 When @code{0}, only connections and errors are logged. When @code{1}, data
476 file recipients and signers are logged during @code{OPEN} (@pxref{OPEN}) and
477 @code{SAVE} (@pxref{SAVE}). When @code{2}, client commands are also logged.
478 The default is @code{0}.
480 @item kill_scd = boolean
481 Kill @command{scdaemon} after each @code{OPEN} (@pxref{OPEN}),
482 @code{SAVE} (@pxref{SAVE}) or @code{PASSWD} (@pxref{PASSWD}) command. The
483 default is @code{false}.
485 @item disable_list_and_dump = boolean
486 When @code{true}, the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and
487 @code{DUMP} protocol commands (@pxref{Commands}) will be disabled.
489 @item cache_push = file1,file2
490 A comma separated list of filenames that will be pushed into the file cache
491 upon startup. @command{pwmd} will prompt for the passphrase for each file
492 unless specified with @var{passphrase_file} parameter in a matching file
493 section.
495 @item priority = integer
496 The priority, or niceness, of the server. The default is inherited from the
497 parent process.
499 @item lock_timeout = integer
500 The default timeout in tenths of a second before giving up waiting for a file
501 lock and returning an error. The default is @code{50}.
503 @end table
505 @cindex Data file configuration options
506 @ifset manverb
508 @end ifset
509 The following options are defaults for new files when specified in the
510 @samp{global} section. When placed in a data file section they are options
511 specific to that data file only.
513 @table @samp 
514 @item require_save_key = boolean
515 Require the passphrase needed for signing before writing changes of the
516 document to disk reguardless of the key cache status. The default is
517 @code{true}. This option compliments @command{gpg-agent} option
518 @option{--ignore-cache-for-signing} and is used as a fail-safe.
520 @item backup = boolean
521 Whether to create a backup of the data file when saving. The backup filename
522 has the @file{.backup} extension appended to the opened file. The default is
523 @code{true}. 
525 @item cache_timeout = seconds
526 The number of seconds to keep the cache entry for this file. If @code{-1}, the
527 cache entry is kept forever. If @code{0}, each time an encrypted file is
528 @code{OPEN}ed (@pxref{OPEN}) a passphrase will be required. The default
529 is @code{600} or 10 minutes.
531 @item xfer_progress = bytes
532 Commands that send data lines to the client will also send the @code{XFER}
533 status message (@pxref{Status Messages}) after the specified number of bytes
534 have been sent. The number of bytes is rounded to @var{ASSUAN_LINELENGTH} or
535 @code{1002} bytes. The default is @code{8196}.
537 @item passphrase_file = /path/to/filename
538 Obtain the passphrase to open the data file from @var{filename}. If specified
539 in the @samp{global} section then the @var{passphrase_file} is a default for
540 all data files. Note that if a client changes the passphrase for this data
541 file then the @var{passphrase_file} will need to be updated with the new
542 passphrase.
544 @item recursion_depth = integer
545 The maximum number of times to resolve a @code{target} attribute for an
546 element in an element path (@pxref{Target Attribute}). An error is returned
547 when this value is exceeded.  The default is @code{100} but can be disabled by
548 setting to @code{0} (@emph{not recommended}).
550 @item allowed = [-]user,[-]@@group,[!]#TLSFINGERPRINT,...
551 Same parameter value as the @code{allowed} parameter mentioned above in
552 the @samp{[global]} section but grants or denies a client from opening a
553 specific data file. The default is to allow any client that is allowed to
554 connect.
556 @end table
557 @menu
558 * TLS::                   Remote connections over TLS.
559 * Pinentry::              Configuration file and defaults.
560 @end menu
562 @node TLS, Pinentry, Configuration, Configuration
563 @chapter Configuring remote connections over TLS.
564 @ifset manverb
566 @end ifset
567 Remote connections can also be made to @command{pwmd} over TLS.
568 Authentication is done by using X.509 client certificates that are signed with
569 the same Certificate Authority (CA) as the server certificate.
571 The CA certificate is expected to be found in
572 @file{~/.pwmd/ca-cert.pem} while the @command{pwmd} server certificate and key
573 file should be put in @file{~/.pwmd/server-cert.pem} and
574 @file{~/.pwmd/server-key.pem}, respectively.
576 See the documentation of @command{certtool} or @command{openssl} for details
577 about creating self-signed certificates.
579 The following TLS configuration options are available:
581 @table @samp 
582 @item enable_tcp = boolean
583 Whether to enable TCP/TLS server support. If enabled, both TCP and the local
584 unix domain socket will listen for connections. The default is
585 @code{false}.
587 @item tcp_port = integer
588 The TCP port to listen on when @var{enable_tcp} is @code{true}. The default is
589 @code{6466}.
591 @item tcp_bind = string
592 The internet protocol to listen with. Must be one of @code{ipv4}, @code{ipv6}
593 or @code{any} to listen for both IPv4 and IPv6 connections. The default is
594 @code{any}.
596 @item tcp_interface = string
597 Only useful if running as root.
599 @item tls_timeout = seconds
600 The number of seconds to wait for a read() or write() call on a
601 TLS client file descriptor to complete before returning an
602 error. The default is @var{300}.
604 @item keepalive_interval = seconds
605 Send a keepalive status message to an idle remote client.  An idle
606 client is one that is not in a command. The purpose of this status
607 message is to disconnect a hung remote client and release any file mutex
608 locks so another client may open the same data file. The default is @code{60}.
610 @item tcp_require_key = boolean
611 When @code{true}, require the remote client to provide the passphrase to open
612 a data file even if the file is cached.  This option is a default for all
613 files when specified in the @samp{[global]} section. The default is
614 @code{false}.
616 @item tls_cipher_suite = string
617 The GnuTLS cipher suite and protocol to use. See the GnuTLS documentation for
618 information about the format of this string. The default is
619 @code{SECURE256:SECURE192:SECURE128:-VERS-SSL3.0:-VERS-TLS1.0}.
621 @item tls_dh_params_file = filename
622 The PEM encoded filename containing DH parameters. If not specified
623 then DH algorithms will not be available to the client. See the
624 @command{openssl dhparam} or @command{certtool} manual pages for details about
625 generating this file.
627 Note that SIGHUP will not reload this file once TLS support has been enabled.
628 You will need to restart @command{pwmd} for changes to take effect.
629 @end table
631 @node Pinentry, Commands, TLS, Configuration
632 @chapter Pinentry configuration
633 @mansect Pinentry
634 The @command{pinentry} program is used to prompt the user for passphrase
635 input or as a confirmation dialog; it needs to know where to prompt for
636 the input, beit from a terminal or an X11 display.
638 It is the responsibility of the client to tell @command{pinentry} about the
639 terminal or X11 display before requiring the input. This is done with the
640 @command{OPTION} command (@pxref{OPTION}) to either set or unset needed
641 @command{pwmd} environment variables and by using the
642 @command{gpg-connect-agent} program. Please read it's documentation about the
643 @emph{UPDATESTARTUPTTY} command.
645 @ifclear isman
646 @c    Node,     Next,    Previous, Up
647 @node Commands, Status Messages, Pinentry, Top
648 @chapter Protocol commands and their syntax
649 @include menu.texi
650 @include commands.texi
652 @c    Node,     Next,    Previous, Up 
653 @node Status Messages, Target Attribute, Commands, Top 
654 @chapter Status messages and their meanings
655 Some commands send status messages to inform the client about certain
656 operations or as a progress indicator.  Status messages begin with a
657 @code{KEYWORD} followed by a status description for status messages that
658 require it. What status messages are sent, when, and how often may depend on
659 configuration settings (@pxref{Configuration}).
661 @multitable @columnfractions .20 .25 .55
662 @headitem Message @tab Parameters @tab Description
663 @item CACHE
664 @cindex CACHE
665 @tab @code{<integer>}
666 @tab The number of cached documents. Sent to each client after connecting
667 (@pxref{GETINFO}) and after every cache modification.
669 @item CLIENTS
670 @cindex CLIENTS
671 @tab @code{<integer>}
672 @tab The number of connected clients (@pxref{GETINFO}). Sent to each client
673 when another client either connects or disconnects.
675 @item DECRYPT
676 @cindex DECRYPT
677 @tab
678 @tab Sent to the current client during a decrypt operation. How often this
679 status message is sent is determined by the @code{keepalive_interval}
680 (@pxref{Configuration}) setting.
682 @item ENCRYPT
683 @cindex ENCRYPT
684 @tab
685 @tab Sent to the current client during an encrypt operation. How often this
686 status message is sent is determined by the @code{keepalive_interval}
687 (@pxref{Configuration}) setting.
689 @item GENKEY
690 @cindex GENKEY
691 @tab @code{[<sigkey_fpr> <pubkey_fpr>]}
692 @tab Sent to the current client during key generation. How often this
693 status message is sent is determined by the @code{keepalive_interval}
694 (@pxref{Configuration}) setting. The @var{sigkey_fpr} and @var{pubkey_fpr}
695 parameters are added when key generation has completed.
697 @item INQUIRE_MAXLEN
698 @cindex INQUIRE_MAXLEN
699 @tab @code{<bytes>}
700 @tab Sent to the client from @command{gpg-agent} when inquiring data. This
701 specifies the maximum number of bytes allowed for the client to send and
702 should not be exceeded.
704 @item KEEPALIVE
705 @cindex KEEPALIVE
706 @tab
707 @tab Sent to each idle client every @var{keepalive_interval}
708 (@pxref{Configuration}) seconds.
710 @item LOCKED
711 @cindex LOCKED
712 @tab
713 @tab Sent to the current client when another client is holding the lock for
714 the mutex associated with a file. How often this status message is sent is
715 determined by the @code{keepalive_interval} (@pxref{Configuration}) setting.
717 @item NEWFILE
718 @cindex NEWFILE
719 @tab
720 @tab Sent to the current client when the opened (@pxref{OPEN}) file does not
721 exist on the file-system.
723 @item XFER
724 @cindex XFER
725 @tab @code{<sent> <total>}
726 @tab Sent to the current client when transferring data. It has two space
727 delimited arguments. The first being the current amount of bytes transferred
728 and the other being the total bytes to be transferred.
730 @item STATE
731 @cindex STATE
732 @tab @code{<client_id> <state>}
733 @tab Sent to each client to indicate that @var{client_id} has changed to
734 @var{state} (@pxref{GETINFO} for client states). For a client to receive
735 another clients state the option @var{CLIENT-STATE} must be set.
736 @xref{OPTION} command.
738 @item EXPIRE
739 @cindex EXPIRE
740 @tab @code{<epoch_seconds> <epoch_future>|0}
741 @tab Sent to the current client when @code{GET} (@pxref{GET}) encounters an
742 @code{expire} (@pxref{Other Attributes}) attribute that is in the past or when
743 @code{STORE} (@pxref{STORE}) updates the @code{expire} attribute from the
744 @code{expire_increment} attribute value. The second field will be @code{0}
745 when @code{GET} sends this status message.  Otherwise the second field is the
746 time the next expiry will be.
748 @item PASSPHRASE_HINT
749 @cindex PASSPHRASE_HINT
750 @tab <keyid> <userid>
751 @tab Forwarded from @code{GpgME}. Contains information that is useful in a
752 @command{pinentry}. Only sent when pinentry is disabled (@pxref{OPTION}).
754 @item PASSPHRASE_INFO
755 @cindex PASSPHRASE_INFO
756 @tab <flags> ...
757 @tab Forwarded from @code{GpgME}. Contains information that is useful in a
758 @command{pinentry}. Only sent when pinentry is disabled (@pxref{OPTION}).
760 @item REHANDSHAKE
761 @cindex REHANDSHAKE
762 @tab
763 @tab Sent to each TLS client just before performing a cipher renegotiation
764 after a SIGHUP signal was received.
765 @end multitable
767 @c    Node,     Next,    Previous, Up 
768 @node Target Attribute, Other Attributes, Status Messages, Top
769 @chapter The @code{target} attribute
770 @cindex target attribute
771 A @emph{case sensitive} attribute named @code{target} is treated specially
772 when found in each element of an element path. This attribute, like other
773 element attributes, is created or modified with the @code{ATTR} command
774 (@pxref{ATTR}). The value of this attribute is an existing element path
775 somewhere in the document.  If you are familiar with XML entities or
776 maybe the HTML @code{id} or @code{target} attributes or a symbolic link
777 in a file-system, you may find this attribute behaves similar to any of those.
779 To create a @code{target} attribute use the following syntax:
781 @example
782 ATTR SET target element[@code{TAB}child[..]] element[@code{TAB}child[..]]
783 @end example
785 Note the single space between the two element paths. The first element path is
786 where the @code{target} attribute will be created. If the element path does
787 not exist then it will be created.  This is the only time the @code{ATTR}
788 (@pxref{ATTR}) command will create elements. The attribute is created in the
789 final element of the element path.
791 The second element path is the destination of where you want the first element
792 path to resolve to. When an element path is passed as an argument to a
793 protocol command @command{pwmd} looks for a @code{target} attribute when
794 resolving each element and, if found, "jumps" to the attribute value and
795 continues resolving any remaining elements a commands element path.
797 When an element of a element path is removed that a @code{target} attribute
798 resolves to then an error will occur when trying to access that element. You
799 may need to either update the @code{target} attribute value with a new element
800 path or remove the attribute entirely.
802 Clients should be careful of creating @code{target} loops, or targets that
803 resolve to themselves. See the @var{recursion_depth} (@pxref{Configuration})
804 configuration parameter for details.
806 The @code{REALPATH} command (@pxref{REALPATH}) can be used to show the element
807 path after resolving all @code{target} attributes.
809 @emph{Note that when setting this attribute any children of the element will
810 be removed.}
813 @c    Node,     Next,    Previous, Up 
814 @node Other Attributes, Key Expiration, Target Attribute, Top
815 @chapter Other special attributes
816 @cindex special attributes
817 In addition to the @code{target} attribute (@pxref{Target Attribute}), there
818 are a few other attributes that are specially handled by @command{pwmd}. The
819 first is the @code{_ctime} attribute which is set to the current time when an
820 element is created. Next is the @code{_mtime} attribute which is created when
821 an element is created and also updated when an element is modified. Both of
822 these attributes may be removed but the @code{_mtime} attribute is
823 automatically added again since removing an attribute is considered modifying
824 an element. The @code{_acl} attribute controls access to the element, beit
825 modifying or accessing element content, or descending into child elements.
826 @xref{Access Control} for details. The @code{_name} attribute contains the
827 name of an element.
829 The above mentioned attributes are considered reserved attribute names.
830 Reserved attributes are treated specially when a @code{target} attribute is
831 found for the current element. The @code{ATTR LIST} command will show these
832 attribute values for the current element and not the attribute values for the
833 resolved @code{target} element. All other non-reserved attributes for the
834 resolved @code{target} are appended to the @code{ATTR LIST} command output.
835 Other @code{ATTR} commands (@pxref{ATTR}) behave as usual. You can, for example, @code{ATTR
836 DELETE} a non-reserved attribute for an element that contains a @code{target}
837 attribute. The resolved target elements' attribute will be removed rather than
838 the element containing the @code{target} attribute.
840 Another specially handled attribute is the @code{expire} attribute. This
841 attribute value, like the @code{_ctime} and @code{_mtime} attributes, is a
842 timestamp. But this timestamp is usually in the future and for use with the
843 @code{GET} (@pxref{GET}) and @code{STORE} (@pxref{STORE}) commands. When the
844 @code{GET} command is issued, it checks for an @code{expire} attribute an
845 compares its' value with the current time. If the @code{expire} timestamp is in
846 the past then a status message is sent (@pxref{Status Messages}) to inform the
847 client that the element content should be updated.  When the content for an
848 element containing an @code{expire} attribute is set when using the
849 @code{STORE} command, the value of the @code{expire_increment} attribute is
850 added to the current time and the @code{expire} attribute value is updated.
851 When no @code{expire_increment} attribute is found, no modification is done of
852 the @code{expire} attribute.
855 @c    Node,     Next,    Previous, Up 
856 @node Key Expiration, Signals, Other Attributes, Top
857 @chapter Key Expiration
858 @cindex key expiration
859 When a key used for signing a data file has expired there is no indication
860 until the next @code{SAVE} command is sent. The command will fail since one
861 cannot sign the data file with an expired key. The client will need to either
862 use a different key for signing by either specifying an existing non-expired
863 key, generate a new key, or change the expire time of the existing key with
864 @command{gpg}.
866 To change the expiration of the currently used signing key with @command{gpg},
867 use the @code{KEYINFO} command (@pxref{KEYINFO}) to obtain the fingerprint of
868 the signing key of the current data file, then change the expire time with
869 @command{gpg}:
871 @example
872 gpg --homedir ~/.pwmd/.gnupg --edit-key <fingerprint>
873 @end example
875 Then use the @code{expire} command to set the new key expire date. When
876 finished, use the @code{save} command to save your changes.
879 @c    Node,     Next,    Previous, Up
880 @node Signals, Concept Index, Key Expiration, Top
881 @chapter Recognized signals
882 @end ifclear
883 @mansect signals
884 Sending the @emph{SIGHUP} signal to a @command{pwmd} process will reload the
885 configuration file and sending @emph{SIGUSR1} will clear the entire file
886 cache.
888 @mansect see also
889 @ifset manverb
890 .BR pwmd-dump (1)
892 .BR gpg-agent (1)
894 .BR pinentry (1)
896 .BR gpg (1)
897 @end ifset
899 @ifclear isman
900 @c    Node,     Next,    Previous, Up 
901 @node Concept Index, , Signals, Top 
902 @unnumbered Concept Index
905 @c @printindex cp
906 @shortcontents 
907 @contents 
908 @end ifclear
909 @bye