1 @c Copyright (C) 2004, 2008 Free Software Foundation, Inc.
2 @c This is part of the GnuPG manual.
3 @c For copying conditions, see the file GnuPG.texi.
10 GnuPG comes with a couple of smaller tools:
13 * watchgnupg:: Read logs from a socket.
14 * gpgv:: Verify OpenPGP signatures.
15 * addgnupghome:: Create .gnupg home directories.
16 * gpgconf:: Modify .gnupg home directories.
17 * applygnupgdefaults:: Run gpgconf for all users.
18 * gpg-preset-passphrase:: Put a passphrase into the cache.
19 * gpg-connect-agent:: Communicate with a running agent.
20 * dirmngr-client:: How to use the Dirmngr client tool.
21 * gpgparsemail:: Parse a mail message into an annotated format
22 * symcryptrun:: Call a simple symmetric encryption tool.
23 * gpg-zip:: Encrypt or sign files into an archive.
31 @section Read logs from a socket
34 \- Read and print logs from a socket
46 Most of the main utilities are able to write their log files to a Unix
47 Domain socket if configured that way. @command{watchgnupg} is a simple
48 listener for such a socket. It ameliorates the output with a time stamp
49 and makes sure that long lines are not interspersed with log output from
50 other utilities. This tool is not available for Windows.
54 @command{watchgnupg} is commonly invoked as
57 watchgnupg --force ~/.gnupg/S.log
62 This starts it on the current terminal for listening on the socket
63 @file{~/.gnupg/S.log}.
67 @command{watchgnupg} understands these options:
73 Delete an already existing socket file.
75 @anchor{option watchgnupg --tcp}
77 Instead of reading from a local socket, listen for connects on TCP port
82 Enable extra informational output.
86 Print version of the program and exit.
90 Display a brief help page and exit.
99 $ watchgnupg --force /home/foo/.gnupg/S.log
102 This waits for connections on the local socket
103 @file{/home/foo/.gnupg/S.log} and shows all log entries. To make this
104 work the option @option{log-file} needs to be used with all modules
105 which logs are to be shown. The value for that option must be given
106 with a special prefix (e.g. in the conf file):
109 log-file socket:///home/foo/.gnupg/S.log
112 For debugging purposes it is also possible to do remote logging. Take
113 care if you use this feature because the information is send in the
114 clear over the network. Use this syntax in the conf files:
117 log-file tcp://192.168.1.1:4711
120 You may use any port and not just 4711 as shown above; only IP addresses
121 are supported (v4 and v6) and no host names. You need to start
122 @command{watchgnupg} with the @option{tcp} option. Note that under
123 Windows the registry entry @var{HKCU\Software\GNU\GnuPG:DefaultLogFile}
124 can be used to change the default log output from @code{stderr} to
125 whatever is given by that entry. However the only useful entry is a TCP
126 name for remote debugging.
133 @command{gpg-agent}(1),
134 @command{scdaemon}(1)
136 @include see-also-note.texi
148 @manpage addgnupghome.8
150 @section Create .gnupg home directories.
153 \- Create .gnupg home directories
160 .IR account_2 ... account_n
164 If GnuPG is installed on a system with existing user accounts, it is
165 sometimes required to populate the GnuPG home directory with existing
166 files. Especially a @file{trustlist.txt} and a keybox with some
167 initial certificates are often desired. This scripts help to do this
168 by copying all files from @file{/etc/skel/.gnupg} to the home
169 directories of the accounts given on the command line. It takes care
170 not to overwrite existing GnuPG home directories.
173 @command{addgnupghome} is invoked by root as:
176 addgnupghome account1 account2 ... accountn
185 @section Modify .gnupg home directories.
188 \- Modify .gnupg home directories
195 .B \-\-list-components
204 .B \-\-change-options
210 The @command{gpgconf} is a utility to automatically and reasonable
211 safely query and modify configuration files in the @file{.gnupg} home
212 directory. It is designed not to be invoked manually by the user, but
213 automatically by graphical user interfaces (GUI).@footnote{Please note
214 that currently no locking is done, so concurrent access should be
215 avoided. There are some precautions to avoid corruption with
216 concurrent usage, but results may be inconsistent and some changes may
217 get lost. The stateless design makes it difficult to provide more
220 @command{gpgconf} provides access to the configuration of one or more
221 components of the GnuPG system. These components correspond more or
222 less to the programs that exist in the GnuPG framework, like GnuPG,
223 GPGSM, DirMngr, etc. But this is not a strict one-to-one
224 relationship. Not all configuration options are available through
225 @command{gpgconf}. @command{gpgconf} provides a generic and abstract
226 method to access the most important configuration options that can
227 feasibly be controlled via such a mechanism.
229 @command{gpgconf} can be used to gather and change the options
230 available in each component, and can also provide their default
231 values. @command{gpgconf} will give detailed type information that
232 can be used to restrict the user's input without making an attempt to
235 @command{gpgconf} provides the backend of a configuration editor. The
236 configuration editor would usually be a graphical user interface
237 program, that allows to display the current options, their default
238 values, and allows the user to make changes to the options. These
239 changes can then be made active with @command{gpgconf} again. Such a
240 program that uses @command{gpgconf} in this way will be called GUI
241 throughout this section.
244 * Invoking gpgconf:: List of all commands and options.
245 * Format conventions:: Formatting conventions relevant for all commands.
246 * Listing components:: List all gpgconf components.
247 * Checking programs:: Check all programs know to gpgconf.
248 * Listing options:: List all options of a component.
249 * Changing options:: Changing options of a component.
250 * Listing global options:: List all global options.
251 * Files used by gpgconf:: What files are used by gpgconf.
255 @node Invoking gpgconf
256 @subsection Invoking gpgconf
259 One of the following commands must be given:
263 @item --list-components
264 List all components. This is the default command used if none is
267 @item --check-programs
268 List all available backend programs and test whether they are runnable.
270 @item --list-options @var{component}
271 List all options of the component @var{component}.
273 @item --change-options @var{component}
274 Change the options of the component @var{component}.
276 @item --check-options @var{component}
277 Check the options for the component @var{component}.
279 @item --apply-defaults
280 Update all configuration files with values taken from the global
281 configuration file (usually @file{/etc/gnupg/gpgconf.conf}).
283 @item --list-dirs [@var{names}]
284 Lists the directories used by @command{gpgconf}. One directory is
285 listed per line, and each line consists of a colon-separated list where
286 the first field names the directory type (for example @code{sysconfdir})
287 and the second field contains the percent-escaped directory. Although
288 they are not directories, the socket file names used by
289 @command{gpg-agent} and @command{dirmngr} are printed as well. Note
290 that the socket file names and the @code{homedir} lines are the default
291 names and they may be overridden by command line switches. If
292 @var{names} are given only the directories or file names specified by
293 the list names are printed without any escaping.
295 @item --list-config [@var{filename}]
296 List the global configuration file in a colon separated format. If
297 @var{filename} is given, check that file instead.
299 @item --check-config [@var{filename}]
300 Run a syntax check on the global configuration file. If @var{filename}
301 is given, check that file instead.
303 @item --reload [@var{component}]
305 Reload all or the given component. This is basically the same as sending
306 a SIGHUP to the component. Components which don't support reloading are
309 @item --launch [@var{component}]
311 If the @var{component} is not already running, start it.
312 @command{component} must be a daemon. This is in general not required
313 because the system starts these daemons as needed. However, external
314 software making direct use of @command{gpg-agent} or @command{dirmngr}
315 may use this command to ensure that they are started.
317 @item --kill [@var{component}]
319 Kill the given component. Components which support killing are
320 gpg-agent and scdaemon. Components which don't support reloading are
321 ignored. Note that as of now reload and kill have the same effect for
324 @item --create-socketdir
325 @opindex create-socketdir
326 Create a directory for sockets below /run/user or /var/run/user. This
327 is command is only required if a non default home directory is used
328 and the /run based sockets shall be used. For the default home
329 directory GnUPG creates a directory on the fly.
331 @item --remove-socketdir
332 @opindex remove-socketdir
333 Remove a directory created with command @option{--create-socketdir}.
340 The following options may be used:
345 @itemx --output @var{file}
346 Write output to @var{file}. Default is to write to stdout.
350 Outputs additional information while running. Specifically, this
351 extends numerical field values by human-readable descriptions.
356 Try to be as quiet as possible.
360 Do not actually change anything. This is currently only implemented
361 for @code{--change-options} and can be used for testing purposes.
365 Only used together with @code{--change-options}. If one of the
366 modified options can be changed in a running daemon process, signal
367 the running daemon to ask it to reparse its configuration file after
370 This means that the changes will take effect at run-time, as far as
371 this is possible. Otherwise, they will take effect at the next start
372 of the respective backend programs.
377 @node Format conventions
378 @subsection Format conventions
380 Some lines in the output of @command{gpgconf} contain a list of
381 colon-separated fields. The following conventions apply:
385 The GUI program is required to strip off trailing newline and/or
386 carriage return characters from the output.
389 @command{gpgconf} will never leave out fields. If a certain version
390 provides a certain field, this field will always be present in all
391 @command{gpgconf} versions from that time on.
394 Future versions of @command{gpgconf} might append fields to the list.
395 New fields will always be separated from the previously last field by
396 a colon separator. The GUI should be prepared to parse the last field
397 it knows about up until a colon or end of line.
400 Not all fields are defined under all conditions. You are required to
401 ignore the content of undefined fields.
404 There are several standard types for the content of a field:
408 Some fields contain strings that are not escaped in any way. Such
409 fields are described to be used @emph{verbatim}. These fields will
410 never contain a colon character (for obvious reasons). No de-escaping
411 or other formatting is required to use the field content. This is for
412 easy parsing of the output, when it is known that the content can
413 never contain any special characters.
415 @item percent-escaped
416 Some fields contain strings that are described to be
417 @emph{percent-escaped}. Such strings need to be de-escaped before
418 their content can be presented to the user. A percent-escaped string
419 is de-escaped by replacing all occurrences of @code{%XY} by the byte
420 that has the hexadecimal value @code{XY}. @code{X} and @code{Y} are
421 from the set @code{0-9a-f}.
424 Some fields contain strings that are described to be @emph{localised}.
425 Such strings are translated to the active language and formatted in
426 the active character set.
428 @item @w{unsigned number}
429 Some fields contain an @emph{unsigned number}. This number will
430 always fit into a 32-bit unsigned integer variable. The number may be
431 followed by a space, followed by a human readable description of that
432 value (if the verbose option is used). You should ignore everything
433 in the field that follows the number.
435 @item @w{signed number}
436 Some fields contain a @emph{signed number}. This number will always
437 fit into a 32-bit signed integer variable. The number may be followed
438 by a space, followed by a human readable description of that value (if
439 the verbose option is used). You should ignore everything in the
440 field that follows the number.
442 @item @w{boolean value}
443 Some fields contain a @emph{boolean value}. This is a number with
444 either the value 0 or 1. The number may be followed by a space,
445 followed by a human readable description of that value (if the verbose
446 option is used). You should ignore everything in the field that follows
447 the number; checking just the first character is sufficient in this
451 Some fields contain an @emph{option} argument. The format of an
452 option argument depends on the type of the option and on some flags:
456 The simplest case is that the option does not take an argument at all
457 (@var{type} @code{0}). Then the option argument is an unsigned number
458 that specifies how often the option occurs. If the @code{list} flag
459 is not set, then the only valid number is @code{1}. Options that do
460 not take an argument never have the @code{default} or @code{optional
464 If the option takes a number argument (@var{alt-type} is @code{2} or
465 @code{3}), and it can only occur once (@code{list} flag is not set),
466 then the option argument is either empty (only allowed if the argument
467 is optional), or it is a number. A number is a string that begins
468 with an optional minus character, followed by one or more digits. The
469 number must fit into an integer variable (unsigned or signed,
470 depending on @var{alt-type}).
473 If the option takes a number argument and it can occur more than once,
474 then the option argument is either empty, or it is a comma-separated
475 list of numbers as described above.
478 If the option takes a string argument (@var{alt-type} is 1), and it
479 can only occur once (@code{list} flag is not set) then the option
480 argument is either empty (only allowed if the argument is optional),
481 or it starts with a double quote character (@code{"}) followed by a
482 percent-escaped string that is the argument value. Note that there is
483 only a leading double quote character, no trailing one. The double
484 quote character is only needed to be able to differentiate between no
485 value and the empty string as value.
488 If the option takes a number argument and it can occur more than once,
489 then the option argument is either empty, or it is a comma-separated
490 list of string arguments as described above.
494 The active language and character set are currently determined from
495 the locale environment of the @command{gpgconf} program.
497 @c FIXME: Document the active language and active character set. Allow
498 @c to change it via the command line?
502 @node Listing components
503 @subsection Listing components
505 The command @code{--list-components} will list all components that can
506 be configured with @command{gpgconf}. Usually, one component will
507 correspond to one GnuPG-related program and contain the options of
508 that programs configuration file that can be modified using
509 @command{gpgconf}. However, this is not necessarily the case. A
510 component might also be a group of selected options from several
511 programs, or contain entirely virtual options that have a special
512 effect rather than changing exactly one option in one configuration
515 A component is a set of configuration options that semantically belong
516 together. Furthermore, several changes to a component can be made in
517 an atomic way with a single operation. The GUI could for example
518 provide a menu with one entry for each component, or a window with one
519 tabulator sheet per component.
521 The command argument @code{--list-components} lists all available
522 components, one per line. The format of each line is:
524 @code{@var{name}:@var{description}:@var{pgmname}:}
528 This field contains a name tag of the component. The name tag is used
529 to specify the component in all communication with @command{gpgconf}.
530 The name tag is to be used @emph{verbatim}. It is thus not in any
534 The @emph{string} in this field contains a human-readable description
535 of the component. It can be displayed to the user of the GUI for
536 informational purposes. It is @emph{percent-escaped} and
540 The @emph{string} in this field contains the absolute name of the
541 program's file. It can be used to unambiguously invoke that program.
542 It is @emph{percent-escaped}.
547 $ gpgconf --list-components
548 gpg:GPG for OpenPGP:/usr/local/bin/gpg2:
549 gpg-agent:GPG Agent:/usr/local/bin/gpg-agent:
550 scdaemon:Smartcard Daemon:/usr/local/bin/scdaemon:
551 gpgsm:GPG for S/MIME:/usr/local/bin/gpgsm:
552 dirmngr:Directory Manager:/usr/local/bin/dirmngr:
557 @node Checking programs
558 @subsection Checking programs
560 The command @code{--check-programs} is similar to
561 @code{--list-components} but works on backend programs and not on
562 components. It runs each program to test whether it is installed and
563 runnable. This also includes a syntax check of all config file options
566 The command argument @code{--check-programs} lists all available
567 programs, one per line. The format of each line is:
569 @code{@var{name}:@var{description}:@var{pgmname}:@var{avail}:@var{okay}:@var{cfgfile}:@var{line}:@var{error}:}
573 This field contains a name tag of the program which is identical to the
574 name of the component. The name tag is to be used @emph{verbatim}. It
575 is thus not in any escaped format. This field may be empty to indicate
576 a continuation of error descriptions for the last name. The description
577 and pgmname fields are then also empty.
580 The @emph{string} in this field contains a human-readable description
581 of the component. It can be displayed to the user of the GUI for
582 informational purposes. It is @emph{percent-escaped} and
586 The @emph{string} in this field contains the absolute name of the
587 program's file. It can be used to unambiguously invoke that program.
588 It is @emph{percent-escaped}.
591 The @emph{boolean value} in this field indicates whether the program is
592 installed and runnable.
595 The @emph{boolean value} in this field indicates whether the program's
596 config file is syntactically okay.
599 If an error occurred in the configuration file (as indicated by a false
600 value in the field @code{okay}), this field has the name of the failing
601 configuration file. It is @emph{percent-escaped}.
604 If an error occurred in the configuration file, this field has the line
605 number of the failing statement in the configuration file.
606 It is an @emph{unsigned number}.
609 If an error occurred in the configuration file, this field has the error
610 text of the failing statement in the configuration file. It is
611 @emph{percent-escaped} and @emph{localized}.
616 In the following example the @command{dirmngr} is not runnable and the
617 configuration file of @command{scdaemon} is not okay.
620 $ gpgconf --check-programs
621 gpg:GPG for OpenPGP:/usr/local/bin/gpg2:1:1:
622 gpg-agent:GPG Agent:/usr/local/bin/gpg-agent:1:1:
623 scdaemon:Smartcard Daemon:/usr/local/bin/scdaemon:1:0:
624 gpgsm:GPG for S/MIME:/usr/local/bin/gpgsm:1:1:
625 dirmngr:Directory Manager:/usr/local/bin/dirmngr:0:0:
629 The command @w{@code{--check-options @var{component}}} will verify the
630 configuration file in the same manner as @code{--check-programs}, but
631 only for the component @var{component}.
634 @node Listing options
635 @subsection Listing options
637 Every component contains one or more options. Options may be gathered
638 into option groups to allow the GUI to give visual hints to the user
639 about which options are related.
641 The command argument @code{@w{--list-options @var{component}}} lists
642 all options (and the groups they belong to) in the component
643 @var{component}, one per line. @var{component} must be the string in
644 the field @var{name} in the output of the @code{--list-components}
647 There is one line for each option and each group. First come all
648 options that are not in any group. Then comes a line describing a
649 group. Then come all options that belong into each group. Then comes
650 the next group and so on. There does not need to be any group (and in
651 this case the output will stop after the last non-grouped option).
653 The format of each line is:
655 @code{@var{name}:@var{flags}:@var{level}:@var{description}:@var{type}:@var{alt-type}:@var{argname}:@var{default}:@var{argdef}:@var{value}}
659 This field contains a name tag for the group or option. The name tag
660 is used to specify the group or option in all communication with
661 @command{gpgconf}. The name tag is to be used @emph{verbatim}. It is
662 thus not in any escaped format.
665 The flags field contains an @emph{unsigned number}. Its value is the
666 OR-wise combination of the following flag values:
670 If this flag is set, this is a line describing a group and not an
674 The following flag values are only defined for options (that is, if
675 the @code{group} flag is not used).
678 @item optional arg (2)
679 If this flag is set, the argument is optional. This is never set for
680 @var{type} @code{0} (none) options.
683 If this flag is set, the option can be given multiple times.
686 If this flag is set, the option can be changed at runtime.
689 If this flag is set, a default value is available.
691 @item default desc (32)
692 If this flag is set, a (runtime) default is available. This and the
693 @code{default} flag are mutually exclusive.
695 @item no arg desc (64)
696 If this flag is set, and the @code{optional arg} flag is set, then the
697 option has a special meaning if no argument is given.
699 @item no change (128)
700 If this flag is set, gpgconf ignores requests to change the value. GUI
701 frontends should grey out this option. Note, that manual changes of the
702 configuration files are still possible.
706 This field is defined for options and for groups. It contains an
707 @emph{unsigned number} that specifies the expert level under which
708 this group or option should be displayed. The following expert levels
709 are defined for options (they have analogous meaning for groups):
713 This option should always be offered to the user.
716 This option may be offered to advanced users.
719 This option should only be offered to expert users.
722 This option should normally never be displayed, not even to expert
726 This option is for internal use only. Ignore it.
729 The level of a group will always be the lowest level of all options it
733 This field is defined for options and groups. The @emph{string} in
734 this field contains a human-readable description of the option or
735 group. It can be displayed to the user of the GUI for informational
736 purposes. It is @emph{percent-escaped} and @emph{localized}.
739 This field is only defined for options. It contains an @emph{unsigned
740 number} that specifies the type of the option's argument, if any. The
741 following types are defined:
750 An @emph{unformatted string}.
753 A @emph{signed number}.
756 An @emph{unsigned number}.
763 A @emph{string} that describes the pathname of a file. The file does
764 not necessarily need to exist.
766 @item ldap server (33)
767 A @emph{string} that describes an LDAP server in the format:
769 @code{@var{hostname}:@var{port}:@var{username}:@var{password}:@var{base_dn}}
771 @item key fingerprint (34)
772 A @emph{string} with a 40 digit fingerprint specifying a certificate.
775 A @emph{string} that describes a certificate by user ID, key ID or
779 A @emph{string} that describes a certificate with a key by user ID,
780 key ID or fingerprint.
782 @item alias list (37)
783 A @emph{string} that describes an alias list, like the one used with
784 gpg's group option. The list consists of a key, an equal sign and space
788 More types will be added in the future. Please see the @var{alt-type}
789 field for information on how to cope with unknown types.
792 This field is identical to @var{type}, except that only the types
793 @code{0} to @code{31} are allowed. The GUI is expected to present the
794 user the option in the format specified by @var{type}. But if the
795 argument type @var{type} is not supported by the GUI, it can still
796 display the option in the more generic basic type @var{alt-type}. The
797 GUI must support all the defined basic types to be able to display all
798 options. More basic types may be added in future versions. If the
799 GUI encounters a basic type it doesn't support, it should report an
800 error and abort the operation.
803 This field is only defined for options with an argument type
804 @var{type} that is not @code{0}. In this case it may contain a
805 @emph{percent-escaped} and @emph{localised string} that gives a short
806 name for the argument. The field may also be empty, though, in which
807 case a short name is not known.
810 This field is defined only for options for which the @code{default} or
811 @code{default desc} flag is set. If the @code{default} flag is set,
812 its format is that of an @emph{option argument} (@xref{Format
813 conventions}, for details). If the default value is empty, then no
814 default is known. Otherwise, the value specifies the default value
815 for this option. If the @code{default desc} flag is set, the field is
816 either empty or contains a description of the effect if the option is
820 This field is defined only for options for which the @code{optional
821 arg} flag is set. If the @code{no arg desc} flag is not set, its
822 format is that of an @emph{option argument} (@xref{Format
823 conventions}, for details). If the default value is empty, then no
824 default is known. Otherwise, the value specifies the default argument
825 for this option. If the @code{no arg desc} flag is set, the field is
826 either empty or contains a description of the effect of this option if
827 no argument is given.
830 This field is defined only for options. Its format is that of an
831 @emph{option argument}. If it is empty, then the option is not
832 explicitly set in the current configuration, and the default applies
833 (if any). Otherwise, it contains the current value of the option.
834 Note that this field is also meaningful if the option itself does not
835 take a real argument (in this case, it contains the number of times
840 @node Changing options
841 @subsection Changing options
843 The command @w{@code{--change-options @var{component}}} will attempt
844 to change the options of the component @var{component} to the
845 specified values. @var{component} must be the string in the field
846 @var{name} in the output of the @code{--list-components} command. You
847 have to provide the options that shall be changed in the following
848 format on standard input:
850 @code{@var{name}:@var{flags}:@var{new-value}}
854 This is the name of the option to change. @var{name} must be the
855 string in the field @var{name} in the output of the
856 @code{--list-options} command.
859 The flags field contains an @emph{unsigned number}. Its value is the
860 OR-wise combination of the following flag values:
864 If this flag is set, the option is deleted and the default value is
865 used instead (if applicable).
869 The new value for the option. This field is only defined if the
870 @code{default} flag is not set. The format is that of an @emph{option
871 argument}. If it is empty (or the field is omitted), the default
872 argument is used (only allowed if the argument is optional for this
873 option). Otherwise, the option will be set to the specified value.
877 The output of the command is the same as that of
878 @code{--check-options} for the modified configuration file.
882 To set the force option, which is of basic type @code{none (0)}:
885 $ echo 'force:0:1' | gpgconf --change-options dirmngr
888 To delete the force option:
891 $ echo 'force:16:' | gpgconf --change-options dirmngr
894 The @code{--runtime} option can influence when the changes take
898 @node Listing global options
899 @subsection Listing global options
901 Sometimes it is useful for applications to look at the global options
902 file @file{gpgconf.conf}.
903 The colon separated listing format is record oriented and uses the first
904 field to identify the record type:
908 This describes a key record to start the definition of a new ruleset for
909 a user/group. The format of a key record is:
911 @code{k:@var{user}:@var{group}:}
915 This is the user field of the key. It is percent escaped. See the
916 definition of the gpgconf.conf format for details.
919 This is the group field of the key. It is percent escaped.
923 This describes a rule record. All rule records up to the next key record
924 make up a rule set for that key. The format of a rule record is:
926 @code{r:::@var{component}:@var{option}:@var{flags}:@var{value}:}
930 This is the component part of a rule. It is a plain string.
933 This is the option part of a rule. It is a plain string.
936 This is the flags part of a rule. There may be only one flag per rule
937 but by using the same component and option, several flags may be
938 assigned to an option. It is a plain string.
941 This is the optional value for the option. It is a percent escaped
942 string with a single quotation mark to indicate a string. The quotation
943 mark is only required to distinguish between no value specified and an
950 Unknown record types should be ignored. Note that there is intentionally
951 no feature to change the global option file through @command{gpgconf}.
956 @node Files used by gpgconf
957 @subsection Files used by gpgconf
961 @item /etc/gnupg/gpgconf.conf
963 If this file exists, it is processed as a global configuration file.
964 A commented example can be found in the @file{examples} directory of
973 @command{gpg-agent}(1),
974 @command{scdaemon}(1),
977 @include see-also-note.texi
982 @c APPLYGNUPGDEFAULTS
984 @manpage applygnupgdefaults.8
985 @node applygnupgdefaults
986 @section Run gpgconf for all users.
988 .B applygnupgdefaults
989 \- Run gpgconf --apply-defaults for all users.
994 .B applygnupgdefaults
998 This script is a wrapper around @command{gpgconf} to run it with the
999 command @code{--apply-defaults} for all real users with an existing
1000 GnuPG home directory. Admins might want to use this script to update he
1001 GnuPG configuration files for all users after
1002 @file{/etc/gnupg/gpgconf.conf} has been changed. This allows to enforce
1003 certain policies for all users. Note, that this is not a bulletproof of
1004 forcing a user to use certain options. A user may always directly edit
1005 the configuration files and bypass gpgconf.
1008 @command{applygnupgdefaults} is invoked by root as:
1016 @c GPG-PRESET-PASSPHRASE
1018 @node gpg-preset-passphrase
1019 @section Put a passphrase into the cache.
1020 @manpage gpg-preset-passphrase.1
1022 .B gpg-preset-passphrase
1023 \- Put a passphrase into gpg-agent's cache
1028 .B gpg-preset-passphrase
1034 @mansect description
1035 The @command{gpg-preset-passphrase} is a utility to seed the internal
1036 cache of a running @command{gpg-agent} with passphrases. It is mainly
1037 useful for unattended machines, where the usual @command{pinentry} tool
1038 may not be used and the passphrases for the to be used keys are given at
1041 Passphrases set with this utility don't expire unless the
1042 @option{--forget} option is used to explicitly clear them from the
1043 cache --- or @command{gpg-agent} is either restarted or reloaded (by
1044 sending a SIGHUP to it). Note that the maximum cache time as set with
1045 @option{--max-cache-ttl} is still honored. It is necessary to allow
1046 this passphrase presetting by starting @command{gpg-agent} with the
1047 @option{--allow-preset-passphrase}.
1050 * Invoking gpg-preset-passphrase:: List of all commands and options.
1054 @node Invoking gpg-preset-passphrase
1055 @subsection List of all commands and options.
1059 @command{gpg-preset-passphrase} is invoked this way:
1062 gpg-preset-passphrase [options] [command] @var{cacheid}
1065 @var{cacheid} is either a 40 character keygrip of hexadecimal
1066 characters identifying the key for which the passphrase should be set
1067 or cleared. The keygrip is listed along with the key when running the
1068 command: @code{gpgsm --dump-secret-keys}. Alternatively an arbitrary
1069 string may be used to identify a passphrase; it is suggested that such
1070 a string is prefixed with the name of the application (e.g
1074 One of the following command options must be given:
1079 Preset a passphrase. This is what you usually will
1080 use. @command{gpg-preset-passphrase} will then read the passphrase from
1085 Flush the passphrase for the given cache ID from the cache.
1090 The following additional options may be used:
1096 Output additional information while running.
1098 @item -P @var{string}
1099 @itemx --passphrase @var{string}
1101 Instead of reading the passphrase from @code{stdin}, use the supplied
1102 @var{string} as passphrase. Note that this makes the passphrase visible
1110 @command{gpg-agent}(1),
1111 @command{scdaemon}(1)
1113 @include see-also-note.texi
1119 @c GPG-CONNECT-AGENT
1121 @node gpg-connect-agent
1122 @section Communicate with a running agent.
1123 @manpage gpg-connect-agent.1
1125 .B gpg-connect-agent
1126 \- Communicate with a running agent
1131 .B gpg-connect-agent
1132 .RI [ options ] [commands]
1135 @mansect description
1136 The @command{gpg-connect-agent} is a utility to communicate with a
1137 running @command{gpg-agent}. It is useful to check out the commands
1138 gpg-agent provides using the Assuan interface. It might also be useful
1139 for scripting simple applications. Input is expected at stdin and out
1140 put gets printed to stdout.
1142 It is very similar to running @command{gpg-agent} in server mode; but
1143 here we connect to a running instance.
1146 * Invoking gpg-connect-agent:: List of all options.
1147 * Controlling gpg-connect-agent:: Control commands.
1151 @node Invoking gpg-connect-agent
1152 @subsection List of all options.
1155 @command{gpg-connect-agent} is invoked this way:
1158 gpg-connect-agent [options] [commands]
1163 The following options may be used:
1169 Output additional information while running.
1175 Try to be as quiet as possible.
1177 @include opt-homedir.texi
1179 @item --agent-program @var{file}
1180 @opindex agent-program
1181 Specify the agent program to be started if none is running. The
1182 default value is determined by running @command{gpgconf} with the
1183 option @option{--list-dirs}. Note that the pipe symbol (@code{|}) is
1184 used for a regression test suite hack and may thus not be used in the
1187 @item --dirmngr-program @var{file}
1188 @opindex dirmngr-program
1189 Specify the directory manager (keyserver client) program to be started
1190 if none is running. This has only an effect if used together with the
1191 option @option{--dirmngr}.
1195 Connect to a running directory manager (keyserver client) instead of
1196 to the gpg-agent. If a dirmngr is not running, start it.
1199 @itemx --raw-socket @var{name}
1201 Connect to socket @var{name} assuming this is an Assuan style server.
1202 Do not run any special initializations or environment checks. This may
1203 be used to directly connect to any Assuan style socket server.
1208 Take the rest of the command line as a program and it's arguments and
1209 execute it as an assuan server. Here is how you would run @command{gpgsm}:
1211 gpg-connect-agent --exec gpgsm --server
1213 Note that you may not use options on the command line in this case.
1215 @item --no-ext-connect
1216 @opindex no-ext-connect
1217 When using @option{-S} or @option{--exec}, @command{gpg-connect-agent}
1218 connects to the assuan server in extended mode to allow descriptor
1219 passing. This option makes it use the old mode.
1221 @item --no-autostart
1222 @opindex no-autostart
1223 Do not start the gpg-agent or the dirmngr if it has not yet been
1227 @itemx --run @var{file}
1229 Run the commands from @var{file} at startup and then continue with the
1230 regular input method. Note, that commands given on the command line are
1231 executed after this file.
1236 Run the command @code{/subst} at startup.
1240 Print data lines in a hex format and the ASCII representation of
1241 non-control characters.
1245 Decode data lines. That is to remove percent escapes but make sure that
1246 a new line always starts with a D and a space.
1250 @mansect control commands
1251 @node Controlling gpg-connect-agent
1252 @subsection Control commands.
1254 While reading Assuan commands, gpg-agent also allows a few special
1255 commands to control its operation. These control commands all start
1256 with a slash (@code{/}).
1260 @item /echo @var{args}
1261 Just print @var{args}.
1263 @item /let @var{name} @var{value}
1264 Set the variable @var{name} to @var{value}. Variables are only
1265 substituted on the input if the @command{/subst} has been used.
1266 Variables are referenced by prefixing the name with a dollar sign and
1267 optionally include the name in curly braces. The rules for a valid name
1268 are identically to those of the standard bourne shell. This is not yet
1269 enforced but may be in the future. When used with curly braces no
1270 leading or trailing white space is allowed.
1272 If a variable is not found, it is searched in the environment and if
1273 found copied to the table of variables.
1275 Variable functions are available: The name of the function must be
1276 followed by at least one space and the at least one argument. The
1277 following functions are available:
1281 Return a value described by the argument. Available arguments are:
1285 The current working directory.
1289 GnuPG's system configuration directory.
1291 GnuPG's binary directory.
1293 GnuPG's library directory.
1295 GnuPG's library directory for executable files.
1297 GnuPG's data directory.
1299 The PID of the current server. Command @command{/serverpid} must
1300 have been given to return a useful value.
1303 @item unescape @var{args}
1304 Remove C-style escapes from @var{args}. Note that @code{\0} and
1305 @code{\x00} terminate the returned string implicitly. The string to be
1306 converted are the entire arguments right behind the delimiting space of
1309 @item unpercent @var{args}
1310 @itemx unpercent+ @var{args}
1311 Remove percent style escaping from @var{args}. Note that @code{%00}
1312 terminates the string implicitly. The string to be converted are the
1313 entire arguments right behind the delimiting space of the function
1314 name. @code{unpercent+} also maps plus signs to a spaces.
1316 @item percent @var{args}
1317 @itemx percent+ @var{args}
1318 Escape the @var{args} using percent style escaping. Tabs, formfeeds,
1319 linefeeds, carriage returns and colons are escaped. @code{percent+} also
1320 maps spaces to plus signs.
1322 @item errcode @var{arg}
1323 @itemx errsource @var{arg}
1324 @itemx errstring @var{arg}
1325 Assume @var{arg} is an integer and evaluate it using @code{strtol}. Return
1326 the gpg-error error code, error source or a formatted string with the
1327 error code and error source.
1335 Evaluate all arguments as long integers using @code{strtol} and apply
1336 this operator. A division by zero yields an empty string.
1341 Evaluate all arguments as long integers using @code{strtol} and apply
1342 the logical operators NOT, OR or AND. The NOT operator works on the
1349 @item /definq @var{name} @var{var}
1350 Use content of the variable @var{var} for inquiries with @var{name}.
1351 @var{name} may be an asterisk (@code{*}) to match any inquiry.
1354 @item /definqfile @var{name} @var{file}
1355 Use content of @var{file} for inquiries with @var{name}.
1356 @var{name} may be an asterisk (@code{*}) to match any inquiry.
1358 @item /definqprog @var{name} @var{prog}
1359 Run @var{prog} for inquiries matching @var{name} and pass the
1360 entire line to it as command line arguments.
1362 @item /datafile @var{name}
1363 Write all data lines from the server to the file @var{name}. The file
1364 is opened for writing and created if it does not exists. An existing
1365 file is first truncated to 0. The data written to the file fully
1366 decoded. Using a single dash for @var{name} writes to stdout. The
1367 file is kept open until a new file is set using this command or this
1368 command is used without an argument.
1371 Print all definitions
1374 Delete all definitions
1376 @item /sendfd @var{file} @var{mode}
1377 Open @var{file} in @var{mode} (which needs to be a valid @code{fopen}
1378 mode string) and send the file descriptor to the server. This is
1379 usually followed by a command like @code{INPUT FD} to set the
1380 input source for other commands.
1383 Not yet implemented.
1385 @item /open @var{var} @var{file} [@var{mode}]
1386 Open @var{file} and assign the file descriptor to @var{var}. Warning:
1387 This command is experimental and might change in future versions.
1389 @item /close @var{fd}
1390 Close the file descriptor @var{fd}. Warning: This command is
1391 experimental and might change in future versions.
1394 Show a list of open files.
1397 Send the Assuan command @command{GETINFO pid} to the server and store
1398 the returned PID for internal purposes.
1405 Same as the command line option @option{--hex}.
1409 Same as the command line option @option{--decode}.
1413 Enable and disable variable substitution. It defaults to disabled
1414 unless the command line option @option{--subst} has been used.
1415 If /subst as been enabled once, leading whitespace is removed from
1416 input lines which makes scripts easier to read.
1418 @item /while @var{condition}
1420 These commands provide a way for executing loops. All lines between
1421 the @code{while} and the corresponding @code{end} are executed as long
1422 as the evaluation of @var{condition} yields a non-zero value or is the
1423 string @code{true} or @code{yes}. The evaluation is done by passing
1424 @var{condition} to the @code{strtol} function. Example:
1430 /echo loop couter is $i
1435 @item /if @var{condition}
1437 These commands provide a way for conditional execution. All lines between
1438 the @code{if} and the corresponding @code{end} are executed only if
1439 the evaluation of @var{condition} yields a non-zero value or is the
1440 string @code{true} or @code{yes}. The evaluation is done by passing
1441 @var{condition} to the @code{strtol} function.
1443 @item /run @var{file}
1444 Run commands from @var{file}.
1447 Terminate the connection and the program
1450 Print a list of available control commands.
1457 @command{gpg-agent}(1),
1458 @command{scdaemon}(1)
1459 @include see-also-note.texi
1465 @node dirmngr-client
1466 @section The Dirmngr Client Tool
1468 @manpage dirmngr-client.1
1471 \- Tool to access the Dirmngr services
1478 .RI [ certfile | pattern ]
1481 @mansect description
1482 The @command{dirmngr-client} is a simple tool to contact a running
1483 dirmngr and test whether a certificate has been revoked --- either by
1484 being listed in the corresponding CRL or by running the OCSP protocol.
1485 If no dirmngr is running, a new instances will be started but this is
1486 in general not a good idea due to the huge performance overhead.
1489 The usual way to run this tool is either:
1492 dirmngr-client @var{acert}
1499 dirmngr-client <@var{acert}
1502 Where @var{acert} is one DER encoded (binary) X.509 certificates to be
1505 The return value of this command is
1508 @mansect return value
1510 @command{dirmngr-client} returns these values:
1515 The certificate under question is valid; i.e. there is a valid CRL
1516 available and it is not listed there or the OCSP request returned that
1517 that certificate is valid.
1520 The certificate has been revoked
1522 @item 2 (and other values)
1523 There was a problem checking the revocation state of the certificate.
1524 A message to stderr has given more detailed information. Most likely
1525 this is due to a missing or expired CRL or due to a network problem.
1531 @command{dirmngr-client} may be called with the following options:
1537 Print the program version and licensing information. Note that you cannot
1538 abbreviate this command.
1542 Print a usage message summarizing the most useful command-line options.
1543 Note that you cannot abbreviate this command.
1547 Make the output extra brief by suppressing any informational messages.
1553 Outputs additional information while running.
1554 You can increase the verbosity by giving several
1555 verbose commands to @sc{dirmngr}, such as @samp{-vv}.
1559 Assume that the given certificate is in PEM (armored) format.
1563 Do the check using the OCSP protocol and ignore any CRLs.
1565 @item --force-default-responder
1566 @opindex force-default-responder
1567 When checking using the OCSP protocl, force the use of the default OCSP
1568 responder. That is not to use the Reponder as given by the certificate.
1572 Check whether the dirmngr daemon is up and running.
1576 Put the given certificate into the cache of a running dirmngr. This is
1577 mainly useful for debugging.
1581 Validate the given certificate using dirmngr's internal validation code.
1582 This is mainly useful for debugging.
1586 This command expects a list of filenames with DER encoded CRL files.
1587 With the option @option{--url} URLs are expected in place of filenames
1588 and they are loaded directly from the given location. All CRLs will be
1589 validated and then loaded into dirmngr's cache.
1593 Take the remaining arguments and run a lookup command on each of them.
1594 The results are Base-64 encoded outputs (without header lines). This
1595 may be used to retrieve certificates from a server. However the output
1596 format is not very well suited if more than one certificate is returned.
1601 Modify the @command{lookup} and @command{load-crl} commands to take an URL.
1606 Let the @command{lookup} command only search the local cache.
1610 Run @sc{dirmngr-client} in a mode suitable as a helper program for
1611 Squid's @option{external_acl_type} option.
1618 @command{dirmngr}(8),
1620 @include see-also-note.texi
1628 @section Parse a mail message into an annotated format
1630 @manpage gpgparsemail.1
1633 \- Parse a mail message into an annotated format
1643 @mansect description
1644 The @command{gpgparsemail} is a utility currently only useful for
1645 debugging. Run it with @code{--help} for usage information.
1653 @section Call a simple symmetric encryption tool.
1654 @manpage symcryptrun.1
1657 \- Call a simple symmetric encryption tool
1669 .RB [ --decrypt | --encrypt ]
1673 @mansect description
1674 Sometimes simple encryption tools are already in use for a long time and
1675 there might be a desire to integrate them into the GnuPG framework. The
1676 protocols and encryption methods might be non-standard or not even
1677 properly documented, so that a full-fledged encryption tool with an
1678 interface like gpg is not doable. @command{symcryptrun} provides a
1679 solution: It operates by calling the external encryption/decryption
1680 module and provides a passphrase for a key using the standard
1681 @command{pinentry} based mechanism through @command{gpg-agent}.
1683 Note, that @command{symcryptrun} is only available if GnuPG has been
1684 configured with @samp{--enable-symcryptrun} at build time.
1687 * Invoking symcryptrun:: List of all commands and options.
1691 @node Invoking symcryptrun
1692 @subsection List of all commands and options.
1695 @command{symcryptrun} is invoked this way:
1698 symcryptrun --class CLASS --program PROGRAM --keyfile KEYFILE
1699 [--decrypt | --encrypt] [inputfile]
1703 For encryption, the plain text must be provided on STDIN or as the
1704 argument @var{inputfile}, and the ciphertext will be output to STDOUT.
1705 For decryption vice versa.
1707 @var{CLASS} describes the calling conventions of the external tool.
1708 Currently it must be given as @samp{confucius}. @var{PROGRAM} is
1709 the full filename of that external tool.
1711 For the class @samp{confucius} the option @option{--keyfile} is
1712 required; @var{keyfile} is the name of a file containing the secret key,
1713 which may be protected by a passphrase. For detailed calling
1714 conventions, see the source code.
1717 Note, that @command{gpg-agent} must be running before starting
1718 @command{symcryptrun}.
1721 The following additional options may be used:
1727 Output additional information while running.
1733 Try to be as quiet as possible.
1735 @include opt-homedir.texi
1738 @item --log-file @var{file}
1740 Append all logging output to @var{file}. Default is to write logging
1741 information to STDERR.
1746 The possible exit status codes of @command{symcryptrun} are:
1754 No valid passphrase was provided.
1756 The operation was canceled by the user.
1764 @command{gpg-agent}(1),
1766 @include see-also-note.texi
1772 @c The original manpage on which this section is based was written
1773 @c by Colin Tuckley <colin@tuckley.org> and Daniel Leidert
1774 @c <daniel.leidert@wgdd.de> for the Debian distribution (but may be used by
1778 @section Encrypt or sign files into an archive
1780 .B gpg-zip \- Encrypt or sign files into an archive
1788 .I [ filename2, ... ]
1790 .I [ directory2, ... ]
1793 @mansect description
1794 @command{gpg-zip} encrypts or signs files into an archive. It is an
1795 gpg-ized tar using the same format as used by PGP's PGP Zip.
1799 @command{gpg-zip} is invoked this way:
1802 gpg-zip [options] @var{filename1} [@var{filename2}, ...] @var{directory} [@var{directory2}, ...]
1807 @command{gpg-zip} understands these options:
1814 Encrypt data. This option may be combined with @option{--symmetric} (for output that may be decrypted via a secret key or a passphrase).
1823 Encrypt with a symmetric cipher using a passphrase. The default
1824 symmetric cipher used is CAST5, but may be chosen with the
1825 @option{--cipher-algo} option to @command{gpg}.
1829 Make a signature. See @command{gpg}.
1831 @item --recipient @var{user}
1832 @itemx -r @var{user}
1834 Encrypt for user id @var{user}. See @command{gpg}.
1836 @item --local-user @var{user}
1837 @itemx -u @var{user}
1839 Use @var{user} as the key to sign with. See @command{gpg}.
1841 @item --list-archive
1842 @opindex list-archive
1843 List the contents of the specified archive.
1845 @item --output @var{file}
1846 @itemx -o @var{file}
1848 Write output to specified file @var{file}.
1850 @item --gpg @var{gpgcmd}
1852 Use the specified command @var{gpgcmd} instead of @command{gpg}.
1854 @item --gpg-args @var{args}
1856 Pass the specified options to @command{gpg}.
1858 @item --tar @var{tarcmd}
1860 Use the specified command @var{tarcmd} instead of @command{tar}.
1862 @item --tar-args @var{args}
1864 Pass the specified options to @command{tar}.
1868 Print version of the program and exit.
1872 Display a brief help page and exit.
1876 @mansect diagnostics
1878 The program returns 0 if everything was fine, 1 otherwise.
1888 Encrypt the contents of directory @file{mydocs} for user Bob to file
1892 gpg-zip --encrypt --output test1 --gpg-args -r Bob mydocs
1896 List the contents of archive @file{test1}:
1899 gpg-zip --list-archive test1
1908 @include see-also-note.texi