     [file defs.inc not included]

Web Key Service
***************

GnuPG comes with tools used to maintain and access a Web Key Directory.

gpg-wks-client.1

Send requests via WKS
=====================

synopsis

description
The gpg-wks-client is used to send requests to a Web Key Service provider.  This is usually done to upload a key into a Web Key Directory.

With the --supported command the caller can test whether a site supports the Web Key Service.  The argument is an arbitrary address in the to be tested domain. For example foo@example.net.  The command returns success if the Web Key Service is supported.  The operation is silent; to get diagnostic output use the option --verbose.  See option --with-colons for a variant of this command.

With the --check command the caller can test whether a key exists for a supplied mail address.  The command returns success if a key is available.

The --create command is used to send a request for publication in the Web Key Directory.  The arguments are the fingerprint of the key and the user id to publish.  The output from the command is a properly formatted mail with all standard headers. This mail can be fed to sendmail(8) or any other tool to actually send that mail.  If sendmail(8) is installed the option --send can be used to directly send the created request.  If the provider request a 'mailbox-only' user id and no such user id is found, gpg-wks-client will try an additional user id.

The --receive and --read commands are used to process confirmation mails as send from the service provider.  The former expects an encrypted MIME messages, the latter an already decrypted MIME message.  The result of these commands are another mail which can be send in the same way as the mail created with --create.

The command --install-key manually installs a key into a local directory (see option -C) reflecting the structure of a WKD.  The arguments are a file with the keyblock and the user-id to install.  If the first argument resembles a fingerprint the key is taken from the current keyring; to force the use of a file, prefix the first argument with "./".  If no arguments are given the parameters are read from stdin; the expected format are lines with the fingerprint and the mailbox separated by a space.  The command --remove-key removes a key from that directory, its only argument is a user-id.

The command --mirror is similar to --install-key but takes the keys from the the LDAP server configured for Dirmngr.  If no arguments are given all keys and user ids are installed.  If arguments are given they are taken as domain names to limit the to be installed keys.  The option --blacklist may be used to further limit the to be installed keys.

The command --print-wkd-hash prints the WKD user-id identifiers and the corresponding mailboxes from the user-ids given on the command line or via stdin (one user-id per line).

The command --print-wkd-url prints the URLs used to fetch the key for the given user-ids from WKD.  The meanwhile preferred format with sub-domains is used here.

options

gpg-wks-client understands these options:

--send
     Directly send created mails using the sendmail command. Requires installation of that command.

--with-colons
     This option has currently only an effect on the --supported command.  If it is used all arguments on the command line are taken as domain names and tested for WKD support.  The output format is one line per domain with colon delimited fields.  The currently specified fields are (future versions may specify additional fields):

     1 - domain
          This is the domain name.  Although quoting is not required for valid domain names this field is specified to be quoted in standard C manner.

     2 - WKD
          If the value is true the domain supports the Web Key Directory.

     3 - WKS
          If the value is true the domain supports the Web Key Service protocol to upload keys to the directory.

     4 - error-code
          This may contain an gpg-error code to describe certain failures.  Use gpg-error CODE to explain the code.

     5 - protocol-version
          The minimum protocol version supported by the server.

     6 - auth-submit
          The auth-submit flag from the policy file of the server.

     7 - mailbox-only
          The mailbox-only flag from the policy file of the server.

--output FILE
-o
     Write the created mail to FILE instead of stdout.  Note that the value - for FILE is the same as writing to stdout.  If this option is used with the --check command and a key was found it is written to the given file.

--status-fd N
     Write special status strings to the file descriptor N. This program returns only the status messages SUCCESS or FAILURE which are helpful when the caller uses a double fork approach and can't easily get the return code of the process.

-C DIR
--directory DIR
     Use DIR as top level directory for the commands --mirror, --install-key and --remove-key. The default is openpgpkey.

--blacklist FILE
     This option is used to exclude certain mail addresses from a mirror operation.  The format of FILE is one mail address (just the addrspec, e.g. "postel@isi.edu") per line.  Empty lines and lines starting with a '#' are ignored.

--add-revocs
--no-add-revocs
     If enabled append revocation certificates for the same addrspec as used in the WKD to the key.  Modern gpg version are able to import and apply them for existing keys.  Note that when used with the --mirror command the revocation are searched in the local keyring and not in an LDAP directory.  The default is --add-revocs.

--verbose
     Enable extra informational output.

--quiet
     Disable almost all informational output.

