Commit Graph

599 Commits

Author SHA1 Message Date
Werner Koch 3a28706cfd
gpgconf: Before --launch check that the config file is fine.
* tools/gpgconf-comp.c (gc_component_launch): Check the conf file.
* tools/gpgconf.c (gpgconf_failure): Call log_flush.
--
GnuPG-bug-id: 4497
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-16 12:27:03 +02:00
Werner Koch 31e26037bd
gpgconf: Support --homedir for --launch.
* tools/gpgconf-comp.c (gpg_agent_runtime_change): Simplify because
gnupg_homedir already returns abd absolute name.
(scdaemon_runtime_change): Ditto.
(dirmngr_runtime_change): Ditto.
(gc_component_launch): Support --homedir.
--

GnuPG-bug-id: 4496
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-05-15 08:53:20 +02:00
Werner Koch 2f3eebf186
wkd: New command --print-wkd-url for gpg-wks-client.
* tools/gpg-wks-client.c (aPrintWKDURL): New.
(opts): Add option.
(main): Implement.
* tools/wks-util.c (wks_cmd_print_wkd_url): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-03-25 15:14:32 +01:00
Werner Koch 64621f1f40
wkd: New command --print-wkd-hash for gpg-wks-client.
* tools/gpg-wks-client.c (aPrintWKDHash): New.
(opts) : Add "--print-wkd-hash".
(main): Implement that command.
(proc_userid_from_stdin): New.
* tools/wks-util.c (wks_fname_from_userid): Add option HASH_ONLY.
(wks_cmd_print_wkd_hash): New.
--

GnuPG-bug-id: 4418
Signed-off-by: Werner Koch <wk@gnupg.org>
2019-03-25 14:41:44 +01:00
Werner Koch 5d73c231e4
gpgtar: Make option -C work for archive creation.
* tools/gpgtar-create.c (gpgtar_create): Switch to the -C directory.
--

The -C option is pretty useful given that pattern are always relative
to the current directory.  In contrast to GNU tar, the switching is
done only once.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit b3a7a51407)
2019-03-07 10:56:18 +01:00
Werner Koch 2e4151a341
gpgtar: Improve error messages.
* tools/gpgtar.h (struct tarinfo_s): New.
* tools/gpgtar.c (cmd, skip_crypto, files_from, null_names): Move
global vars more to the top.
(set_cmd): Rename 'cmd' to 'c'.
* tools/gpgtar-list.c (parse_header): Add arg 'info' and improve error
messages.
(read_header): Add arg 'info' and update counter.
(skip_data): Ditto.
(gpgtar_list): Pass info object to read functions.
(gpgtar_read_header): Add arg 'info'.
* tools/gpgtar-extract.c (gpgtar_extract): add arg 'info' and pass on.
(extract_regular): Add arg 'info' and update counter.
--

This now prints the block number of a header with error.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 72feb8fa82)
2019-03-07 10:55:21 +01:00
Werner Koch 92e26ade5c
conf: New option --show-socket.
* tools/gpgconf-comp.c (gc_component_t): Move this enum to ...
* tools/gpgconf.h: here.
* tools/gpgconf.c (oShowSocket): New.
(opts): Add new option.
(main): Implement new option.
--

This is a convenience options for software which directly connects to
gpg-agent and thus needs to new the socket.  By using --show-socket
along with --launch that software can also autostart the agent or the
dirmngr.  Without this two calls to gpgconf would be required.

Actually the same behaviour can be achieved by running
gpg-connect-agent to query the running gpg-agent's socket via GETINFO.
The gpg-connect also makes sure that the agent is started.  This is
not anymore suggested because gpgconf shall in future be used for all
such things.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ac485b4f25)
2019-02-26 13:15:58 +01:00
Werner Koch 16424d8a34
wks: Do not use compression for the encrypted data.
* tools/gpg-wks-client.c (encrypt_response): Add arg -z0.
* tools/gpg-wks-server.c (encrypt_stream): Ditto.
--

If for example a server was built without the development packages of
the compression libraries installed, the server will not be able to
decrypt a request.  In theory this can't happen due to the preference
system but it is just to easy to create the server's key using a
different version of gpg and then use gpg-wks-server built
differently.

