tls: Disable TLS1.1 and CBC cipher suites by default.
[pwmd.git] / doc / pwmd.texi
blob6a2816a9e7ca6e91f2d10e2331d6a72ad1cdc029
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 * Bulk Commands::         Running multiple commands in sequence.
43 * Status Messages::       Status lines and their meaning.
44 * Target Attribute::      A kind of symbolic link.
45 * Other Attributes::      Other attributes specially handled by pwmd.
46 * Key Expiration::        What to do when a key expires.
47 * Signals::               Signals known to pwmd.
48 * Concept Index::         Index of concepts.
49 @end menu
51 @c    Node,     Next,    Previous, Up 
52 @node Introduction, Access Control,        , Top 
53 @chapter Overview of @command{pwmd} 
55 @manpage pwmd.1
56 @ifset manverb
57 .B pwmd
58 \- a univeral data server
59 @end ifset
61 @mansect synopsis
62 @ifset manverb
63 .B pwmd
64 [options] [file1] [...]
65 @end ifset
67 @mansect description
68 @dfn{Password Manager Daemon} (or @command{pwmd}) is a server that
69 applications connect to and send commands to put and get data
70 that is stored in an OpenPGP encrypted XML document. It mimics a
71 filesystem in a lot of ways including per element ACL's, but also has
72 the advantage of remote connections over TLS and a document cache. The
73 document cache is needed for a data file encrypted with keys stored on a
74 smartcard.
76 The server uses the Assuan protocol (@inforef{Implementation,,assuan}) which
77 is the same used by @command{gpg-agent}, @command{pinentry} and
78 @command{scdaemon}. It also uses @cite{libgpg-error} for error reporting with
79 @var{GPG_ERR_SOURCE_USER_1} being the error source.
80 @ifset isman
82 You can import an existing @command{pwmd} version @var{3.0.x} data file by
83 dumping the raw XML data with
84 .BR pwmd-dump(1)
85 to a file, then
86 importing that file by using @command{pwmd}'s @option{--import} command line
87 option. Please
88 see the
89 .BR pwmd-dump(1)
90 manual page for details.
92 It is recommended to read the texinfo documentation of @command{pwmd}
93 since it contains protocol commands and syntax and other details not
94 found here.
95 @end ifset
96 @manpause
98 The XML document uses the following DTD:
100 @example
101     <?xml version="1.0"?>
102     <!DOCTYPE pwmd [
103     <!ELEMENT pwmd (element*)>
104     <!ATTLIST element _name CDATA #REQUIRED>
105     ]>
106 @end example
108 The @code{pwmd} element is the document root node while all other elements
109 of the document have the name @code{element} with an attribute @code{_name}
110 whose value uniquely identifies the element at the current element tree depth.
111 It is done this way to avoid XML parsing errors for commonly used
112 characters.  A URL for example would be an invalid XML element
113 since the URI contains a @samp{:} which is also the XML
114 namespace separator.
116 As mentioned, an element name must be unique for the current element tree
117 depth. You cannot have two elements containing the same @code{_name} attribute
118 value. @command{pwmd} will stop searching for an element of an @emph{element
119 path} at the first match then continue searching for the next element of the
120 element path beginning at the child node of the matched element.
122 An @emph{element path} is a @code{TAB} delimited character string where each
123 @code{TAB} separates each element in the path.  For example, the element path
124 @code{a@code{TAB}b@code{TAB}c} has the following XML document structure:
126 @example
127         <pwmd>
128             <element _name="a">
129                 <element _name="b">
130                     <element _name="c">
131                         [... element value or content ...]
132                     </element>
133                 </element>
134             </element>
135         </pwmd>
136 @end example
138 The only restriction of an element name is that it contain no whitespace
139 characters.
141 @c    Node,     Next,    Previous, Up 
142 @node Access Control, Cache Control, Introduction, Top 
143 @chapter Access Control
145 Like a filesystem has an ACL to grant or limit access to directories or
146 files for a specific user or group, @command{pwmd} can limit a local user,
147 group or a TLS connection to a specific element path. This is done by
148 storing an ACL in the element attribute @var{_acl}. Its syntax is
149 similar to the @var{allowed} configuration parameter (@pxref{Configuration})
150 with the exception that a TLS fingerprint hash is prefixed with a
151 @code{#}.
153 Access is denied for all users that are not in the ACL of an element
154 with the exception of an invoking user (see the @var{invoking_user}). The
155 connected client must be in the ACL for each element in an element path
156 otherwise an error is returned.  As an example:
158 @example
159 <element _name="test" _acl="username,-@@wheel,root,#ABCDEF">
160         <element _name="child"/>
161 </element>
162 @end example
164 The user @code{username} would be allowed access to the @code{test} element
165 but not if it is a member of the @code{wheel} group although, the @code{root}
166 user, who may be a member of the @code{wheel} group, is allowed. The SHA-256
167 TLS fingerprint hash @code{#ABCDEF} is also allowed.  No users other than an
168 @var{invoking_user} are allowed access to the @code{child} element.
170 The first user listed in the ACL is considered the owner of the
171 element. This determines which clients may modify an @var{_acl} attribute and
172 store content for an element. An @var{invoking_user} may always modify an 
173 ACL.
175 @c    Node,     Next,    Previous, Up 
176 @node Cache Control, Invoking, Access Control, Top 
177 @chapter Cache Control
179 @mancont
180 @mansect cache notes
181 While @command{pwmd} has its own cache settings for an XML document,
182 @command{gpg-agent} has cache settings for the keys used for crypto operations
183 of a data file. Specifically the @option{ignore-cache-for-signing},
184 @option{default-cache-ttl} and @option{max-cache-ttl} options. These
185 @command{gpg-agent} options may need to be adjusted depending on your usage
186 needs. For example, the @code{OPEN} command may not require a passphrase to
187 open a data file do to the gpg-agent having a cached key even though the
188 @code{ISCACHED} command returns an error indicating the data file is not
189 cached; which usually means a passphrase would be required. Keys for symmetric
190 data files are never kept in the @command{gpg-agent} cache reguardless of
191 @command{gpg-agent} cache settings.
193 A copy-on-write operation is done for commands that modify the document; the
194 client that invoked the command will work on a copy of the in-memory document.
195 The first client to @code{SAVE} the changes to disk will require other clients
196 to reopen the data file do to the checksum being updated.
198 @c    Node,     Next,    Previous, Up 
199 @node Invoking, Configuration, Cache Control, Top 
200 @chapter Invoking @command{pwmd} 
202 @mansect options
203 @command{pwmd} uses GpgME for encryption, decryption and signing of the
204 OpenPGP data file. GpgME itself makes use of @command{gpg} for these
205 operations so some configuration of @command{gpg} may be needed.  Pwmd spawns
206 a separate @command{gpg-agent} process when @var{gpg_homedir}
207 (@pxref{Configuration}) is not set to an instance of an already running
208 gpg-agent. Any @command{gpg} configuration options that you need set should be
209 put in @var{~/.pwmd/.gnupg/gpg.conf} or the @var{gpg.conf} file located in
210 @var{gpg_homedir}. The same is true for the @var{gpg-agent.conf} file to set
211 any required @command{gpg-agent} options.
213 It is recommended to pass the @option{--allow-preset-passphrase}
214 option to @command{gpg-agent}. Doing so allows @command{pwmd}
215 cache pushing on startup. It is also recommended to pass the
216 @option{--allow-loopback-pinentry} to @command{gpg-agent} (this is the default
217 as of gnupg-2.1.15). This option allows a passphrase to be inquired from
218 @command{pwmd} when a @command{pinentry} is unavailable to the client
219 (@pxref{TLS}).
221 If you would like to use a keypair from your default gnupg keyring located in
222 ~/.gnupg, but would still like to use a separate gpg-agent process (the
223 default), you would need to first export the public key from the default
224 keyring then import it into the keyring that pwmd uses. You can do this by
225 first exporting the public key, then use the @option{--homedir ~/.pwmd/.gnupg}
226 option of @command{gpg} to import it into the new keyring. For private keys,
227 you would need to copy the private key associated with the exported public key
228 to @var{~/.pwmd/.gnupg/private-keys-v1.d}. If the private key is stored on
229 a smartcard you can also use the @code{KEYINFO --learn} command
230 (@pxref{KEYINFO}).
232 @cindex Running @command{pwmd} 
233 @command{pwmd} is executed as follows: 
235 @example 
236 pwmd @var{options} [ file1 ] [ @dots{} ]
237 @end example
239 Non-option arguments are data files to cache upon startup. When the data file
240 requires a passphrase for decryption a @command{pinentry} will prompt either
241 on the current TTY or from an X11 window when the @env{DISPLAY}
242 environment variable is set. @xref{Pinentry}.
244 @cindex Options 
245 @cindex Arguments 
246 The following command line options are supported:
248 @cindex Getting help 
249 @table @samp 
250 @item --debug protocol:level[,protocol:level]
251 Enable debugging output. This option can output sensitive information such as
252 passphrases and secret keys so care should be taken where the output gets
253 written to. The @var{protocol} is a single character representing the protocol
254 to log. Use @code{a} for @code{libassuan} with @var{level} being one or more
255 character flags: @code{i} for init, @code{x} for context, @code{e} for engine,
256 @code{d} for data, @code{s} for system IO or @code{c} for control.  To debug
257 @code{gpgme} use @code{g} as the @var{protocol} with @var{level} being an
258 integer from @code{1} to @code{9}. To enable @acronym{TLS} debugging output
259 use @code{t} as the @var{protocol} with @var{level} being an integer from
260 @code{1} to @code{9}. A value over @code{10} will enable all @acronym{TLS}
261 debugging output with @code{1} being the default.
263 @item --homedir directory
264 The root directory where pwmd will store its data and temporary files.  The
265 default is @file{~/.pwmd}.
267 @item --rcfile, -f rcfile
268 Specify an alternate configuration file. The default is
269 @file{~/.pwmd/config}.
271 @item --kill
272 Terminate an existing instance of pwmd. The process to terminate is determined
273 from the @option{--homedir} and @option{--rcfile} options.
275 @item --import, -I filename|-
276 Imports the XML @var{filename}. When @var{filename} is @code{-} the
277 XML is read from stdin. The XML file should be in conformance to
278 the @command{pwmd} DTD (@pxref{Introduction}). You will be prompted for
279 a passphrase to encrypt with.  The output is written to the filename specified
280 with @option{--outfile}. To make use of the imported data, place the output
281 file in @file{~/.pwmd/data}.
283 @item --output, -o filename|-
284 When importing, write the encrypted data file to @var{filename}. When
285 @var{filename} is @code{-} output will be written to stdout.
287 @item --passphrase-file, -k filename"
288 Obtain the passphrase to use when importing from the specified @var{filename}.
290 @item --keyid fingerprint[,fingerprint]
291 Specifies the fingerprint of the encryption key to use as a recipient when
292 importing. When not specified a new key-pair will be created.
294 @item --sign-keyid fingerprint
295 Specifies the fingerprint of the signing key to use for signing of the data
296 file when importing.  When not specified the signing key of the generated
297 key-pair or the signing key of the @option{--keyid} option will be used.
299 @item --symmetric, -s
300 Use symmetric or conventional encryption rather than pubic key encryption when
301 importing.  Signing is still possible by using the @option{--sign-keyid}
302 option. By default no signing is done when specifying this option.
304 @item --userid string
305 When importing, the user id used to identify the generated key. This should be
306 in the form @code{First Last <email>}.
308 @item --algo string
309 When importing, the algorithm to use when generating the new key pair. The
310 default is determined by @command{gpg}.
312 @item --expire seconds
313 When importing, the time, in seconds since epoch, when the generated key will
314 expire. Specifying @code{0} will never expire the key. The default is three
315 years.
317 @item --no-passphrase
318 When importing, don't require a passphrase for the generated key.
320 @item --disable-dump
321 Disable the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and @code{DUMP}
322 protocol commands (@pxref{Commands}). This overrides any
323 @var{disable_list_and_dump} configuration parameter (@pxref{Configuration}).
325 @item --no-fork, -n
326 Run as a foreground process and do not fork into the background.
328 @item --ignore, --force
329 Ignore cache pushing failures on startup. By default, @command{pwmd} will exit
330 if an error occurred do to an invalid passphrase or other error.
332 @item --version
333 Show the version, copyright and compile time features and exit.
335 @item --help 
336 Print a summary of options.
337 @end table
338 @manpause
340 @c    Node,     Next,    Previous, Up 
341 @node Configuration, TLS, Invoking, Top 
342 @chapter @command{pwmd} configuration file options
343 @mancont
344 @mansect configuration file
345 If no configuration file is specified with the @command{pwmd} @option{-f}
346 command line option, @command{pwmd} will read @file{~/.pwmd/config} if it
347 exists, and if not, will use defaults.  Blank lines and lines beginning with
348 @samp{#} are ignored. Some parameters may have data file specific settings by
349 placing them in a file section. A file section is declared by surrounding the
350 filename with braces (i.e., @samp{[filename]}).  Global options may be
351 specified in the @code{global} section @samp{e.g., [global]} and are the
352 default options for new or unspecified file sections.
354 A tilde @code{~} will be expanded to the home directory of the user starting
355 @command{pwmd} when contained in a parameter whose value is a filename.
357 @cindex Reloading the configuration file
358 The configuration file can be reloaded by sending the @emph{SIGHUP} signal to
359 a @command{pwmd} process. Some security sensitive settings may not be changed
360 until @command{pwmd} is restarted.
362 @cindex Global configuration options
363 The following options are only for use in the @code{[global]} section:
365 @table @samp 
366 @item socket_path = /path/to/socket
367 Listen on the specified socket. The default is @file{~/.pwmd/socket}.
369 @item socket_perms = octal_mode
370 Permissions to set after creating the socket. This will override any
371 @cite{umask(2)} setting.
373 @item backlog = integer
374 The number of connections to queue. When this limit is reached then new
375 connections will be refused. The default is @code{128}.
377 @item invoking_user = [-!]user,[-!]@@group,[-!]#SHA-256,...
378 This parameter is not to be confused with setuid or setguid upon startup. It's
379 syntax is the same as the @code{allowed} parameter except that it is a list of
380 local usernames, group names and TLS fingerprint hashes that may use the
381 @command{XPATH}, @command{XPATHATTR} and @command{DUMP} commands (except when
382 disabled with the @code{disable_list_and_dump} option) and also who may modify
383 elements that have no @code{_acl} attribute or is not listed in an
384 @code{_acl}. It is similar to the system administrator root account but for a
385 data file and element paths (@pxref{Access Control}). The default is the user
386 the executes @command{pwmd}.
388 @item invoking_file = filename
389 A file containing one entry per line. An entry has the same syntax as the
390 @code{invoking_user} parameter. When both this parameter and the
391 @code{invoking_user} parameter are specified then the @code{invoking_user}
392 parameter will behave as if the @code{invoking_file} entries have been
393 appended to the @code{invoking_user} parameter value.
395 @item strict_open = boolean
396 When @code{true}, disallow creation of a new data file when the current client
397 is not an @code{invoking_user}. The default is @code{false}.
399 @item strict_kill = boolean
400 When @code{false}, the @code{KILL} command (@pxref{KILL}) will allow killing
401 another client that is not of the same @code{UID} or TLS fingerprint of
402 the current client and when not an @code{invoking_user}. The default us
403 @code{false}.
405 @item allowed = [-!]user,[-!]@@group,[+,][-!]#SHA-256,...
406 A comma separated list of local user names, group names or TLS
407 fingerprint SHA-256 hashes (in the case of a remote client) who are
408 allowed to connect.  Groups should be prefixed with a @samp{@@}. When not
409 specified only the user who started @command{pwmd} may connect. A username,
410 group name or hash may also be prefixed with a @code{-} or @code{!} to prevent
411 access to a specific user or group in the list. The order of the list is
412 important since a user may be a member of multiple groups.
414 This parameter may also be specified in a filename section to allow or deny a
415 client to @code{OPEN} (@pxref{OPEN}) a data file. It also affects the cache
416 commands @code{CLEARCACHE} (@pxref{CLEARCACHE}) and @code{CACHETIMEOUT}
417 (@pxref{CACHETIMEOUT}). When not specified in a file section, any user that
418 can connect may also open any filename (provided they can decrypt it).
420 The following example would deny all users in group @code{primary} but
421 allow @code{username} who may be a member of @code{primary}. It will also
422 allow any TLS client except for the client with TLS fingerprint hash
423 @code{#ABCDEF}:
425 @example
426 allowed=-@@primary,username,+,!#ABCDEF
427 @end example
429 @item allowed_file = filename
430 A file containing one entry per line. An entry has the same syntax as the
431 @code{allowed} parameter. When both this parameter and the @code{allowed}
432 parameter are specified then the @code{allowed_file} entries will be appended
433 to the @code{allowed} parameter value.
435 @item encrypt_to = boolean
436 When @code{true} and @command{SAVE}'ing a data file, allow @command{gpg} to
437 append it's configured key to the list of recipients. The default is
438 @code{false} meaning that only keys specified with @command{SAVE}
439 @option{--keyid} are recipients.
441 @item always_trust = boolean
442 When @code{true}, allow encrypting to untrusted recipients or public
443 encryption keys. The default is @code{false}.
445 @item gpg_homedir = path
446 The location where @command{gpg} will store its public and private keys and
447 configuration. The default is @file{HOMEDIR/.gnupg} where @var{HOMEDIR} is the
448 default (@file{~/.pwmd}) or the value specified on the command line with the
449 @option{--homedir} command line option (@pxref{Invoking}). If you want to use
450 your standard @command{gpg} keyring then set this to @file{~/.gnupg}. Note
451 that a new instance of @command{gpg-agent} will be started when @emph{not}
452 using the standard keyring and that any configuration options for
453 @command{gpg-agent} will need to placed in
454 @file{HOMEDIR/.gnupg/gpg-agent.conf}.
456 @item disable_mlockall = boolean
457 When set to @code{false}, @cite{mlockall(2)} will be called on startup.  This
458 will use more physical memory but may also be more secure since no swapping to
459 disk will occur. The default is @var{true}. If possible, use an encrypted swap
460 file or partition and leave this set to @var{true}.
462 @item log_path = /path/to/logfile
463 Logs informational messages to the specified file. The default is
464 @file{~/.pwmd/log}.
466 @item enable_logging = boolean
467 Enable or disable logging to @var{log_path}. The default is @code{false}.
469 @item log_keepopen = boolean
470 When set to @code{false}, the log file specified with @var{log_path} will be
471 closed after writing each line. The default is @code{true}.
473 @item syslog = boolean
474 Enable logging to @cite{syslog(8)} with facility @emph{LOG_DAEMON} and priority
475 @emph{LOG_INFO}. The default is @code{false}.
477 @item log_level = level
478 When @code{0}, only connections and errors are logged. When @code{1}, data
479 file recipients and signers are logged during @code{OPEN} (@pxref{OPEN}) and
480 @code{SAVE} (@pxref{SAVE}). When @code{2}, client commands are also logged.
481 The default is @code{0}.
483 @item kill_scd = boolean
484 Attempt to kill @command{scdaemon} after a client disconnects.  The default is
485 @code{false}.
487 @item disable_list_and_dump = boolean
488 When @code{true}, the @code{XPATH}, @code{XPATHATTR}, @code{LIST} and
489 @code{DUMP} protocol commands (@pxref{Commands}) will be disabled.
491 @item cache_push = file1,file2
492 A comma separated list of filenames that will be pushed into the file cache
493 upon startup. @command{pwmd} will prompt for the passphrase for each file
494 unless specified with @var{passphrase_file} parameter in a matching file
495 section.
497 @item priority = integer
498 The priority, or niceness, of the server. The default is inherited from the
499 parent process.
501 @item lock_timeout = integer
502 The default timeout in tenths of a second before giving up waiting for a file
503 lock and returning an error. The default is @code{50}.
505 @end table
507 @cindex Data file configuration options
508 @ifset manverb
510 @end ifset
511 The following options are defaults for new files when specified in the
512 @samp{global} section. When placed in a data file section they are options
513 specific to that data file only.
515 @table @samp 
516 @item require_save_key = boolean
517 Require the passphrase needed for signing before writing changes of the
518 document to disk reguardless of the key cache status. The default is
519 @code{true}. This option compliments @command{gpg-agent} option
520 @option{--ignore-cache-for-signing} and is used as a fail-safe.
522 @item backup = boolean
523 Whether to create a backup of the data file when saving. The backup filename
524 has the @file{.backup} extension appended to the opened file. The default is
525 @code{true}. 
527 @item cache_timeout = seconds
528 The number of seconds to keep the cache entry for this file. If @code{-1}, the
529 cache entry is kept forever. If @code{0}, each time an encrypted file is
530 @code{OPEN}ed (@pxref{OPEN}) a passphrase will be required. The default
531 is @code{600} or 10 minutes.
533 @item passphrase_file = /path/to/filename
534 Obtain the passphrase to open the data file from @var{filename}. If specified
535 in the @samp{global} section then the @var{passphrase_file} is a default for
536 all data files. Note that if a client changes the passphrase for this data
537 file then the @var{passphrase_file} will need to be updated with the new
538 passphrase.
540 @item recursion_depth = integer
541 The maximum number of times to resolve a @code{_target} attribute for an
542 element in an element path (@pxref{Target Attribute}). An error is returned
543 when this value is exceeded.  The default is @code{100} but can be disabled by
544 setting to @code{0} (@emph{not recommended}).
546 @item allowed = [-]user,[-]@@group,[!]#TLSFINGERPRINT,...
547 Same parameter value as the @code{allowed} parameter mentioned above in
548 the @samp{[global]} section but grants or denies a client from opening a
549 specific data file. The default is to allow any client that is allowed to
550 connect.
552 @end table
553 @menu
554 * TLS::                   Remote connections over TLS.
555 * Pinentry::              Configuration file and defaults.
556 @end menu
558 @node TLS, Pinentry, Configuration, Configuration
559 @chapter Configuring remote connections over TLS.
560 @ifset manverb
562 @end ifset
563 Remote connections can also be made to @command{pwmd} over TLS.
564 Authentication is done by using X.509 client certificates that are signed with
565 the same Certificate Authority (CA) as the server certificate.
567 The CA certificate is expected to be found in
568 @file{~/.pwmd/ca-cert.pem} while the @command{pwmd} server certificate and key
569 file should be put in @file{~/.pwmd/server-cert.pem} and
570 @file{~/.pwmd/server-key.pem}, respectively.
572 See the documentation of @command{certtool} or @command{openssl} for details
573 about creating self-signed certificates.
575 The following TLS configuration options are available:
577 @table @samp 
578 @item enable_tcp = boolean
579 Whether to enable TCP/TLS server support. If enabled, both TCP and the local
580 unix domain socket will listen for connections. The default is
581 @code{false}.
583 @item tcp_port = integer
584 The TCP port to listen on when @var{enable_tcp} is @code{true}. The default is
585 @code{6466}.
587 @item tcp_bind = string
588 The internet protocol to listen with. Must be one of @code{ipv4}, @code{ipv6}
589 or @code{any} to listen for both IPv4 and IPv6 connections. The default is
590 @code{any}.
592 @item tcp_interface = string
593 Only useful if running as root.
595 @item tls_timeout = seconds
596 The number of seconds to wait for a read() or write() call on a
597 TLS client file descriptor to complete before returning an
598 error. The default is @var{300}.
600 @item keepalive_interval = seconds
601 Send a keepalive status message to an idle remote client.  An idle
602 client is one that is not in a command. The purpose of this status
603 message is to disconnect a hung remote client and release any file mutex
604 locks so another client may open the same data file. The default is @code{60}.
606 @item tcp_require_key = boolean
607 When @code{true}, require the remote client to provide the passphrase to open
608 a data file even if the file is cached.  This option is a default for all
609 files when specified in the @samp{[global]} section. The default is
610 @code{false}.
612 @item tls_cipher_suite = string
613 The GnuTLS cipher suite and protocol to use. See the GnuTLS documentation for
614 information about the format of this string. The default is
615 @code{SECURE256:SECURE192:SECURE128:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-AES-128-CBC:-AES-256-CBC}.
617 @item tls_dh_params_file = filename
618 The PEM encoded filename containing DH parameters. If not specified
619 then DH algorithms will not be available to the client. See the
620 @command{openssl dhparam} or @command{certtool} manual pages for details about
621 generating this file.
623 Note that SIGHUP will not reload this file once TLS support has been enabled.
624 You will need to restart @command{pwmd} for changes to take effect.
626 @item tls_use_crl = boolean
627 When @code{true}, enabling reading of @file{~/.pwmd/crl.pem}. This
628 file is an X.509 Certificate Revocation List and can be used to deny clients
629 by adding client certificates to it. The default is @code{false}.
630 @command{pwmd} will need to be restarted to recognize any changes to this
631 file.
632 @end table
634 @node Pinentry, Commands, TLS, Configuration
635 @chapter Pinentry configuration
636 @mansect Pinentry
637 The @command{pinentry} program is used to prompt the user for passphrase
638 input or as a confirmation dialog; it needs to know where to prompt for
639 the input, beit from a terminal or an X11 display.
641 It is the responsibility of the client to tell @command{pinentry} about the
642 terminal or X11 display before requiring the input. This is done with the
643 @command{OPTION} command (@pxref{OPTION}) to either set or unset needed
644 @command{pwmd} environment variables and by using the
645 @command{gpg-connect-agent} program. Please read it's documentation about the
646 @emph{UPDATESTARTUPTTY} command.
648 @ifclear isman
649 @c    Node,     Next,    Previous, Up
650 @node Commands, Bulk Commands, Pinentry, Top
651 @chapter Protocol commands and their syntax
652 @include menu.texi
653 @include commands.texi
655 @c    Node,     Next,    Previous, Up
656 @node Bulk Commands, Status Messages, Commands, Top
657 @chapter Running multiple commands in sequence
658 Multiple commands may be run in sequence by using the @code{BULK} command
659 (@pxref{BULK}). Using this feature may speed up remote connections since less
660 socket IO is needed. The @code{BULK} command uses an @emph{INQUIRE} to obtain
661 an canonical s-expression of commands to be run. The s-expression syntax is as
662 follows:
664 @example
665 (2:id<I>:<id> <P>:<prot><D>:[<data>] [2:rc<R>:<code>[|<code>...](2:id...) | 2:id...])
666 @end example
668 Each token is prefixed with an unsigned integer that specifies the length of
669 the token, followed by a colon '@code{:}', followed by the token itself. Pwmd
670 uses token pairs to create a @emph{name=value} relationship. Whitespace is
671 allowed between token pairs. For example, the following is valid:
673 @example
674 ( 2:id 7:FirstID 4:LIST0: 2:rc 1:0 (2:id6:Second 7:GETINFO7:version))
675 @end example
677 The @code{id} token begins a new command and requires an @var{<id>} token
678 of length @var{<I>} to uniquely identify this command. The next token pair is
679 the protocol command name, without any command arguments, of length @var{<P>}
680 to run followed by a colon '@code{:}', followed by the command @var{<prot>}
681 itself, followed by the length @var{<D>} of both command arguments and data,
682 followed by a colon '@code{:}' and finally the @var{<data>} itself.  If no
683 arguments or data are needed for the command, set the length of the data
684 @var{<D>} to @code{0} and append the required colon '@code{:}'.
686 A new command enclosed in parentheses may be run when the previous command
687 returns an error code that matches the @var{<code>} token of length @var{<R>}
688 by appending @var{rc} tokens to the end of the previous commands @var{<data>}
689 token. You may also test another return code for the previous command by
690 placing the next @var{rc} token at the end of the closing parentheses of the
691 previous return code command.
693 Multiple @code{rc} @var{code}'s may be specified for a single command by
694 separating them with a pipe @code{|} character. This lets you specify an
695 @emph{if-this-and-that} expression for a commands return code.
697 If another command is to be run after the previous and does not specify an
698 @var{rc} token, the return value is ignored for the previous command and the
699 next command is run.  There is no limit on the number of commands or
700 sub-commands except for system memory.
702 After inquiring the commands to be run, @code{BULK} will run each command with
703 @var{<data>} as its argument and store the result code and data of the command
704 in a @code{bulk-result} canonical s-expression of the syntax:
706 @example
707 (11:bulk-result2:id<I>:<id>2:rc<R>:<code><D>:[<data>][2:id...])
708 @end example
710 The @code{11:bulk-result} token begins the result of all commands. The
711 @var{<id>} token of length @var{<I>} is the same that was associated with the
712 command from the @emph{INQUIRE}'d syntax and is prefixed with @code{2:id}. The
713 return code of the command is prefixed with @code{2:rc} followed by the length
714 @var{<R>} of the unsigned integer @var{<code>} then the return @var{<code>}
715 itself.  If the command returned any @var{<data>}, it is prefixed with a
716 length @var{<D>} and immediately following the return @var{<code>}. Otherwise,
717 @var{<D>} will be @code{0} and followed by a colon '@code{:}'.
720 @c    Node,     Next,    Previous, Up 
721 @node Status Messages, Target Attribute, Bulk Commands, Top
722 @chapter Status messages and their meanings
723 Some commands send status messages to inform the client about certain
724 operations or as a progress indicator.  Status messages begin with a
725 @code{KEYWORD} followed by a status description for status messages that
726 require it. What status messages are sent, when, and how often may depend on
727 configuration settings (@pxref{Configuration}).
729 @multitable @columnfractions .20 .25 .55
730 @headitem Message @tab Parameters @tab Description
731 @item CACHE
732 @cindex CACHE
733 @tab @code{<integer>}
734 @tab The number of cached documents. Sent to each client after connecting
735 (@pxref{GETINFO}) and after every cache modification.
737 @item CLIENTS
738 @cindex CLIENTS
739 @tab @code{<integer>}
740 @tab The number of connected clients (@pxref{GETINFO}). Sent to each client
741 when another client either connects or disconnects.
743 @item DECRYPT
744 @cindex DECRYPT
745 @tab
746 @tab Sent to the current client during a decrypt operation. How often this
747 status message is sent is determined by the @code{keepalive_interval}
748 (@pxref{Configuration}) setting.
750 @item ENCRYPT
751 @cindex ENCRYPT
752 @tab
753 @tab Sent to the current client during an encrypt operation. How often this
754 status message is sent is determined by the @code{keepalive_interval}
755 (@pxref{Configuration}) setting.
757 @item GENKEY
758 @cindex GENKEY
759 @tab @code{[<sigkey_fpr> <pubkey_fpr>]}
760 @tab Sent to the current client during key generation. How often this
761 status message is sent is determined by the @code{keepalive_interval}
762 (@pxref{Configuration}) setting. The @var{sigkey_fpr} and @var{pubkey_fpr}
763 parameters are added when key generation has completed.
765 @item INQUIRE_MAXLEN
766 @cindex INQUIRE_MAXLEN
767 @tab @code{<bytes>}
768 @tab Sent to the client from @command{gpg-agent} when inquiring data. This
769 specifies the maximum number of bytes allowed for the client to send and
770 should not be exceeded.
772 @item KEEPALIVE
773 @cindex KEEPALIVE
774 @tab
775 @tab Sent to each idle client every @var{keepalive_interval}
776 (@pxref{Configuration}) seconds.
778 @item LOCKED
779 @cindex LOCKED
780 @tab
781 @tab Sent to the current client when another client is holding the lock for
782 the mutex associated with a file. How often this status message is sent is
783 determined by the @code{keepalive_interval} (@pxref{Configuration}) setting.
785 @item NEWFILE
786 @cindex NEWFILE
787 @tab
788 @tab Sent to the current client when the opened (@pxref{OPEN}) file does not
789 exist on the file-system.
791 @item XFER
792 @cindex XFER
793 @tab @code{<sent> <total>}
794 @tab Sent to the current client when transferring data. It has two space
795 delimited arguments. The first being the current amount of bytes transferred
796 and the other being the total bytes to be transferred. Note that since version
797 @code{3.1.1} of @command{pwmd} this status message is sent only once and
798 before the transfer begins with the @var{total} argument set to the size of the
799 data and the @var{sent} argument set to @code{0} leaving it to the client to
800 determine the progress of the transfer as the data is received.
802 @item STATE
803 @cindex STATE
804 @tab @code{<client_id> <state>}
805 @tab Sent to each client to indicate that @var{client_id} has changed to
806 @var{state} (@pxref{GETINFO} for client states). For a client to receive
807 another clients state the option @var{CLIENT-STATE} must be set.
808 @xref{OPTION} command.
810 @item EXPIRE
811 @cindex EXPIRE
812 @tab @code{<epoch_seconds> <epoch_future>|0}
813 @tab Sent to the current client when @code{GET} (@pxref{GET}) encounters an
814 @code{_expire} (@pxref{Other Attributes}) attribute that is in the past or when
815 @code{STORE} (@pxref{STORE}) updates the @code{_expire} attribute from the
816 @code{_age} attribute value. The second field will be @code{0} when @code{GET}
817 sends this status message.  Otherwise the second field is the time the next
818 expiry will be.
820 @item PASSPHRASE_HINT
821 @cindex PASSPHRASE_HINT
822 @tab <keyid> <userid>
823 @tab Forwarded from @code{GpgME}. Contains information that is useful in a
824 @command{pinentry}. Only sent when pinentry is disabled (@pxref{OPTION}).
826 @item PASSPHRASE_INFO
827 @cindex PASSPHRASE_INFO
828 @tab <flags> ...
829 @tab Forwarded from @code{GpgME}. Contains information that is useful in a
830 @command{pinentry}. Only sent when pinentry is disabled (@pxref{OPTION}).
832 @item REHANDSHAKE
833 @cindex REHANDSHAKE
834 @tab
835 @tab Sent to each TLS client just before performing a cipher renegotiation
836 after a SIGHUP signal was received.
838 @item BULK
839 @cindex BULK
840 @tab @code{BEGIN|END <command id>}
841 @tab Sent to the current client before and after the @code{BULK} command
842 (@pxref{BULK}) runs each command. The @var{<command id>} is the same that was
843 associated with the command in the s-expression syntax.
844 @end multitable
846 @c    Node,     Next,    Previous, Up 
847 @node Target Attribute, Other Attributes, Status Messages, Top
848 @chapter The @code{target} attribute
849 @cindex target attribute
850 A @emph{case sensitive} attribute named @code{_target} is treated specially
851 when found in each element of an element path. This attribute, like other
852 element attributes, is created or modified with the @code{ATTR} command
853 (@pxref{ATTR}). The value of this attribute is an existing element path
854 somewhere in the document.  If you are familiar with XML entities or
855 maybe the HTML @code{id} or @code{_target} attributes or a symbolic link
856 in a file-system, you may find this attribute behaves similar to any of those.
858 To create a @code{_target} attribute use the following syntax:
860 @example
861 ATTR SET _target element[@code{TAB}child[..]] element[@code{TAB}child[..]]
862 @end example
864 Note the single space between the two element paths. The first element path is
865 where the @code{_target} attribute will be created. If the element path does
866 not exist then it will be created.  This is the only time the @code{ATTR}
867 (@pxref{ATTR}) command will create elements. The attribute is created in the
868 final element of the element path.
870 The second element path is the destination of where you want the first element
871 path to resolve to. When an element path is passed as an argument to a
872 protocol command @command{pwmd} looks for a @code{_target} attribute when
873 resolving each element and, if found, "jumps" to the attribute value and
874 continues resolving any remaining elements a commands element path.
876 When an element of a element path is removed that a @code{_target} attribute
877 resolves to then an error will occur when trying to access that element. You
878 may need to either update the @code{_target} attribute value with a new element
879 path or remove the attribute entirely.
881 Clients should be careful of creating @code{_target} loops, or targets that
882 resolve to themselves. See the @var{recursion_depth} (@pxref{Configuration})
883 configuration parameter for details.
885 The @code{REALPATH} command (@pxref{REALPATH}) can be used to show the element
886 path after resolving all @code{_target} attributes.
888 @emph{Note that when setting this attribute any children of the element will
889 be removed.}
892 @c    Node,     Next,    Previous, Up 
893 @node Other Attributes, Key Expiration, Target Attribute, Top
894 @chapter Other special attributes
895 @cindex special attributes
896 In addition to the @code{_target} attribute (@pxref{Target Attribute}), there
897 are a few other attributes that are specially handled by @command{pwmd}. The
898 first is the @code{_ctime} attribute which is set to the current time when an
899 element is created. Next is the @code{_mtime} attribute which is created when
900 an element is created and also updated when an element is modified. Neither of
901 these attributes may be modified by the client. The @code{_acl} attribute
902 controls access to the element, beit modifying or accessing element content,
903 or descending into child elements.  @xref{Access Control} for details. The
904 @code{_name} attribute contains the name of an element.
906 The above mentioned attributes are considered reserved attribute names.
907 Reserved attributes are treated specially when a @code{_target} attribute is
908 found for the current element. The @code{ATTR LIST} command will show these
909 attribute values for the current element and not the attribute values for the
910 resolved @code{_target} element. All other non-reserved attributes for the
911 resolved @code{_target} are appended to the @code{ATTR LIST} command output.
912 Other @code{ATTR} commands (@pxref{ATTR}) behave as usual. You can, for
913 example, @code{ATTR DELETE} a non-reserved attribute for an element that
914 contains a @code{_target} attribute. The resolved target elements' attribute
915 will be removed rather than the element containing the @code{_target}
916 attribute.
918 Another specially handled attribute is the @code{_expire} attribute. This
919 attribute value, like the @code{_ctime} and @code{_mtime} attributes, is a
920 timestamp. But this timestamp is usually in the future and for use with the
921 @code{GET} (@pxref{GET}) and @code{STORE} (@pxref{STORE}) commands. When the
922 @code{GET} command is issued, it checks for an @code{_expire} attribute an
923 compares its' value with the current time. If the @code{_expire} timestamp is
924 in the past then a status message is sent (@pxref{Status Messages}) to inform
925 the client that the element content should be updated.  When the content for
926 an element containing an @code{_expire} attribute is set when using the
927 @code{STORE} command, the value of the @code{_age} attribute is added to the
928 current time and the @code{_expire} attribute value is updated.  When no
929 @code{_age} attribute is found, no modification is done of the @code{_expire}
930 attribute.
933 @c    Node,     Next,    Previous, Up 
934 @node Key Expiration, Signals, Other Attributes, Top
935 @chapter Key Expiration
936 @cindex key expiration
937 When a key used for signing a data file has expired there is no indication
938 until the next @code{SAVE} command is sent. The command will fail since one
939 cannot sign the data file with an expired key. The client will need to either
940 use a different key for signing by either specifying an existing non-expired
941 key, generate a new key, or change the expire time of the existing key with
942 @command{gpg}.
944 To change the expiration of the currently used signing key with @command{gpg},
945 use the @code{KEYINFO} command (@pxref{KEYINFO}) to obtain the fingerprint of
946 the signing key of the current data file, then change the expire time with
947 @command{gpg}:
949 @example
950 gpg --homedir ~/.pwmd/.gnupg --edit-key <fingerprint>
951 @end example
953 Then use the @code{expire} command to set the new key expire date. When
954 finished, use the @code{save} command to save your changes.
957 @c    Node,     Next,    Previous, Up
958 @node Signals, Concept Index, Key Expiration, Top
959 @chapter Recognized signals
960 @end ifclear
961 @mansect signals
962 Sending the @emph{SIGHUP} signal to a @command{pwmd} process will reload the
963 configuration file and sending @emph{SIGUSR1} will clear the entire file
964 cache.
966 @mansect see also
967 @ifset manverb
968 .BR pwmd-dump (1)
970 .BR gpg-agent (1)
972 .BR pinentry (1)
974 .BR gpg (1)
975 @end ifset
977 @ifclear isman
978 @c    Node,     Next,    Previous, Up 
979 @node Concept Index, , Signals, Top 
980 @unnumbered Concept Index
983 @c @printindex cp
984 @shortcontents 
985 @contents 
986 @end ifclear
987 @bye