--version
     Print version of the program and exit.

--help
     Display a brief help page and exit.

see also

gpg-wks-server.1

Provide the Web Key Service
===========================

synopsis

description
The gpg-wks-server is a server side implementation of the Web Key Service.  It receives requests for publication, sends confirmation requests, receives confirmations, and published the key. It also has features to ease the setup and maintenance of a Web Key Directory.

When used with the command --receive a single Web Key Service mail is processed.  Commonly this command is used with the option --send to directly send the created mails back.  See below for an installation example.

The command --cron is used for regular cleanup tasks.  For example non-confirmed requested should be removed after their expire time.  It is best to run this command once a day from a cronjob.

The command --list-domains prints all configured domains. Further it creates missing directories for the configuration and prints warnings pertaining to problems in the configuration.

The command --check-key (or just --check) checks whether a key with the given user-id is installed.  The process returns success in this case; to also print a diagnostic use the option -v.  If the key is not installed a diagnostic is printed and the process returns failure; to suppress the diagnostic, use option -q.  More than one user-id can be given; see also option with-file.

The command --install-key manually installs a key into the WKD.  The arguments are a file with the keyblock and the user-id to install.  If the first argument resembles a fingerprint the key is taken from the current keyring; to force the use of a file, prefix the first argument with "./".  If no arguments are given the parameters are read from stdin; the expected format are lines with the fingerprint and the mailbox separated by a space.

The command --remove-key uninstalls a key from the WKD.  The process returns success in this case; to also print a diagnostic, use option -v.  If the key is not installed a diagnostic is printed and the process returns failure; to suppress the diagnostic, use option -q.

The command --revoke-key is not yet functional.

options

gpg-wks-server understands these options:

-C DIR
--directory DIR
     Use DIR as top level directory for domains.  The default is /var/lib/gnupg/wks.

--from MAILADDR
     Use MAILADDR as the default sender address.

--header NAME=VALUE
     Add the mail header "NAME: VALUE" to all outgoing mails.

--send
     Directly send created mails using the sendmail command. Requires installation of that command.

-o FILE
--output FILE
     Write the created mail also to FILE. Note that the value - for FILE would write it to stdout.

--with-dir
     When used with the command --list-domains print for each installed domain the domain name and its directory name.

--with-file
     When used with the command --check-key print for each user-id, the address, 'i' for installed key or 'n' for not installed key, and the filename.

--verbose
     Enable extra informational output.

--quiet
     Disable almost all informational output.

--version
     Print version of the program and exit.

--help
     Display a brief help page and exit.

examples

Examples
********

The Web Key Service requires a working directory to store keys pending for publication.  As root create a working directory:

       # mkdir /var/lib/gnupg/wks
       # chown webkey:webkey /var/lib/gnupg/wks
       # chmod 2750 /var/lib/gnupg/wks

Then under your webkey account create directories for all your domains.  Here we do it for "example.net":

       $ mkdir /var/lib/gnupg/wks/example.net

Finally run

       $ gpg-wks-server --list-domains

to create the required sub-directories with the permissions set correctly.  For each domain a submission address needs to be configured.  All service mails are directed to that address.  It can be the same address for all configured domains, for example:

       $ cd /var/lib/gnupg/wks/example.net
       $ echo key-submission@example.net >submission-address

The protocol requires that the key to be published is sent with an encrypted mail to the service.  Thus you need to create a key for the submission address:

       $ gpg --batch --passphrase '' --quick-gen-key key-submission@example.net
       $ gpg -K key-submission@example.net

The output of the last command looks similar to this:

       sec   rsa3072 2016-08-30 [SC]
             C0FCF8642D830C53246211400346653590B3795B
       uid           [ultimate] key-submission@example.net
                     bxzcxpxk8h87z1k7bzk86xn5aj47intu@example.net
       ssb   rsa3072 2016-08-30 [E]

Take the fingerprint from that output and manually publish the key:

       $ gpg-wks-server --install-key C0FCF8642D830C53246211400346653590B3795B \
       >                key-submission@example.net

Finally that submission address needs to be redirected to a script running gpg-wks-server.  The procmail command can be used for this: Redirect the submission address to the user "webkey" and put this into webkey's .procmailrc:

     :0
     * !^From: webkey@example.net
     * !^X-WKS-Loop: webkey.example.net
     |gpg-wks-server -v --receive \
          --header X-WKS-Loop=webkey.example.net \
          --from webkey@example.net --send

see also