For the short messages we exchange compression is not really required
and thus we better do without to make the system more robust.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 70a8db0333)
2018-12-18 08:25:02 +01:00
Tomi Leppänen dfcc5e6d3e
tools: Use POSIX compatible arguments for find
* tools/addgnupghome (filelist): Remove bashism.
2018-12-11 08:44:33 +01:00
Werner Koch 80bf1f8901
wks: Fix filter expression syntax flaw.
* tools/wks-util.c (wks_get_key, wks_filter_uid): The filter
expression needs a space before the value.
(install_key_from_spec_file): Replace es_getline by es_read_line and
remove debug output.
--

A value of starting with '<' was considered an invalid operator due to
our tokenization method.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 0c36ec241d)
2018-12-05 08:48:10 +01:00
Werner Koch b6fd60dfa1
wks: Allow reading of --install-key arguments from stdin.
* tools/wks-util.c (install_key_from_spec_file): New.
(wks_cmd_install_key): Call it.
* tools/gpg-wks-client.c (main): Allow --install-key w/o arguments.
* tools/gpg-wks-server.c (main): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ba46a359b9)
2018-12-05 08:47:09 +01:00
Werner Koch bf29d7c822
wks: Create sub-directories
* tools/wks-util.c (wks_compute_hu_fname): Stat and create directory
if needed.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 73e5b0ec9b)
2018-12-05 08:41:52 +01:00
Werner Koch 5b4aa8c6d4
wks: Add new commands --install-key and --remove-key to the client.
* tools/gpg-wks-client.c (aInstallKey, aRemoveKey, oDirectory): New.
(opts): Add "--install-key", "--remove-key" and "-C".
(parse_arguments): Parse them.
(main): Check that the given directory exists.  Implement the new
commands.
--

These commands maybe useful to prepare a WKD directory on a non-Unix
box using the standard wks client.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 602b190963)
2018-12-05 08:41:50 +01:00
Werner Koch 51b722c6f5
wks: Move a few server functions to wks-util.
* tools/gpg-wks-server.c (write_to_file): Move to ...
* tools/wks-util.c: here.
* tools/gpg-wks-server.c (compute_hu_fname): Move to ...
* tools/wks-util.c (wks_compute_hu_fname): here.
* tools/gpg-wks-server.c (fname_from_userid): Move to ...
* tools/wks-util.c (wks_fname_from_userid): here.
* tools/gpg-wks-server.c (command_install_key): Move to ...
* tools/wks-util.c (wks_cmd_install_key): here and change caller.
* tools/gpg-wks-server.c (command_remove_key): Move to ...
* tools/wks-util.c (wks_cmd_remove_key): here and change callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 99094c992c)
2018-12-05 08:41:33 +01:00
Werner Koch 2768293b1e
tools: Let gpg-zip print a deprecation warning.
--
GnuPG-bug-id: 4251

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-11-15 16:13:52 +01:00
Werner Koch 66e0bd37ee
wks: New option --with-colons for gpg-wks-client.
* tools/gpg-wks.h (opt): Add field with_colons.
* tools/gpg-wks-client.c (oWithColons): New const.
(opts, parse_arguments): Add option --with-colons.
(main): Change aSupported to take several domains in --with-colons
mode.
(command_send): Factor policy getting code out to ...
(get_policy_and_sa): New function.
(command_supported): Make use of new function.
--

In addition to this the --create command now also supports a
submission address only in the policy file.  That means the
submission-address file is not anymore required and can be replaced by
the policy file.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit e3a1e80d13)
2018-11-05 20:58:58 +01:00
Werner Koch d5f540e7a9
tools: Replace duplicated code in mime-maker.
* tools/rfc822parse.c (HEADER_NAME_CHARS): New.  Taken from
mime-maker.c.
(rfc822_valid_header_name_p): New.  Based on code from mime-maker.c.
(rfc822_capitalize_header_name): New.  Copied from mime-maker.c.
(capitalize_header_name): Remove.  Replace calls by new func.
(my_toupper, my_strcasecmp): New.
* tools/mime-maker.c: Include rfc822parse.h.
(HEADER_NAME_CHARS, capitalize_header_name): Remove.
(add_header): Replace check and capitalization by new functions.
--

This is a straightforward change with two minor chnages:

- In rfc822parse.c the capitalization handles MIME-Version special.
- The check in mime-maker bow detects a zero-length name as invalid.

