Check the return value of update_checksum().
[pwmd.git] / doc / pwmd.texi
blobe4c587895ea3246d2a34289a6c4ae9d55f5e3cb7
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.0 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 * Signals::               Signals known to pwmd.
44 * Concept Index::         Index of concepts.
45 @end menu
47 @c    Node,     Next,    Previous, Up 
48 @node Introduction, Access Control,        , Top 
49 @chapter Overview of @command{pwmd} 
51 @manpage pwmd.1
52 @ifset manverb
53 .B pwmd
54 \- a univeral data server
55 @end ifset
57 @mansect synopsis
58 @ifset manverb
59 .B pwmd
60 [options] [file1] [...]
61 @end ifset
63 @mansect description
64 @command{pwmd} or @dfn{Password Manager Daemon} is a server that
65 applications connect to and send commands to store and retrieve data
66 that is saved in an encrypted @abbr{XML} document.
68 The server uses the Assuan protocol (@inforef{Implementation,,assuan}) which
69 is the same used by @command{gpg-agent}, @command{pinentry} and
70 @command{scdaemon}. It also uses @cite{libgpg-error} for error reporting with
71 the error source set as @var{GPG_ERR_SOURCE_USER_1}.
72 @ifset isman
74 It is recommended to read the texinfo documentation of @command{pwmd}
75 since it contains protocol commands and syntax and other details not
76 found here.
77 @end ifset
78 @manpause
80 The @abbr{XML} document uses the following @abbr{DTD}:
82 @example
83     <?xml version="1.0"?>
84     <!DOCTYPE pwmd [
85     <!ELEMENT pwmd (element*)>
86     <!ATTLIST element _name CDATA #REQUIRED>
87     ]>
88 @end example
90 The @code{pwmd} element is the document root node while all other elements
91 of the document have the name @code{element} with an attribute @code{_name}
92 whose value uniquely identifies the element at the current element tree depth.
93 It is done this way to avoid @abbr{XML} parsing errors for commonly used
94 characters.  A @abbr{URL} for example would be an invalid @abbr{XML} element
95 since the @abbr{URI} contains a @samp{:} which is also the @abbr{XML}
96 namespace separator.
98 As mentioned, an element name must be unique for the current element tree
99 depth. You cannot have two elements containing the same @code{_name} attribute
100 value. @command{pwmd} will stop searching for an element of an @emph{element
101 path} at the first match then continue searching for the next element of the
102 element path beginning at the child node of the matched element.
104 An @emph{element path} is a @key{TAB} delimited character string where each
105 @key{TAB} separates each element in the path.  For example, the element path
106 @code{a@key{TAB}b@key{TAB}c} has the following @abbr{XML} document structure:
108 @example
109         <pwmd>
110             <element _name="a">
111                 <element _name="b">
112                     <element _name="c">
113                         [... element value or content ...]
114                     </element>
115                 </element>
116             </element>
117         </pwmd>
118 @end example
120 The only restriction of an element name is that it contain no whitespace
121 characters. It also cannot begin with a @samp{!} since this character is
122 reserved for the @code{target} attribute. @xref{Target Attribute}.
124 @c    Node,     Next,    Previous, Up 
125 @node Access Control, Invoking, Introduction, Top 
126 @chapter Access Control
128 Like a filesystem has an @abbr{ACL} to grant or limit access to directories or
129 files for a specific user or group, @command{pwmd} can limit a local user,
130 group or a TLS connection to a specific element path. This is done by storing
131 an ACL in the element attribute @var{_acl}. Its syntax is similar to the
132 @var{allowed} configuration parameter (@pxref{Configuration}) with the
133 exception that a TLS fingerprint hash is prefixed with a @code{#}.
135 Access is denied for all users that are not in the @abbr{ACL} of an element
136 with the exception of the invoking user (see the @var{invoking_user}.  The
137 connected client must be in the @abbr{ACL} for each element in an element path
138 otherwise an error is returned.  As an example:
140 @example
141 <element _name="test" _acl="username,-@@wheel,root,#ABCDEF">
142         <element _name="child"/>
143 </element>
144 @end example
146 The user @code{username} would be allowed access to the @code{test} element
147 but not if it is a member of the @code{wheel} group although the @code{root}
148 user, who may be a member of the @code{wheel} group, is allowed. The SHA-256
149 TLS fingerprint hash @code{#ABCDEF} is also allowed.  No users other than the
150 @var{invoking_user} are allowed access to the @code{child} element.
152 The first user listed in the @abbr{ACL} is considered the owner of the
153 element. This determines which clients may modify an @var{_acl} attribute and
154 store content for an element. The @var{invoking_user} may always modify an 
155 @abbr{ACL}.
157 @c    Node,     Next,    Previous, Up 
158 @node Invoking, Configuration, Access Control, Top 
159 @chapter Invoking @command{pwmd} 
161 @mancont
162 @mansect options
163 When @command{pwmd} is started with the @option{--use-agent} command
164 line option then @command{pwmd} will use @command{gpg-agent} for key
165 generation, decryption, signing and caching of passphrases as the
166 default rather than symmetrically encrypted data files.
167 @command{gpg-agent} must be running prior to @command{pwmd} startup when
168 this option is enabled.
170 It is recommended to pass the @option{--allow-preset-passphrase}
171 command line option to @command{gpg-agent}. Doing so allows @command{pwmd}
172 cache pushing on startup. It is also recommended to pass the
173 @option{--allow-loopback-pinentry} to @command{gpg-agent}. This option allows
174 a passphrase to be inquired from @command{pwmd} when a @command{pinentry} is
175 unavailable to the client.
177 @cindex Running @command{pwmd} 
178 @command{pwmd} is executed as follows: 
180 @example 
181 pwmd @var{options} [ file1 ] [ @dots{} ]
182 @end example
184 Non-option arguments are data files to cache on startup. When the data file
185 requires a passphrase for decryption a @command{pinentry} will prompt either
186 on the current @abbr{TTY} or from an X11 window when the @env{DISPLAY}
187 environment variable is set.
189 @cindex Options 
190 @cindex Arguments 
191 The following command line options are supported:
193 @cindex Getting help 
194 @table @samp 
195 @item --homedir directory
196 The root directory where pwmd will store its data and temporary files.  The
197 default is @file{~/.pwmd}.
199 @item --rcfile, -f rcfile
200 Specify an alternate configuration file. The default is
201 @file{~/.pwmd/config}.
203 @item --kill
204 Terminate an existing instance of pwmd. The process to terminate is determined
205 from the @option{--homedir} and @option{--rcfile} options.
207 @item --use-agent [integer]
208 Enable the use of @command{gpg-agent} and add support for data files
209 encrypted with a keypair. Files previously handled by
210 @command{gpg-agent} when this option is not specified will no longer be
211 able to be opened and new data files are symmetrically or conventionally
212 encrypted and without a public and private key. If specified, both data file
213 types are supported. The optional argument overrides any configuration file
214 value specified with the @option{--rcfile} option.
216 @item --import, -I filename
217 Imports an @abbr{XML} file. The @abbr{XML} file should be in conformance to
218 the @command{pwmd} @abbr{DTD} (@pxref{Introduction}). You
219 will be prompted for a passphrase to encrypt with.  The output is written to
220 the filename specified with @option{--outfile}. To make use of the imported
221 data, place the output file in @file{~/.pwmd/data}.
223 @item --keyparam S-expression
224 The key parameters to use when generating a new key pair while importing an
225 @abbr{XML} file or when converting a @emph{version 2} data file. The argument
226 must be a valid S-expression (@inforef{S-expressions,, gcrypt}).
228 @item --keygrip hexstring
229 Specifies the hexadecimal encoded public key-grip to use for encryption when
230 importing or converting. When not specified a new key-pair will be created.
232 @item --sign-keygrip hexstring
233 Specifies the hexadecimal encoded public key-grip to use for signing of the
234 data file when importing or converting. When not specified the generated
235 public key or the key specified with the @option{--keygrip} option will be
236 used.
238 @item --passphrase-file, -k filename"
239 Obtain the passphrase from the specified filename.
241 @item --s2k-count iterations
242 The number of times to hash the passphrase when importing or converting.  The
243 default is the gpg-agent calibrated value of the machine. When less than
244 @samp{65536} the default will be used. When not using @command{gpg-agent} this
245 is option is an alias for @option{--cipher-iterations}.
247 @item --cipher-iterations iterations
248 The number of times to hash the passphrase used for @command{pwmd} symmetric
249 format data files.  The default is @code{5000000}.
251 This option behaves the same as the @var{--s2k-count} option when not using
252 @command{gpg-agent} and has no effect when using @command{gpg-agent}. In
253 versions prior to @command{pwmd} @var{3.0.15} this option was a count to
254 specify the number of times to encrypt the XML data with the chosen cipher and
255 was a security risk since the iteration count of the passphrase hash was a low
256 static compile time value.
258 @item --cipher algo
259 When importing, the cipher to use for data encryption.  See the @var{cipher}
260 configuration parameter (@pxref{Configuration}) for available ciphers. The
261 default is @samp{aes256}.
263 @item --convert, -C filename
264 Converts a @command{pwmd} @emph{version 2} data file to a @emph{version 3}
265 data file. If encrypted, you will be prompted for a passphrase to use for
266 decryption unless @option{--passphrase-file} was specified. The converted data
267 file will be saved to the filename specified with @option{--outfile}. All
268 @option{--import} related options may also be used when converting.
270 @item --disable-dump, -D
271 Disable the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and @code{DUMP}
272 protocol commands (@pxref{Commands}). This overrides any
273 @var{disable_list_and_dump} configuration parameter (@pxref{Configuration}).
275 @item --no-fork, -n
276 Run as a foreground process and do not fork into the background.
278 @item --ignore, --force
279 Ignore cache pushing failures on startup. By default, @command{pwmd} will exit
280 if an error occurred do to an invalid passphrase or other error.
282 @item --debug-level keyword,keyword,...
283 Output libassuan @inforef{Top,,assuan} protocol IO with the comma
284 separated list of output keywords.  Valid keywords are: @code{init},
285 @code{ctx}, @code{engine}, @code{data}, @code{sysio} and @code{control}.
287 @item --version
288 Show the version, copyright and compile time features and exit.
290 @item --help 
291 Print a summary of options.
292 @end table
293 @manpause
295 @c    Node,     Next,    Previous, Up 
296 @node Configuration, TLS, Invoking, Top 
297 @chapter @command{pwmd} configuration file options
298 @mancont
299 @mansect configuration file
300 If no configuration file is specified with the @command{pwmd} @option{-f}
301 command line option, @command{pwmd} will read @file{~/.pwmd/config} if it
302 exists, and if not, will use defaults.  Blank lines and lines beginning with
303 @samp{#} are ignored. Some parameters may have data file specific settings by
304 placing them in a file section. A file section is declared by surrounding the
305 filename with braces (i.e., @samp{[filename]}).  Global options may be
306 specified in a @samp{[global]} section and are the default options for new or
307 unspecified files.
309 A tilde @key{~} will be expanded to the home directory of the invoking user
310 when contained in a parameter whose value is a filename.
312 @cindex Reloading the configuration file
313 The configuration file can be reloaded by sending the @emph{SIGHUP} signal to
314 a @command{pwmd} process.
316 @cindex Global configuration options
317 The following options are only for use in the @samp{global} section:
319 @table @samp 
320 @item socket_path = /path/to/socket
321 Listen on the specified socket. The default is @file{~/.pwmd/socket}.
323 @item socket_perms = octal_mode
324 Permissions to set after creating the socket. This will override any
325 @cite{umask(2)} setting.
327 @item invoking_user = [-!]user,[-!]@@group,[-!]#SHA-256,...
328 This parameter is not to be confused with setuid or setguid upon startup. It's
329 syntax is the same as the @code{allowed} parameter except that it is a list of
330 local username, group name and TLS fingerprint hashes that may use the
331 @command{XPATH}, @command{XPATHATTR} and @command{DUMP} commands (except when
332 disabled with the @code{disable_list_and_dump} option) and also who may modify
333 elements that have no @code{_acl} attribute or is not listed in an
334 @code{_acl}. It is similar to the system administrator root account but for a
335 data file and element paths (@pxref{Access Control}). The default is the user
336 the executes @command{pwmd}.
338 @item invoking_file = filename
339 A file containing one ACL entry per line. Lines beginning with a @code{;} are
340 ignored. An entry has the same syntax as the @code{invoking_user} parameter.
341 When both this parameter and the @code{invoking_user} parameter are specified
342 then the @code{invoking_file} entries will be appended to the
343 @code{invoking_user} parameter value.
345 @item strict_kill = boolean
346 When @code{false}, the @code{KILL} command (@pxref{KILL}) will allow killing
347 another client that is not of the same @code{UID} or @abbr{TLS} fingerprint of
348 the current client and when not the @code{invoking_user}. The default us
349 @code{false}.
351 @item allowed = [-!]user,[-!]@@group,[+,][-!]#SHA-256,...
352 A comma separated list of local user names, group names or @abbr{TLS}
353 fingerprint @abbr{SHA}-256 hashes (in the case of a remote client) who are
354 allowed to connect.  Groups should be prefixed with a @samp{@@}. When not
355 specified only the invoking user may connect. A username, group name or hash
356 may also be prefixed with a @code{-} or @code{!} to prevent access to a specific
357 user or group in the list. The order of the list is important since a user may
358 be of multiple groups.
360 This parameter may also be specified in a filename section to allow or deny a
361 client to @code{OPEN} (@pxref{OPEN}) a data file. It also affects the cache
362 commands @code{CLEARCACHE} (@pxref{CLEARCACHE}) and @code{CACHETIMEOUT}
363 (@pxref{CACHETIMEOUT}). When not specified in a file section any user that can
364 connect may also open the filename.
366 The following example would deny all users in group @code{primary} but
367 allow @code{username} who may be a member of @code{primary}. It will also
368 allow any TLS client except for the client with @abbr{TLS} fingerprint hash
369 @code{#ABCDEF}:
371 @example
372 allowed=-@@primary,username,+,!#ABCDEF
373 @end example
375 @item allowed_file = filename
376 A file containing one ACL entry per line. Lines beginning with a @code{;} are
377 ignored. An entry has the same syntax as the @code{allowed} parameter. When
378 both this parameter and the @code{allowed} parameter are specified then the
379 @code{allowed_file} entries will be appended to the @code{allowed} parameter
380 value.
382 @item disable_mlockall = boolean
383 When set to @code{false}, @cite{mlockall(2)} will be called on startup.  This
384 will use more physical memory but may also be more secure since no swapping to
385 disk will occur. The default is @var{true}.
387 @item log_path = /path/to/logfile
388 Logs informational messages to the specified file. The default is
389 @file{~/.pwmd/log}.
391 @item enable_logging = boolean
392 Enable or disable logging to @var{log_path}. The default is @code{false}.
394 @item log_keepopen = boolean
395 When set to @code{false}, the log file specified with @var{log_path} will be
396 closed after writing each line. The default is @code{true}.
398 @item syslog = boolean
399 Enable logging to @cite{syslog(8)} with facility @emph{LOG_DAEMON} and priority
400 @emph{LOG_INFO}. The default is @code{false}.
402 @item log_level = level
403 When @code{0}, only connections and errors are logged. When @code{1}, client
404 commands are also logged. When @code{2}, the command arguments are also logged.
405 The default is @code{0}.
407 @item use_agent = boolean
408 When true, enable @command{gpg-agent} support (@pxref{Invoking}).
410 @item gpg_agent_socket = /path/to/filename
411 The location of the @command{gpg-agent} socket. The default is
412 @code{~/.gnupg/S.gpg-agent}.
414 @item kill_scd = boolean
415 Kill @command{scdaemon} after each @code{OPEN} (@pxref{OPEN}) or @code{SAVE}
416 (@pxref{SAVE}) command.
418 @item require_save_key = boolean
419 Require the passphrase needed to open a data file before writing changes
420 of the documment to disk reguardless of the key cache status.
422 @item disable_list_and_dump = boolean
423 When @code{true}, the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and
424 @code{DUMP} protocol commands (@pxref{Commands}) will be disabled.
426 @item cache_push = file1,file2
427 A comma separated list of filenames that will be pushed into the file cache
428 upon startup. @command{pwmd} will prompt for the passphrase for each file unless
429 specified with the @var{passphrase} or @var{passphrase_file} parameters in a
430 matching file section.
432 @item priority = integer
433 The priority, or niceness, of the server. The default is inherited from the
434 parent process.
436 @item cipher = algorithm
437 The default cipher to use for data encryption when saving (@pxref{SAVE}) a new
438 file. The algorithm must be one of: @code{aes128}, @code{aes192},
439 @code{aes256}, @code{serpent128}, @code{serpent192}, @code{serpent256},
440 @code{camellia128}, @code{camellia192}, @code{camellia256}, @code{3des},
441 @code{cast5}, @code{blowfish}, @code{twofish128} or @code{twofish256}. The
442 default is @code{aes256}.
444 @item cipher_iterations = integer
445 The number of times to encrypt the XML data. This differs from the
446 @var{s2k_count} parameter which specifies the number of times to hash the
447 passphrase used to encrypt the data. The default is 0 although at least 1
448 iteration is always done.
450 @item keyparam = s-expression
451 The default key parameters to use when generating a new key-pair. The default
452 is @code{RSA} with @code{2048} bits. Note that only the @abbr{RSA} and
453 @abbr{ELG} algorithms as the encryption algorithm are supported at the moment.
454 Both @abbr{RSA} and @abbr{DSA} keys may be used for signing.
456 @item pinentry_path = /path/to/pinentry
457 The location of the @command{pinentry} binary. This program is used to
458 prompt for a passphrase when not using @command{gpg-agent}. The default
459 is specified at compile time.
461 @item pinentry_timeout = seconds
462 The number of seconds to wait for a pinentry before giving up and
463 returning an error. This timeout value is used for both waiting for
464 another pinentry to complete and for the pinentry waiting for user input.
466 @item lock_timeout = integer
467 The default timeout in tenths of a second before giving up waiting for a file
468 lock and returning an error. The default is @code{50}.
470 @item send_state = integer
471 Whether to send client state changes of the current client to all connected
472 clients. When @code{0} no client state changes will be sent although a client
473 state may be obtained with the @code{GETINFO} command (@pxref{GETINFO}). When
474 @code{1} a status message will be sent to all connected clients.  When
475 @code{2} the status message will be sent only to the @code{invoking_user}
476 (@pxref{Configuration}). The default is @code{2}.  Disabling this option can
477 significantly increase the performance of @command{pwmd} when there are many
478 connected clients.
479 @end table
481 @ifset manverb
483 @end ifset
484 @cindex Data file configuration options
485 The following options are defaults for new files when specified in the
486 @samp{global} section. When placed in a data file section they are options
487 specific to that data file only.
489 @table @samp 
490 @item backup = boolean
491 Whether to create a backup of the data file when saving. The backup filename
492 has the @file{.backup} extension appended to the opened file. The default is
493 @code{true}. 
495 @item cache_timeout = seconds
496 The number of seconds to keep the cache entry for this file. If @code{-1}, the
497 cache entry is kept forever. If @code{0}, each time an encrypted file is
498 @code{OPEN}ed (@pxref{OPEN}) a passphrase will be required. The default
499 is @code{600} or 10 minutes.
501 @item xfer_progress = bytes
502 Commands that send data lines to the client will also send the @code{XFER}
503 status message (@pxref{Status Messages}) after the specified number of bytes
504 have been sent. The number of bytes is rounded to @var{ASSUAN_LINELENGTH} or
505 @code{1002} bytes. The default is @code{8196}.
507 @item passphrase = string
508 The passphrase to use for this file. If specified in the @samp{global} section
509 then @samp{global} is treated as a data filename and not a default for other
510 files. Note that if a client changes the passphrase for this data file then
511 this value is not modified and will need to be updated.
513 @item passphrase_file = /path/to/file
514 Same as the @var{passphrase} parameter above but obtains the passphrase from
515 the specified filename.
517 @item recursion_depth = integer
518 The maximum number of times to resolve a @code{target} attribute for an
519 element in an element path (@pxref{Target Attribute}). An error is returned
520 when this value is exceeded.  The default is @code{100} but can be disabled by
521 setting to @code{0} (@emph{not recommended}).
523 @item allowed = [-]user,[-]@@group,...
524 Same parameter value as the @code{allowed} parameter mentioned above in
525 the @samp{global} section but grants or denies a local user from opening
526 a specific data file. The default is the same as the @samp{global} section.
527 @end table
529 @menu
530 * TLS::                   Remote connections over TLS.
531 * Pinentry::              Configuration file and defaults.
532 @end menu
534 @node TLS, Pinentry, Configuration, Configuration
535 @chapter Configuring remote connections over TLS.
536 @mansect TLS Configuration
537 Connections can also be made to @command{pwmd} over @abbr{TLS}.
538 Authentication is done by using X.509 client certificates which are signed
539 with the same Certificate Authority (@abbr{CA}) as the server certificate.
541 The @abbr{CA} certificate is expected to be found in
542 @file{~/.pwmd/ca-cert.pem} while the @command{pwmd} server certificate and key
543 file should be put in @file{~/.pwmd/server-cert.pem} and
544 @file{~/.pwmd/server-key.pem}, respectively.
546 See the documentation of @command{certtool} or @command{openssl} for details
547 on creating self-signed certificates.
549 The following TLS configuration options are available:
551 @table @samp 
552 @item enable_tcp = boolean
553 Whether to enable TCP/TLS server support. If enabled, both TCP and the local
554 unix domain socket will listen for connections. The default is
555 @code{false}.
557 @item tcp_port = integer
558 The TCP port to listen on when @var{enable_tcp} is @code{true}. The default is
559 @code{6466}.
561 @item tcp_bind = string
562 The internet protocol to listen with. Must be one of @code{ipv4}, @code{ipv6}
563 or @code{any} to listen for both IPv4 and IPv6 connections.
565 @item tcp_interface = string
566 Only useful if running as root.
568 @item tls_timeout = seconds
569 The number of seconds to wait for a read() or write() call on a
570 @abbr{TLS} client file descriptor to complete before returning an
571 error. The default is @var{300}.
573 Note that the @code{SAVE} command (@pxref{SAVE}) may take a longer time
574 to complete than other commands since key generation may need to be done
575 or do to a large @option{--cipher-iterations} setting.
577 @item keepalive_interval = seconds
578 Send a keepalive status message to an idle remote client.  An idle
579 client is one who is not in a command. The purpose of this status
580 message is to disconnect a hung remote client and release any file mutex
581 locks so another client may open the same data file. The default is @code{60}.
583 @item tcp_require_key = boolean
584 When @code{true}, require the remote client to provide the key or passphrase
585 to open a data file even if the file is cached. Note that the cache entry is
586 cleared during the @pxref{OPEN} command and the passphrase will be retrieved
587 from the client via a server @emph{INQUIRE}. This option is a default
588 for all files when specified in the @samp{global} section. The default
589 is @code{false}.
591 @item tcp_wait = integer
592 The time in tenths of a second to wait between TCP connections.  Setting to 0
593 will disable waiting. The default is @code{3}.
595 @item tls_cipher_suite = string
596 The GnuTLS cipher suite and protocol to use. See the GnuTLS documentation for
597 information about the format of this string. The default is @code{SECURE256}.
599 @item tls_dh_level = string
600 The security level (bits) of the generated key exchange parameters. Possible
601 values are @code{low}, @code{medium} or @code{high}. The default is
602 @code{medium}.
603 @end table
605 @node Pinentry, Commands, TLS, Configuration
606 @chapter Pinentry configuration
607 @mansect Pinentry
608 The @command{pinentry} program is used to prompt the user for passphrase
609 input or as a confirmation dialog; it needs to know where to prompt for
610 the input, beit from a terminal or an X11 display.
612 It is the responsibility of the client to tell @command{pinentry} about
613 the terminal or X11 display before requiring the input. This is done by
614 using the @command{pwmd} @code{OPTION} (@pxref{OPTION}) protocol command. It
615 need be done only once per client connection. To avoid the use of
616 @command{pinentry} entirely, use the @code{OPTION} (@pxref{OPTION})
617 @option{--disable-pinentry} protocol command.
619 @ifclear isman
620 @c    Node,     Next,    Previous, Up
621 @node Commands, Status Messages, Pinentry, Top
622 @chapter Protocol commands and their syntax
623 @include menu.texi
624 @include commands.texi
626 @c    Node,     Next,    Previous, Up 
627 @node Status Messages, Target Attribute, Commands, Top 
628 @chapter Status messages and their meanings
629 Some commands send status messages to inform the client about certain
630 operations or as a progress indicator.  Status messages begin with a
631 @code{KEYWORD} followed by a status description for status messages that
632 require it. What status messages are sent, when, and how often may depend on
633 configuration settings (@pxref{Configuration}). A status message sent from
634 @command{gpg-agent} (@inforef{Invoking GPG-AGENT,,gnupg}) is also forwarded to
635 the client.
637 @multitable @columnfractions .20 .25 .55
638 @headitem Message @tab Parameters @tab Description
639 @item CACHE
640 @cindex CACHE
641 @tab @code{<integer>}
642 @tab The number of cached documents. Sent to each client after connecting
643 (@pxref{GETINFO}) and after every cache modification.
645 @item CLIENTS
646 @cindex CLIENTS
647 @tab @code{<integer>}
648 @tab The number of connected clients (@pxref{GETINFO}). Sent to each client
649 when another client either connects or disconnects.
651 @item DECRYPT
652 @cindex DECRYPT
653 @tab @code{<current>} @code{<total>}
654 @tab Sent to the current client during a decrypt operation.
656 @item ENCRYPT
657 @cindex ENCRYPT
658 @tab @code{<current>} @code{<total>}
659 @tab Sent to the current client during an  encrypt operation.
661 @item GENKEY
662 @cindex GENKEY
663 @tab
664 @tab Sent once to the current client just before generating a new key-pair.
666 @item INQUIRE_MAXLEN
667 @cindex INQUIRE_MAXLEN
668 @tab @code{<bytes>}
669 @tab Sent to the client from @command{gpg-agent} when inquiring data. This
670 specifies the maximum number of bytes allowed for the client to send and
671 should not be exceeded.
673 @item KEEPALIVE
674 @cindex KEEPALIVE
675 @tab
676 @tab Sent to each idle client every @var{keepalive_interval}
677 (@pxref{Configuration}) seconds.
679 @item LOCKED
680 @cindex LOCKED
681 @tab
682 @tab Sent to the current client when another client is holding the lock for
683 the mutex associated with a file.
685 @item NEWFILE
686 @cindex NEWFILE
687 @tab
688 @tab Sent to the current client when the opened (@pxref{OPEN}) file does not
689 exist on the file-system.
691 @item XFER
692 @cindex XFER
693 @tab @code{<sent> <total>}
694 @tab Sent to the current client when transferring data. It has two space
695 delimited arguments. The first being the current amount of bytes transferred
696 and the other being the total bytes to be transferred.
698 @item STATE
699 @cindex STATE
700 @tab @code{<client_id> <state>}
701 @tab Sent to all connected clients to indicate that @var{client_id} has
702 changed to @var{state} (@pxref{GETINFO} to describe the available client
703 states).
704 @end multitable
706 @c    Node,     Next,    Previous, Up 
707 @node Target Attribute, Signals, Status Messages, Top 
708 @chapter The @code{target} attribute
709 @cindex target attribute
710 A @emph{case sensitive} attribute named @code{target} is treated specially
711 when found in each element of an element path. This attribute, like other
712 element attributes, is created or modified with the @code{ATTR} command
713 (@pxref{ATTR}). The value of this attribute is an existing element path
714 somewhere in the document.  If you are familiar with @abbr{XML} entities or
715 maybe the @abbr{HTML} @code{id} or @code{target} attributes or a symbolic link
716 in a file-system, you may find this attribute behaves similar to any of those.
718 To create a @code{target} attribute use the following syntax:
720 @example
721 ATTR SET target [!]element[@key{TAB}[!]child[..]] [!]element[@key{TAB}[!]child[..]]
722 @end example
724 Note the single space between the two element paths. The first element path is
725 where the @code{target} attribute will be created. If the element path does
726 not exist then it will be created.  This is the only time the @code{ATTR}
727 (@pxref{ATTR}) command will create elements. The attribute is created in the
728 final element of the first element path.
730 The second element path is the destination of where you want the first element
731 path to resolve to. When an element path is passed as an argument to a
732 protocol command @command{pwmd} looks for a @code{target} attribute when
733 resolving each element and, if found, "jumps" to the attribute value and
734 continues resolving any remaining elements.  When you want to avoid the
735 @code{target} attribute for any element of an element path then prefix the
736 element with the literal element character @samp{!}.
738 When an element of a element path is removed that a @code{target} attribute
739 resolves to then an error will occur when trying to access that element. You
740 may need to either update the @code{target} attribute value with a new element
741 path or remove the attribute entirely. Remember that since the element
742 contains the @code{target} attribute it will need to be prefixed with the
743 literal element character @samp{!} when specifying the element path to prevent
744 @command{pwmd} from trying to resolve the @code{target} attribute. For
745 example, to remove a @code{target} attribute for an element containing it:
747 @example
748 ATTR DELETE target path@key{TAB}to@key{TAB}!element
749 @end example
751 Clients should be careful of creating @code{target} loops, or targets that
752 resolve to themselves. See the @var{recursion_depth} (@pxref{Configuration})
753 configuration parameter for details.
755 The @code{REALPATH} command (@pxref{REALPATH}) can be used to show the element
756 path after resolving all @code{target} attributes.
759 @c    Node,     Next,    Previous, Up 
760 @node Signals, Concept Index, Target Attribute, Top
761 @chapter Recognized signals
762 @end ifclear
763 @mansect signals
764 Sending the @emph{SIGHUP} signal to a @command{pwmd} process will reload the
765 configuration file and sending @emph{SIGUSR1} will clear the entire file
766 cache.
768 @mansect see also
769 @ifset manverb
770 .BR gpg-agent (1),
771 .BR pinentry (1)
772 @end ifset
774 @ifclear isman
775 @c    Node,     Next,    Previous, Up 
776 @node Concept Index, , Signals, Top 
777 @unnumbered Concept Index
780 @c @printindex cp
781 @shortcontents 
782 @contents 
783 @end ifclear
784 @bye