Remove configuration parameter "tcp_wait".
[libpwmd.git] / doc / pwmd.texi
blob6e46f14bd5fdc09c142eb0c3f71f146eb8ca24d6
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 * Invoking::              Command line options.
39 * Configuration::         Configuration file options.
40 * Commands::              Protocol commands.
41 * Status Messages::       Status lines and their meaning.
42 * Target Attribute::      A kind of symbolic link.
43 * Other Attributes::      Other attributes specially handled by pwmd.
44 * Signals::               Signals known to pwmd.
45 * Concept Index::         Index of concepts.
46 @end menu
48 @c    Node,     Next,    Previous, Up 
49 @node Introduction, Access Control,        , Top 
50 @chapter Overview of @command{pwmd} 
52 @manpage pwmd.1
53 @ifset manverb
54 .B pwmd
55 \- a univeral data server
56 @end ifset
58 @mansect synopsis
59 @ifset manverb
60 .B pwmd
61 [options] [file1] [...]
62 @end ifset
64 @mansect description
65 @dfn{Password Manager Daemon} (or @command{pwmd}) is a server that
66 applications connect to and send commands to put and get data
67 that is stored in an @abbr{OpenPGP} encrypted @abbr{XML} document. It mimics a
68 filesystem in a lot of ways including per element @abbr{ACL}'s, but also has
69 the advantage of remote connections over @abbr{TLS} and a document cache. The
70 document cache is needed for a data file encrypted with keys stored on a
71 smartcard.
73 The server uses the Assuan protocol (@inforef{Implementation,,assuan}) which
74 is the same used by @command{gpg-agent}, @command{pinentry} and
75 @command{scdaemon}. It also uses @cite{libgpg-error} for error reporting with
76 @var{GPG_ERR_SOURCE_USER_1} being the error source.
77 @ifset isman
79 You can import an existing @command{pwmd} version @var{3.0.x} data file by
80 dumping the raw @abbr{XML} data with
81 .BR pwmd-dump(1)
82 to a file, then
83 importing that file by using @command{pwmd}'s @option{--import} command line
84 option. Please
85 see the
86 .BR pwmd-dump(1)
87 manual page for details.
89 It is recommended to read the texinfo documentation of @command{pwmd}
90 since it contains protocol commands and syntax and other details not
91 found here.
92 @end ifset
93 @manpause
95 The @abbr{XML} document uses the following @abbr{DTD}:
97 @example
98     <?xml version="1.0"?>
99     <!DOCTYPE pwmd [
100     <!ELEMENT pwmd (element*)>
101     <!ATTLIST element _name CDATA #REQUIRED>
102     ]>
103 @end example
105 The @code{pwmd} element is the document root node while all other elements
106 of the document have the name @code{element} with an attribute @code{_name}
107 whose value uniquely identifies the element at the current element tree depth.
108 It is done this way to avoid @abbr{XML} parsing errors for commonly used
109 characters.  A @abbr{URL} for example would be an invalid @abbr{XML} element
110 since the @abbr{URI} contains a @samp{:} which is also the @abbr{XML}
111 namespace separator.
113 As mentioned, an element name must be unique for the current element tree
114 depth. You cannot have two elements containing the same @code{_name} attribute
115 value. @command{pwmd} will stop searching for an element of an @emph{element
116 path} at the first match then continue searching for the next element of the
117 element path beginning at the child node of the matched element.
119 An @emph{element path} is a @code{TAB} delimited character string where each
120 @code{TAB} separates each element in the path.  For example, the element path
121 @code{a@code{TAB}b@code{TAB}c} has the following @abbr{XML} document structure:
123 @example
124         <pwmd>
125             <element _name="a">
126                 <element _name="b">
127                     <element _name="c">
128                         [... element value or content ...]
129                     </element>
130                 </element>
131             </element>
132         </pwmd>
133 @end example
135 The only restriction of an element name is that it contain no whitespace
136 characters.
138 @c    Node,     Next,    Previous, Up 
139 @node Access Control, Invoking, Introduction, Top 
140 @chapter Access Control
142 Like a filesystem has an @abbr{ACL} to grant or limit access to directories or
143 files for a specific user or group, @command{pwmd} can limit a local user,
144 group or a @abbr{TLS} connection to a specific element path. This is done by
145 storing an @abbr{ACL} in the element attribute @var{_acl}. Its syntax is
146 similar to the @var{allowed} configuration parameter (@pxref{Configuration})
147 with the exception that a @abbr{TLS} fingerprint hash is prefixed with a
148 @code{#}.
150 Access is denied for all users that are not in the @abbr{ACL} of an element
151 with the exception of an invoking user (see the @var{invoking_user}). The
152 connected client must be in the @abbr{ACL} for each element in an element path
153 otherwise an error is returned.  As an example:
155 @example
156 <element _name="test" _acl="username,-@@wheel,root,#ABCDEF">
157         <element _name="child"/>
158 </element>
159 @end example
161 The user @code{username} would be allowed access to the @code{test} element
162 but not if it is a member of the @code{wheel} group although, the @code{root}
163 user, who may be a member of the @code{wheel} group, is allowed. The SHA-256
164 TLS fingerprint hash @code{#ABCDEF} is also allowed.  No users other than an
165 @var{invoking_user} are allowed access to the @code{child} element.
167 The first user listed in the @abbr{ACL} is considered the owner of the
168 element. This determines which clients may modify an @var{_acl} attribute and
169 store content for an element. An @var{invoking_user} may always modify an 
170 @abbr{ACL}.
172 @c    Node,     Next,    Previous, Up 
173 @node Invoking, Configuration, Access Control, Top 
174 @chapter Invoking @command{pwmd} 
176 @mancont
177 @mansect options
178 @command{pwmd} uses @abbr{GpgME} for encryption, decryption and signing of the
179 @abbr{OpenPGP} data file. @abbr{GpgME} itself makes use of @command{gpg} for
180 these operations so some configuration of @command{gpg} may also be needed.
182 It is recommended to pass the @option{--allow-preset-passphrase}
183 command line option to @command{gpg-agent}. Doing so allows @command{pwmd}
184 cache pushing on startup. It is also recommended to pass the
185 @option{--allow-loopback-pinentry} to @command{gpg-agent}. This option allows
186 a passphrase to be inquired from @command{pwmd} when a @command{pinentry} is
187 unavailable to the client (@pxref{TLS}). @xref{Configuration} for details
188 about the @var{gpg_homedir} parameter.
190 @cindex Running @command{pwmd} 
191 @command{pwmd} is executed as follows: 
193 @example 
194 pwmd @var{options} [ file1 ] [ @dots{} ]
195 @end example
197 Non-option arguments are data files to cache upon startup. When the data file
198 requires a passphrase for decryption a @command{pinentry} will prompt either
199 on the current @abbr{TTY} or from an X11 window when the @env{DISPLAY}
200 environment variable is set. @xref{Pinentry}.
202 @cindex Options 
203 @cindex Arguments 
204 The following command line options are supported:
206 @cindex Getting help 
207 @table @samp 
208 @item --debug protocol:level[,protocol:level]
209 Enable debugging output. This option can output sensitive information such as
210 passphrases and secret keys so care should be taken where the output gets
211 written to. The @var{protocol} is a single character representing the protocol
212 to log. Use @code{a} for @code{libassuan} with @var{level} being one or more
213 character flags: @code{i} for init, @code{x} for context, @code{e} for engine,
214 @code{d} for data, @code{s} for system IO or @code{c} for control.  To debug
215 @code{gpgme} use @code{g} as the @var{protocol} with @var{level} being an
216 integer from @code{1} to @code{9}. To enable @acronym{TLS} debugging output
217 use @code{t} as the @var{protocol} with @var{level} being an integer from
218 @code{1} to @code{9}. A value over @code{10} will enable all @acronym{TLS}
219 debugging output with @code{1} being the default.
221 @item --homedir directory
222 The root directory where pwmd will store its data and temporary files.  The
223 default is @file{~/.pwmd}.
225 @item --rcfile, -f rcfile
226 Specify an alternate configuration file. The default is
227 @file{~/.pwmd/config}.
229 @item --kill
230 Terminate an existing instance of pwmd. The process to terminate is determined
231 from the @option{--homedir} and @option{--rcfile} options.
233 @item --import, -I filename
234 Imports an @abbr{XML} file. The @abbr{XML} file should be in conformance to
235 the @command{pwmd} @abbr{DTD} (@pxref{Introduction}). You
236 will be prompted for a passphrase to encrypt with.  The output is written to
237 the filename specified with @option{--outfile}. To make use of the imported
238 data, place the output file in @file{~/.pwmd/data}.
240 @item --keyparam filename
241 The key parameters to use when generating a new key pair while importing an
242 @abbr{XML} file. The file contents must be in @abbr{GnuPG} @abbr{XML} format.
244 @item --keyid fingerprint[,<fingerprint>]
245 Specifies the fingerprint of the encryption key to use as a recipient when
246 importing. When not specified a new key-pair will be created.
248 @item --sign-keyid fingerprint[,<fingerprint>]
249 Specifies the fingerprint of the signing key to use for signing of the data
250 file when importing.  When not specified the signing key of the generated
251 key-pair or the signing key of the @option{--keyid} option will be used.
253 @item --symmetric, -s
254 Use symmetric or conventional encryption rather than pubic key encryption when
255 importing.  Signing is still possible by using the @option{--sign-keyid}
256 option. By default no signing is done when specifying this option.
258 @item --passphrase-file, -k filename"
259 Obtain a passphrase from the specified filename.
261 @item --disable-dump, -D
262 Disable the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and @code{DUMP}
263 protocol commands (@pxref{Commands}). This overrides any
264 @var{disable_list_and_dump} configuration parameter (@pxref{Configuration}).
266 @item --no-fork, -n
267 Run as a foreground process and do not fork into the background.
269 @item --ignore, --force
270 Ignore cache pushing failures on startup. By default, @command{pwmd} will exit
271 if an error occurred do to an invalid passphrase or other error.
273 @item --version
274 Show the version, copyright and compile time features and exit.
276 @item --help 
277 Print a summary of options.
278 @end table
279 @manpause
281 @c    Node,     Next,    Previous, Up 
282 @node Configuration, TLS, Invoking, Top 
283 @chapter @command{pwmd} configuration file options
284 @mancont
285 @mansect configuration file
286 If no configuration file is specified with the @command{pwmd} @option{-f}
287 command line option, @command{pwmd} will read @file{~/.pwmd/config} if it
288 exists, and if not, will use defaults.  Blank lines and lines beginning with
289 @samp{#} are ignored. Some parameters may have data file specific settings by
290 placing them in a file section. A file section is declared by surrounding the
291 filename with braces (i.e., @samp{[filename]}).  Global options may be
292 specified in the @code{global} section @samp{e.g., [global]} and are the
293 default options for new or unspecified file sections.
295 A tilde @code{~} will be expanded to the home directory of the user starting
296 @command{pwmd} when contained in a parameter whose value is a filename.
298 @cindex Reloading the configuration file
299 The configuration file can be reloaded by sending the @emph{SIGHUP} signal to
300 a @command{pwmd} process. Some security sensitive settings may not be used
301 until @command{pwmd} is restarted.
303 @cindex Global configuration options
304 The following options are only for use in the @code{[global]} section:
306 @table @samp 
307 @item socket_path = /path/to/socket
308 Listen on the specified socket. The default is @file{~/.pwmd/socket}.
310 @item socket_perms = octal_mode
311 Permissions to set after creating the socket. This will override any
312 @cite{umask(2)} setting.
314 @item invoking_user = [-!]user,[-!]@@group,[-!]#SHA-256,...
315 This parameter is not to be confused with setuid or setguid upon startup. It's
316 syntax is the same as the @code{allowed} parameter except that it is a list of
317 local usernames, group names and TLS fingerprint hashes that may use the
318 @command{XPATH}, @command{XPATHATTR} and @command{DUMP} commands (except when
319 disabled with the @code{disable_list_and_dump} option) and also who may modify
320 elements that have no @code{_acl} attribute or is not listed in an
321 @code{_acl}. It is similar to the system administrator root account but for a
322 data file and element paths (@pxref{Access Control}). The default is the user
323 the executes @command{pwmd}.
325 @item invoking_file = filename
326 A file containing one entry per line. An entry has the same syntax as the
327 @code{invoking_user} parameter. When both this parameter and the
328 @code{invoking_user} parameter are specified then the @code{invoking_user}
329 parameter will behave as if the @code{invoking_file} entries have been
330 appended to the @code{invoking_user} parameter value.
332 @item strict_kill = boolean
333 When @code{false}, the @code{KILL} command (@pxref{KILL}) will allow killing
334 another client that is not of the same @code{UID} or @abbr{TLS} fingerprint of
335 the current client and when not the @code{invoking_user}. The default us
336 @code{false}.
338 @item allowed = [-!]user,[-!]@@group,[+,][-!]#SHA-256,...
339 A comma separated list of local user names, group names or @abbr{TLS}
340 fingerprint @abbr{SHA}-256 hashes (in the case of a remote client) who are
341 allowed to connect.  Groups should be prefixed with a @samp{@@}. When not
342 specified only the user who started @command{pwmd} may connect. A username,
343 group name or hash may also be prefixed with a @code{-} or @code{!} to prevent
344 access to a specific user or group in the list. The order of the list is
345 important since a user may be a member of multiple groups.
347 This parameter may also be specified in a filename section to allow or deny a
348 client to @code{OPEN} (@pxref{OPEN}) a data file. It also affects the cache
349 commands @code{CLEARCACHE} (@pxref{CLEARCACHE}) and @code{CACHETIMEOUT}
350 (@pxref{CACHETIMEOUT}). When not specified in a file section, any user that
351 can connect may also open any filename (provided they can decrypt it).
353 The following example would deny all users in group @code{primary} but
354 allow @code{username} who may be a member of @code{primary}. It will also
355 allow any TLS client except for the client with @abbr{TLS} fingerprint hash
356 @code{#ABCDEF}:
358 @example
359 allowed=-@@primary,username,+,!#ABCDEF
360 @end example
362 @item allowed_file = filename
363 A file containing one entry per line. An entry has the same syntax as the
364 @code{allowed} parameter. When both this parameter and the @code{allowed}
365 parameter are specified then the @code{allowed_file} entries will be appended
366 to the @code{allowed} parameter value.
368 @item encrypt_to = boolean
369 When @code{true} and @command{SAVE}'ing a data file, allow @command{gpg} to
370 append it's configured key to the list of recipients. The default is
371 @code{false} meaning that only keys specified with @command{SAVE}
372 @option{--keyid} are recipients.
374 @item always_trust = boolean
375 When @code{true}, allow encrypting to untrusted recipients or public
376 encryption keys. The default is @code{false}.
378 @item gpg_homedir = path
379 The location where @command{gpg} will store its public and private keys and
380 configuration. The default is @file{HOMEDIR/.gnupg} where @var{HOMEDIR} is the
381 default (@file{~/.pwmd}) or the value specified on the command line with the
382 @option{--homedir} command line option (@pxref{Invoking}). If you want to use
383 your standard @command{gpg} keyring then set this to @file{~/.gnupg}. Note
384 that a new instance of @command{gpg-agent} will be started when @emph{not}
385 using the standard keyring and that any configuration options for
386 @command{gpg-agent} will need to placed in
387 @file{HOMEDIR/.gnupg/gpg-agent.conf}.
389 @item disable_mlockall = boolean
390 When set to @code{false}, @cite{mlockall(2)} will be called on startup.  This
391 will use more physical memory but may also be more secure since no swapping to
392 disk will occur. The default is @var{true}. If possible, use an encrypted swap
393 file or partition and leave this set to @var{true}.
395 @item log_path = /path/to/logfile
396 Logs informational messages to the specified file. The default is
397 @file{~/.pwmd/log}.
399 @item enable_logging = boolean
400 Enable or disable logging to @var{log_path}. The default is @code{false}.
402 @item log_keepopen = boolean
403 When set to @code{false}, the log file specified with @var{log_path} will be
404 closed after writing each line. The default is @code{true}.
406 @item syslog = boolean
407 Enable logging to @cite{syslog(8)} with facility @emph{LOG_DAEMON} and priority
408 @emph{LOG_INFO}. The default is @code{false}.
410 @item log_level = level
411 When @code{0}, only connections and errors are logged. When @code{1}, data
412 file recipients and signers are logged during @code{OPEN} (@pxref{OPEN}) and
413 @code{SAVE} (@pxref{SAVE}). When @code{2}, client commands are also logged.
414 The default is @code{0}.
416 @item kill_scd = boolean
417 Kill @command{scdaemon} after each @code{OPEN} (@pxref{OPEN}),
418 @code{SAVE} (@pxref{SAVE}) or @code{PASSWD} (@pxref{PASSWD}) command. The
419 default is @code{false}.
421 @item disable_list_and_dump = boolean
422 When @code{true}, the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and
423 @code{DUMP} protocol commands (@pxref{Commands}) will be disabled.
425 @item cache_push = file1,file2
426 A comma separated list of filenames that will be pushed into the file cache
427 upon startup. @command{pwmd} will prompt for the passphrase for each file
428 unless specified with @var{passphrase_file} parameter in a matching file
429 section.
431 @item priority = integer
432 The priority, or niceness, of the server. The default is inherited from the
433 parent process.
435 @item lock_timeout = integer
436 The default timeout in tenths of a second before giving up waiting for a file
437 lock and returning an error. The default is @code{50}.
439 @item send_state = integer
440 Whether to send client state changes of the current client to all connected
441 clients. When @code{0} no client state changes will be sent although a client
442 state may be obtained with the @code{GETINFO} command (@pxref{GETINFO}). When
443 @code{1} a status message will be sent to all connected clients.  When
444 @code{2} the status message will be sent only to an @code{invoking_user}
445 (@pxref{Configuration}). The default is @code{2}.  Disabling this option can
446 significantly increase the performance of @command{pwmd} when there are many
447 connected clients.
449 @end table
451 @cindex Data file configuration options
452 @ifset manverb
454 @end ifset
455 The following options are defaults for new files when specified in the
456 @samp{global} section. When placed in a data file section they are options
457 specific to that data file only.
459 @table @samp 
460 @item require_save_key = boolean
461 Require the passphrase needed for signing before writing changes of the
462 document to disk reguardless of the key cache status. The default is
463 @code{true}. This option compliments @command{gpg-agent} option
464 @option{--ignore-cache-for-signing} and is used as a fail-safe.
466 @item backup = boolean
467 Whether to create a backup of the data file when saving. The backup filename
468 has the @file{.backup} extension appended to the opened file. The default is
469 @code{true}. 
471 @item cache_timeout = seconds
472 The number of seconds to keep the cache entry for this file. If @code{-1}, the
473 cache entry is kept forever. If @code{0}, each time an encrypted file is
474 @code{OPEN}ed (@pxref{OPEN}) a passphrase will be required. The default
475 is @code{600} or 10 minutes.
477 @item xfer_progress = bytes
478 Commands that send data lines to the client will also send the @code{XFER}
479 status message (@pxref{Status Messages}) after the specified number of bytes
480 have been sent. The number of bytes is rounded to @var{ASSUAN_LINELENGTH} or
481 @code{1002} bytes. The default is @code{8196}.
483 @item passphrase_file = /path/to/filename
484 Obtain the passphrase to open the data file from @var{filename}. If specified
485 in the @samp{global} section then the @var{passphrase_file} is a default for
486 all data files. Note that if a client changes the passphrase for this data
487 file then the @var{passphrase_file} will need to be updated with the new
488 passphrase.
490 @item recursion_depth = integer
491 The maximum number of times to resolve a @code{target} attribute for an
492 element in an element path (@pxref{Target Attribute}). An error is returned
493 when this value is exceeded.  The default is @code{100} but can be disabled by
494 setting to @code{0} (@emph{not recommended}).
496 @item allowed = [-]user,[-]@@group,[!]#TLSFINGERPRINT,...
497 Same parameter value as the @code{allowed} parameter mentioned above in
498 the @samp{[global]} section but grants or denies a client from opening a
499 specific data file. The default is to allow any client that is allowed to
500 connect.
502 @end table
503 @menu
504 * TLS::                   Remote connections over TLS.
505 * Pinentry::              Configuration file and defaults.
506 @end menu
508 @node TLS, Pinentry, Configuration, Configuration
509 @chapter Configuring remote connections over TLS.
510 @ifset manverb
512 @end ifset
513 Remote connections can also be made to @command{pwmd} over @abbr{TLS}.
514 Authentication is done by using X.509 client certificates that are signed with
515 the same Certificate Authority (@abbr{CA}) as the server certificate.
517 The @abbr{CA} certificate is expected to be found in
518 @file{~/.pwmd/ca-cert.pem} while the @command{pwmd} server certificate and key
519 file should be put in @file{~/.pwmd/server-cert.pem} and
520 @file{~/.pwmd/server-key.pem}, respectively.
522 See the documentation of @command{certtool} or @command{openssl} for details
523 about creating self-signed certificates.
525 The following TLS configuration options are available:
527 @table @samp 
528 @item enable_tcp = boolean
529 Whether to enable TCP/TLS server support. If enabled, both TCP and the local
530 unix domain socket will listen for connections. The default is
531 @code{false}.
533 @item tcp_port = integer
534 The TCP port to listen on when @var{enable_tcp} is @code{true}. The default is
535 @code{6466}.
537 @item tcp_bind = string
538 The internet protocol to listen with. Must be one of @code{ipv4}, @code{ipv6}
539 or @code{any} to listen for both IPv4 and IPv6 connections. The default is
540 @code{any}.
542 @item tcp_interface = string
543 Only useful if running as root.
545 @item tls_timeout = seconds
546 The number of seconds to wait for a read() or write() call on a
547 @abbr{TLS} client file descriptor to complete before returning an
548 error. The default is @var{300}.
550 @item keepalive_interval = seconds
551 Send a keepalive status message to an idle remote client.  An idle
552 client is one that is not in a command. The purpose of this status
553 message is to disconnect a hung remote client and release any file mutex
554 locks so another client may open the same data file. The default is @code{60}.
556 @item tcp_require_key = boolean
557 When @code{true}, require the remote client to provide the passphrase to open
558 a data file even if the file is cached.  This option is a default for all
559 files when specified in the @samp{[global]} section. The default is
560 @code{false}.
562 @item tls_cipher_suite = string
563 The GnuTLS cipher suite and protocol to use. See the GnuTLS documentation for
564 information about the format of this string. The default is
565 @code{SECURE256:SECURE192:SECURE128:-VERS-SSL3.0:-VERS-TLS1.0}.
567 @item tls_dh_level = string
568 The security level (bits) of the generated key exchange parameters. Possible
569 values are @code{low}, @code{medium} or @code{high}. The default is
570 @code{medium}.
572 @item tls_regen_interval = seconds
573 The interval in seconds to generate new @abbr{TLS} key exchange material. Note
574 that if a remote @abbr{TLS} client is connected when the interval expires then
575 new key generation won't happen until all remote clients have disconnected.
576 @end table
578 @node Pinentry, Commands, TLS, Configuration
579 @chapter Pinentry configuration
580 @mansect Pinentry
581 The @command{pinentry} program is used to prompt the user for passphrase
582 input or as a confirmation dialog; it needs to know where to prompt for
583 the input, beit from a terminal or an X11 display.
585 It is the responsibility of the client to tell @command{pinentry} about the
586 terminal or X11 display before requiring the input. This is done with the
587 @command{OPTION} command (@pxref{OPTION}) to either set or unset needed
588 @command{pwmd} environment variables and by using the
589 @command{gpg-connect-agent} program. Please read it's documentation about the
590 @emph{UPDATESTARTUPTTY} command.
592 @ifclear isman
593 @c    Node,     Next,    Previous, Up
594 @node Commands, Status Messages, Pinentry, Top
595 @chapter Protocol commands and their syntax
596 @include menu.texi
597 @include commands.texi
599 @c    Node,     Next,    Previous, Up 
600 @node Status Messages, Target Attribute, Commands, Top 
601 @chapter Status messages and their meanings
602 Some commands send status messages to inform the client about certain
603 operations or as a progress indicator.  Status messages begin with a
604 @code{KEYWORD} followed by a status description for status messages that
605 require it. What status messages are sent, when, and how often may depend on
606 configuration settings (@pxref{Configuration}).
608 @multitable @columnfractions .20 .25 .55
609 @headitem Message @tab Parameters @tab Description
610 @item CACHE
611 @cindex CACHE
612 @tab @code{<integer>}
613 @tab The number of cached documents. Sent to each client after connecting
614 (@pxref{GETINFO}) and after every cache modification.
616 @item CLIENTS
617 @cindex CLIENTS
618 @tab @code{<integer>}
619 @tab The number of connected clients (@pxref{GETINFO}). Sent to each client
620 when another client either connects or disconnects.
622 @item DECRYPT
623 @cindex DECRYPT
624 @tab
625 @tab Sent to the current client during a decrypt operation. How often this
626 status message is sent is determined by the @code{keepalive_interval}
627 (@pxref{Configuration}) setting.
629 @item ENCRYPT
630 @cindex ENCRYPT
631 @tab
632 @tab Sent to the current client during an encrypt operation. How often this
633 status message is sent is determined by the @code{keepalive_interval}
634 (@pxref{Configuration}) setting.
636 @item GENKEY
637 @cindex GENKEY
638 @tab @code{[<sigkey_fpr> <pubkey_fpr>]}
639 @tab Sent to the current client during key generation. How often this
640 status message is sent is determined by the @code{keepalive_interval}
641 (@pxref{Configuration}) setting. The @var{sigkey_fpr} and @var{pubkey_fpr}
642 parameters are added when key generation has completed.
644 @item INQUIRE_MAXLEN
645 @cindex INQUIRE_MAXLEN
646 @tab @code{<bytes>}
647 @tab Sent to the client from @command{gpg-agent} when inquiring data. This
648 specifies the maximum number of bytes allowed for the client to send and
649 should not be exceeded.
651 @item KEEPALIVE
652 @cindex KEEPALIVE
653 @tab
654 @tab Sent to each idle client every @var{keepalive_interval}
655 (@pxref{Configuration}) seconds.
657 @item LOCKED
658 @cindex LOCKED
659 @tab
660 @tab Sent to the current client when another client is holding the lock for
661 the mutex associated with a file. How often this status message is sent is
662 determined by the @code{keepalive_interval} (@pxref{Configuration}) setting.
664 @item NEWFILE
665 @cindex NEWFILE
666 @tab
667 @tab Sent to the current client when the opened (@pxref{OPEN}) file does not
668 exist on the file-system.
670 @item XFER
671 @cindex XFER
672 @tab @code{<sent> <total>}
673 @tab Sent to the current client when transferring data. It has two space
674 delimited arguments. The first being the current amount of bytes transferred
675 and the other being the total bytes to be transferred.
677 @item STATE
678 @cindex STATE
679 @tab @code{<client_id> <state>}
680 @tab Sent to specific clients (@pxref{Configuration} and @var{send_state}) to
681 indicate that @var{client_id} has changed to @var{state} (@pxref{GETINFO} for
682 client states).
684 @item EXPIRE
685 @cindex EXPIRE
686 @tab @code{<epoch_seconds> <epoch_future>|0}
687 @tab Sent to the current client when @code{GET} (@pxref{GET}) encounters an
688 @code{expire} (@pxref{Other Attributes}) attribute that is in the past or when
689 @code{STORE} (@pxref{STORE}) updates the @code{expire} attribute from the
690 @code{expire_increment} attribute value. The second field will be @code{0}
691 when @code{GET} sends this status message.  Otherwise the second field is the
692 time the next expiry will be.
694 @item PASSPHRASE_HINT
695 @cindex PASSPHRASE_HINT
696 @tab <keyid> <userid>
697 @tab Forwarded from @code{GpgME}. Contains information that is useful in a
698 @command{pinentry}. Only sent when pinentry is disabled (@pxref{OPTION}).
700 @item PASSPHRASE_INFO
701 @cindex PASSPHRASE_INFO
702 @tab <flags> ...
703 @tab Forwarded from @code{GpgME}. Contains information that is useful in a
704 @command{pinentry}. Only sent when pinentry is disabled (@pxref{OPTION}).
705 @end multitable
707 @c    Node,     Next,    Previous, Up 
708 @node Target Attribute, Other Attributes, Status Messages, Top
709 @chapter The @code{target} attribute
710 @cindex target attribute
711 A @emph{case sensitive} attribute named @code{target} is treated specially
712 when found in each element of an element path. This attribute, like other
713 element attributes, is created or modified with the @code{ATTR} command
714 (@pxref{ATTR}). The value of this attribute is an existing element path
715 somewhere in the document.  If you are familiar with @abbr{XML} entities or
716 maybe the @abbr{HTML} @code{id} or @code{target} attributes or a symbolic link
717 in a file-system, you may find this attribute behaves similar to any of those.
719 To create a @code{target} attribute use the following syntax:
721 @example
722 ATTR SET target element[@code{TAB}child[..]] element[@code{TAB}child[..]]
723 @end example
725 Note the single space between the two element paths. The first element path is
726 where the @code{target} attribute will be created. If the element path does
727 not exist then it will be created.  This is the only time the @code{ATTR}
728 (@pxref{ATTR}) command will create elements. The attribute is created in the
729 final element of the element path.
731 The second element path is the destination of where you want the first element
732 path to resolve to. When an element path is passed as an argument to a
733 protocol command @command{pwmd} looks for a @code{target} attribute when
734 resolving each element and, if found, "jumps" to the attribute value and
735 continues resolving any remaining elements a commands element path.
737 When an element of a element path is removed that a @code{target} attribute
738 resolves to then an error will occur when trying to access that element. You
739 may need to either update the @code{target} attribute value with a new element
740 path or remove the attribute entirely.
742 Clients should be careful of creating @code{target} loops, or targets that
743 resolve to themselves. See the @var{recursion_depth} (@pxref{Configuration})
744 configuration parameter for details.
746 The @code{REALPATH} command (@pxref{REALPATH}) can be used to show the element
747 path after resolving all @code{target} attributes.
749 @emph{Note that when setting this attribute any children of the element will
750 be removed.}
753 @c    Node,     Next,    Previous, Up 
754 @node Other Attributes, Signals, Target Attribute, Top
755 @chapter Other special attributes
756 @cindex special attributes
757 In addition to the @code{target} attribute (@pxref{Target Attribute}), there
758 are a few other attributes that are specially handled by @command{pwmd}. The
759 first is the @code{_ctime} attribute which is set to the current time when an
760 element is created. Next is the @code{_mtime} attribute which is created when
761 an element is created and also updated when an element is modified. Both of
762 these attributes may be removed but the @code{_mtime} attribute is
763 automatically added again since removing an attribute is considered modifying
764 an element. The @code{_acl} attribute controls access to the element, beit
765 modifying or accessing element content, or descending into child elements.
766 @xref{Access Control} for details. The @code{_name} attribute contains the
767 name of an element.
769 The above mentioned attributes are considered reserved attribute names.
770 Reserved attributes are treated specially when a @code{target} attribute is
771 found for the current element. The @code{ATTR LIST} command will show these
772 attribute values for the current element and not the attribute values for the
773 resolved @code{target} element. All other non-reserved attributes for the
774 resolved @code{target} are appended to the @code{ATTR LIST} command output.
775 Other @code{ATTR} commands (@pxref{ATTR}) behave as usual. You can, for example, @code{ATTR
776 DELETE} a non-reserved attribute for an element that contains a @code{target}
777 attribute. The resolved target elements' attribute will be removed rather than
778 the element containing the @code{target} attribute.
780 Another specially handled attribute is the @code{expire} attribute. This
781 attribute value, like the @code{_ctime} and @code{_mtime} attributes, is a
782 timestamp. But this timestamp is usually in the future and for use with the
783 @code{GET} (@pxref{GET}) and @code{STORE} (@pxref{STORE}) commands. When the
784 @code{GET} command is issued, it checks for an @code{expire} attribute an
785 compares its' value with the current time. If the @code{expire} timestamp is in
786 the past then a status message is sent (@pxref{Status Messages}) to inform the
787 client that the element content should be updated.  When the content for an
788 element containing an @code{expire} attribute is set when using the
789 @code{STORE} command, the value of the @code{expire_increment} attribute is
790 added to the current time and the @code{expire} attribute value is updated.
791 When no @code{expire_increment} attribute is found, no modification is done of
792 the @code{expire} attribute.
795 @c    Node,     Next,    Previous, Up
796 @node Signals, Concept Index, Other Attributes, Top
797 @chapter Recognized signals
798 @end ifclear
799 @mansect signals
800 Sending the @emph{SIGHUP} signal to a @command{pwmd} process will reload the
801 configuration file and sending @emph{SIGUSR1} will clear the entire file
802 cache.
804 @mansect see also
805 @ifset manverb
806 .BR pwmd-dump (1)
808 .BR gpg-agent (1)
810 .BR pinentry (1)
812 .BR gpg2 (1)
813 @end ifset
815 @ifclear isman
816 @c    Node,     Next,    Previous, Up 
817 @node Concept Index, , Signals, Top 
818 @unnumbered Concept Index
821 @c @printindex cp
822 @shortcontents 
823 @contents 
824 @end ifclear
825 @bye