my_toupper and my_strcasecmp are introduced to allow standalone use
of that file.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f03928b16c)
2018-11-05 09:19:13 +01:00
Werner Koch 839426104a
wkd: Add option --directory to the server.
* tools/gpg-wks-server.c (opts): Add '--directory',
(main): Explain how to set correct permissions.
(command_list_domains): Create an empty policy file and remove the
warning for an empty policy file.
--

Note that a policy file is meanwhile required and thus is is useful to
create it.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f248416bc9)
2018-10-26 14:59:43 +02:00
Werner Koch f1561e5196
tools: Fix FILE memory leak in gpg-connect-agent.
* tools/gpg-connect-agent.c (do_open): dup the fileno and close the
stream.

GnuPG-bug-id: 4220
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 378719f25f)
2018-10-24 20:30:17 +02:00
Andre Heinecke e43844c3b0
gpgconf, w32: Allow UNC paths
* tools/gpgconf-comp.c (get_config_filename): Allow UNC paths.

--
The homedir of GnuPG on Windows can be on a network share
e.g. if %APPDATA% is redirected to a network share. The
file API calls work and GnuPG itself works nicely
with such paths so gpgconf should work with them, too.

GnuPG-Bug-Id: T3818
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2018-02-28 16:33:23 +01:00
Werner Koch 685a5e1558
wks: Add special mode to --install-key.
* tools/gpg-wks-client.c (get_key_status_parm_s)
(get_key_status_cb, get_key): Move to ...
* tools/wks-util.c: ...here.
(get_key): Rename to wks_get_key.
* tools/gpg-wks-server.c: Include userids.h.
(command_install_key): Allow use of a fingerprint.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-02-20 15:23:19 +01:00
Werner Koch ee474856ec
wks: Implement server command --install-key.
* tools/wks-util.c (wks_filter_uid): Add arg 'binary'.
* tools/gpg-wks-server.c (main): Expect 2 args for --install-key.
(write_to_file): New.
(check_and_publish): Factor some code out to ...
(compute_hu_fname): ... new.
(command_install_key): Implement.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-02-20 11:45:58 +01:00
Werner Koch 1877603761
wks: Support alternative submission address.
* tools/gpg-wks.h (policy_flags_s): Add field 'submission_address'.
* tools/wks-util.c (wks_parse_policy): Parse that field.
(wks_free_policy): New.
* tools/gpg-wks-client.c (command_send): Also try to take the
submission-address from the policy file.  Free POLICY.
* tools/gpg-wks-server.c (process_new_key): Free POLICYBUF.
(command_list_domains): Free POLICY.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-02-20 09:00:00 +01:00
Werner Koch 7449063b1a
wks: New server options --check, --with-dir, with-file.
* tools/gpg-wks-server.c (aCheck, oWithDir, oWithFile): New const.
(opts): New options --check, --with-dir, and --with-file.
(main): Call command_check_key.
(command_list_domains): Implement option --with-dir.
(fname_from_userid): New.
(command_check_key): New.
(command_remove_key): Implement existsing command.
(command_revoke_key): Call command_remove_key as a simple
implementation.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-12-19 17:42:10 +01:00
Werner Koch 482e000b8a
conf: New option --status-fd.
* tools/gpgconf.c (oStatusFD): New const.
(opts): New option --status-fd.
(statusfp): New var.
(set_status_fd): New.
(gpgconf_write_status): New.
(gpgconf_failure): New.
(main): Set status fd and replace exit by gpgconf_failure.
* tools/gpgconf-comp.c: Repalce exit by gpgconf_failure.
(gc_process_gpgconf_conf): Print a few warning status messages.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-12-18 17:46:05 +01:00
Werner Koch d74c40cef0
gpgconf: Show --compliance in expert mode.
* tools/gpgconf-comp.c (gc_options_gpg): Set compliance to expert.
(gc_options_gpgsm): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-12-18 16:31:54 +01:00
Werner Koch 8c878ae4c9
sm: Allow explicit setting of the default --compliance=gnupg
* sm/gpgsm.c (main): Allow setting of the default compliance.
* tools/gpgconf-comp.c (gc_options_gpgsm): Add "compliance".
--

This is required so that we can use this option in in gpgconf.conf.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-12-18 12:05:31 +01:00
Andre Heinecke 878b8bfdcc
gpgtar: Prefer --set-filename over implicit name
* tools/gpgtar-extract.c: Prefer opt.filename over filename
for the directory prefix.

--
If you would extract from stdin (filename -) and use set-filename
to provide a real filename the "-" would be used for the directory
name. With this change an explicit filename is prefered.

GnuPG-Bug-Id: T3500
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2017-11-15 09:56:22 +01:00
Werner Koch 6e808ae470
gpgconf: Ignore non-installed components with --apply-profile.
* tools/gpgconf-comp.c (retrieve_options_from_program): Add arg
only_installed.
(gc_component_retrieve_options): Use this if we want to process all
components.
--

Note that this also also ignores them in --with-defaults.  This is
useful for systems which come without scdaemon.

GnuPG-bug-id: 3313
Signed-off-by: Werner Koch <wk@gnupg.org>
2017-10-24 12:01:35 +02:00
Werner Koch 50c8b6c88f
wks: Create a new user id if provider wants mailbox-only.
* tools/gpg-wks-client.c (get_key): Add arg 'exact'.
(add_user_id): New.
(command_send): Create new user id.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-18 15:41:51 +02:00
Werner Koch 7f7f5d06fa
wks: Send only the newest UID to the server.
* tools/wks-util.c (list_key_status_cb): Rename to key_status_cb.
(wks_filter_uid): New.
(wks_list_key): Allow FPR to be NULL.  Return an error if no
fingerprint was found.
* tools/gpg-wks-server.c (process_new_key)
(check_and_publish): Remove now useless extra check for FPR.
* tools/gpg-wks-client.c (command_check): Ditto.
(command_send): Filter out the newest uid.
--

This fixes the case of having several userids with all the the same
mailbox.  Now we use the latest user id created.  This patch is also a
prerequisite to automatically create a new user id for providers with
the mailbox-only policy.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-18 12:52:20 +02:00
Werner Koch a0035986a8
wks: Print the UID creation time with gpg-wks-client --check.
* tools/gpg-wks.h (uidinfo_list_s): Add field 'created'.
* tools/wks-util.c (append_to_uidinfo_list): Add arf 'created'.
(wks_list_key): Pass timestamp to append_to_uidinfo_list.
* tools/gpg-wks-client.c (command_check): Print UID creation time.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-18 11:31:36 +02:00
Werner Koch 4e0696de89
wks: Use dedicated type to convey user ids.
* tools/gpg-wks.h (uidinfo_list_s, uidinfo_list_t): New.
* tools/wks-util.c (append_to_uidinfo_list): New.
(free_uidinfo_list): New.
(wks_list_key): Change arg r_mboxes to uidinfo_list_t.  Use
append_to_uidinfo_list.
* tools/gpg-wks-server.c (sserver_ctx_s): Replace strlist_t by
uidinfo_list_t.
(process_new_key): Ditto.
(check_and_publish): Ditto.
(command_receive_cb): Replace free_strlist by free_uidinfo_list.
* tools/gpg-wks-client.c (command_check): Replace strlist_t by
uidinfo_list_t.  Also print user id in verbose mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-18 11:16:07 +02:00
Werner Koch a821b4f556
wks: Add hack for the broken posteo system
* tools/gpg-wks-client.c (command_send): Additional hack for posteo.
Check the protocol-version flag.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-12 18:08:09 +02:00
Werner Koch 332c9eaa2a
wks: Add new policy flag protocol-version
* tools/gpg-wks.h (policy_flags_s): Add field protocol_version.
* tools/wks-util.c (wks_parse_policy): Add new policy flag.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-12 18:05:00 +02:00
Werner Koch c65a7bba73
wks: Use unencrypted draft-1 mode for posteo.de
* tools/gpg-wks-client.c (command_send): Allow sending in draft-1
mode.
--

Obviously Posteo did not implement the current draft and thus it was
not possible to send a request to them.  This hack uses the old method
for posteo.de.  Not sending it encrypted is okay here because they use
authenticated sending anyway.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-12 14:35:11 +02:00
Werner Koch 7d15ee8898
tools: New function mime_maker_add_body_data.
* tools/mime-maker.c (mime_maker_add_body_data): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-09-12 14:35:06 +02:00
Werner Koch 565e486b80
gpgconf: Swap "auto-key-retrieve" and "no-auto-key-retrieve".
* g10/gpg.c (gpgconf_list): Announce "auto-key-retrieve".
(main): Simplify setting of KEYSERVER_AUTO_KEY_RETRIEVE.
* tools/gpgconf-comp.c: Make "no-auto-key-retrieve" invisible.  Make
"auto-key-retrieve" an expert option.
--

This basically reverts 9bb13a0e81
because --no-auto-key-retrieve is again the default.  Note that we
allow both options for the sake of profiles.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-23 16:45:20 +02:00
Werner Koch 008ae0bd86
build: Change SWDB tag "gnupg21" to "gnupg22".
* configure.ac (GNUPG_SWDB_TAG): New ac_define.  Set it to "gnupg22".
* tools/gpgconf.c (query_swdb): Use it.
* build-aux/speedo.mk: Change tag "gnupg21" to "gnupg22".
* Makefile.am (distcheck-hook): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-23 14:52:29 +02:00
Damien Goutte-Gattat 0161225457
gpgconf: Make WoT settings configurable by gpgconf.
* tools/gpgconf-comp.c (gc_options_gpg): Add max-cert-depth,
completes-needed, and marginals-needed options.
* g10/gpg.c (gpgconf_list): Likewise.
--

Some tests to come for the PGP trust model will need to manipulate
these parameters.

Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
2017-08-21 16:50:01 +02:00
Justus Winter c4506f624e
gpg: Add option '--disable-dirmngr'.
* doc/gpg.texi: Document new option.
* g10/call-dirmngr.c (create_context): Fail if option is given.
* g10/gpg.c (cmd_and_opt_values): New value.
(opts): New option.
(gpgconf_list): Add new option.
(main): Handle new option.
* g10/options.h (struct opt): New field 'disable_dirmngr'.
* tools/gpgconf-comp.c (gc_options_gpg): New option.

GnuPG-bug-id: 3334
Signed-off-by: Justus Winter <justus@g10code.com>
2017-08-08 11:43:22 +02:00
Werner Koch 69e97d909d
gpg: gpgconf needs to support the now default --auto-key-retrieve.
* tools/gpgconf-comp.c (gc_options_gpg): Re-add "auto-key_retrieve".
--

Although this option is invisible, it might be in use by gpgconf
profiles.  We don't want to break them.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-05 14:26:22 +02:00
Werner Koch 9bb13a0e81
gpg: Make --no-auto-key-retrieve gpgconf-igurable.
* g10/gpg.c (gpgconf_list): Print no-auto-key-retrieve instead of
auto-key-retrieve.
* tools/gpgconf-comp.c (gc_options_gpg): Replace auto-key-retrieve by
no-auto-key-retrieve and chnage level from invisible to advanced.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-04 22:19:37 +02:00
Werner Koch 3d78ae4d3d
agent: Make --no-grab the default.
* agent/gpg-agent.c (oGrab): New const.
(opts): New option --grab.  Remove description for --no-grab.
(parse_rereadable_options): Make --no-grab the default.
(finalize_rereadable_options): Allow --grab to override --no-grab.
(main) <gpgconflist>: Add "grab".
* tools/gpgconf-comp.c (gc_options_gpg_agent): Add "grab".

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-04 18:34:03 +02:00
Werner Koch 6cba56d436
wks: Allow gpg-wks-client --supported with just the domain name
* tools/gpg-wks-client.c (command_supported): Hack for missing local
part.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-08-03 21:16:34 +02:00
NIIBE Yutaka fde9a8cc6c Simple typo fix.
* tools/rfc822parse.c: Fix.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-08-01 11:44:52 +09:00
Werner Koch 6c9899bede
agent: Make --ssh-fingerprint-digest re-readable.
* agent/gpg-agent.c (main): Move oSSHFingerprintDigest to ...
(parse_rereadable_options): here.
(opts): Change its description.
(main) <aGPGConfList>: Include this option.
* tools/gpgconf-comp.c (gc_options_gpg_agent): Add option at expert
level.

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-07-28 18:23:46 +02:00
Werner Koch c76398da5b
wks: Fix program names in the usage diagnostics.
* tools/gpg-wks-client.c (my_strusage): Add case 12.
* tools/gpg-wks-server.c (my_strusage): Add case 12:

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-07-26 17:53:00 +02:00
Werner Koch b428dd495a
wks: Add stubs for new gpg-wks-server commands.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2017-07-26 17:53:00 +02:00
NIIBE Yutaka 99791184ac gpgconf: Make vars read-only explicitly.
* tools/gpgconf-comp.c (gc_backend, gc_arg_type, gc_level, gc_flag)
(gc_component): Add const qualifier.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-07-19 13:43:23 +09:00