diff options
author | Neal H. Walfield <neal@g10code.com> | 2015-10-18 18:44:05 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@g10code.com> | 2015-10-18 18:45:40 +0200 |
commit | f77913e0ff7be4cd9c6337a70ac715e6f4a43572 (patch) | |
tree | d54aafd73b9f88111d953413c5e0b90c67a79239 /doc | |
parent | common: Prefix the mkdir functions with gnupg_. Make args const. (diff) | |
download | gnupg2-f77913e0ff7be4cd9c6337a70ac715e6f4a43572.tar.xz gnupg2-f77913e0ff7be4cd9c6337a70ac715e6f4a43572.zip |
g10: Add TOFU support.
* configure.ac: Check for sqlite3.
(SQLITE3_CFLAGS): AC_SUBST it.
(SQLITE3_LIBS): Likewise.
* g10/Makefile.am (AM_CFLAGS): Add $(SQLITE3_CFLAGS).
(gpg2_SOURCES): Add tofu.h and tofu.c.
(gpg2_LDADD): Add $(SQLITE3_LIBS).
* g10/tofu.c: New file.
* g10/tofu.h: New file.
* g10/options.h (trust_model): Define TM_TOFU and TM_TOFU_PGP.
(tofu_db_format): Define.
* g10/packet.h (PKT_signature): Add fields digest and digest_len.
* g10/gpg.c: Include "tofu.h".
(cmd_and_opt_values): Declare aTOFUPolicy, oTOFUDefaultPolicy,
oTOFUDBFormat.
(opts): Add them.
(parse_trust_model): Recognize the tofu and tofu+pgp trust models.
(parse_tofu_policy): New function.
(parse_tofu_db_format): New function.
(main): Initialize opt.tofu_default_policy and opt.tofu_db_format.
Handle aTOFUPolicy, oTOFUDefaultPolicy and oTOFUDBFormat.
* g10/mainproc.c (do_check_sig): If the signature is good, copy the
hash to SIG->DIGEST and set SIG->DIGEST_LEN appropriately.
* g10/trustdb.h (get_validity): Add arguments sig and may_ask. Update
callers.
(tdb_get_validity_core): Add arguments sig and may_ask. Update
callers.
* g10/trust.c (get_validity) Add arguments sig and may_ask. Pass them
to tdb_get_validity_core.
* g10/trustdb.c: Include "tofu.h".
(trust_model_string): Handle TM_TOFU and TM_TOFU_PGP.
(tdb_get_validity_core): Add arguments sig and may_ask. If
OPT.TRUST_MODEL is TM_TOFU or TM_TOFU_PGP, compute the TOFU trust
level. Combine it with the computed PGP trust level, if appropriate.
* g10/keyedit.c: Include "tofu.h".
(show_key_with_all_names_colon): If the trust mode is tofu or
tofu+pgp, then show the trust policy.
* g10/keylist.c: Include "tofu.h".
(public_key_list): Also show the PGP stats if the trust model is
TM_TOFU_PGP.
(list_keyblock_colon): If the trust mode is tofu or
tofu+pgp, then show the trust policy.
* g10/pkclist.c: Include "tofu.h".
* g10/gpgv.c (get_validity): Add arguments sig and may_ask.
(enum tofu_policy): Define.
(tofu_get_policy): New stub.
(tofu_policy_str): Likewise.
* g10/test-stubs.c (get_validity): Add arguments sig and may_ask.
(enum tofu_policy): Define.
(tofu_get_policy): New stub.
(tofu_policy_str): Likewise.
* doc/DETAILS: Describe the TOFU Policy field.
* doc/gpg.texi: Document --tofu-set-policy, --trust-model=tofu,
--trust-model=tofu+pgp, --tofu-default-policy and --tofu-db-format.
* tests/openpgp/Makefile.am (TESTS): Add tofu.test.
(TEST_FILES): Add tofu-keys.asc, tofu-keys-secret.asc,
tofu-2183839A-1.txt, tofu-BC15C85A-1.txt and tofu-EE37CF96-1.txt.
(CLEANFILES): Add tofu.db.
(clean-local): Add tofu.d.
* tests/openpgp/tofu.test: New file.
* tests/openpgp/tofu-2183839A-1.txt: New file.
* tests/openpgp/tofu-BC15C85A-1.txt: New file.
* tests/openpgp/tofu-EE37CF96-1.txt: New file.
* tests/openpgp/tofu-keys.asc: New file.
* tests/openpgp/tofu-keys-secret.asc: New file.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/DETAILS | 4 | ||||
-rw-r--r-- | doc/gnupg.texi | 3 | ||||
-rw-r--r-- | doc/gpg.texi | 91 |
3 files changed, 96 insertions, 2 deletions
diff --git a/doc/DETAILS b/doc/DETAILS index 811b1055a..97079b0f0 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -206,6 +206,10 @@ described here. For pub, sub, sec, and ssb records this field is used for the ECC curve name. +*** Field 18 - TOFU Policy + + This is the TOFU policy. It is either good, bad, unknown, ask or + auto. This is only shows for uid records. ** Special fields diff --git a/doc/gnupg.texi b/doc/gnupg.texi index 1fddeb007..42d9dc00c 100644 --- a/doc/gnupg.texi +++ b/doc/gnupg.texi @@ -35,7 +35,8 @@ Published by The GnuPG Project@* @end iftex @copyright{} 2002, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.@* -@copyright{} 2013, 2014, 2015 Werner Koch. +@copyright{} 2013, 2014, 2015 Werner Koch.@* +@copyright{} 2015 g10code Gmbh. @quotation Permission is granted to copy, distribute and/or modify this document diff --git a/doc/gpg.texi b/doc/gpg.texi index 35291a821..a70204043 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -525,6 +525,12 @@ Use the source, Luke :-). The output format is still subject to change. Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor. This is a GnuPG extension to OpenPGP and in general not very useful. +@item --tofu-set-policy @code{auto|good|unknown|bad|ask} @code{key...} +@opindex tofu-set-policy +Set the TOFU policy for all the bindings associated with the specified +keys. For more information about the meaning of the policies, +@pxref{trust-model-tofu}. The keys may be specified either by their +fingerprint (preferred) or their keyid. @c @item --server @c @opindex server @@ -1408,7 +1414,7 @@ don't want to keep your secret keys (or one of them) online but still want to be able to check the validity of a given recipient's or signator's key. -@item --trust-model @code{pgp|classic|direct|always|auto} +@item --trust-model @code{pgp|classic|tofu|tofu+pgp|direct|always|auto} @opindex trust-model Set what trust model GnuPG should follow. The models are: @@ -1424,6 +1430,65 @@ Set what trust model GnuPG should follow. The models are: @opindex trust-mode:classic This is the standard Web of Trust as introduced by PGP 2. + @item tofu + @opindex trust-mode:tofu + @anchor{trust-model-tofu} + TOFU stands for Trust On First Use. In this trust model, the first + time a key is seen, it is memorized. If later another key is seen + with a user id with the same email address, a warning is displayed + indicating that there is a conflict and that the key might be a + forgery and an attempt at a man-in-the-middle attack. + + Because a potential attacker is able to control the email address + and thereby circumvent the conflict detection algorithm by using an + email address that is similar in appearance to a trusted email + address, whenever a message is verified, statistics about the number + of messages signed with the key are shown. In this way, a user can + easily identify attacks using fake keys for regular correspondents. + + When compared with the Web of Trust, TOFU offers significantly + weaker security guarantees. In particular, TOFU only helps ensure + consistency (that is, that the binding between a key and email + address doesn't change). A major advantage of TOFU is that it + requires little maintenance to use correctly. To use the web of + trust properly, you need to actively sign keys and mark users as + trusted introducers. This is a time-consuming process and anecdotal + evidence suggests that even security-conscious users rarely take the + time to do this thoroughly and instead rely on an ad-hoc TOFU + process. + + In the TOFU model, policies are associated with bindings between + keys and email addresses (which are extracted from user ids and + normalized). There are five policies, which can be set manually + using the @option{--tofu-policy} option. The default policy can be + set using the @option{--tofu-default-policy} policy. + + The TOFU policies are: @code{auto}, @code{good}, @code{unknown}, + @code{bad} and @code{ask}. The @code{auto} policy is used by + default (unless overridden by @option{--tofu-default-policy}) and + marks a binding as marginally trusted. The @code{good}, + @code{unknown} and @code{bad} policies mark a binding as fully + trusted, as having unknown trust or as having trust never, + respectively. The @code{unknown} policy is useful for just using + TOFU to detect conflicts, but to never assign positive trust to a + binding. The final policy, @code{ask} prompts the user to indicate + the binding's trust. If batch mode is enabled (or input is + inappropriate in the context), then the user is not prompted and the + @code{undefined} trust level is returned. + + @item tofu+pgp + @opindex trust-mode:tofu+pgp + This trust model combines TOFU with the Web of Trust. This is done + by computing the trust level for each model and then taking the + maximum trust level where the trust levels are ordered as follows: + @code{unknown < undefined < marginal < fully < ultimate < expired < + never}. + + By setting @option{--tofu-default-policy=unknown}, this model can be + used to implement the web of trust with TOFU's conflict detection + algorithm, but without its assignment of positive trust values, + which some security-conscious users don't like. + @item direct @opindex trust-mode:direct Key validity is set directly by the user and not calculated via the @@ -1625,6 +1690,30 @@ key signer (defaults to 1). Number of marginally trusted users to introduce a new key signer (defaults to 3) +@item --tofu-default-policy @code{auto|good|unknown|bad|ask} +@opindex tofu-default-policy +The default TOFU policy (defaults to @code{auto}). For more +information about the meaning of this option, @xref{trust-model-tofu}. + +@item --tofu-db-format @code{auto|split|flat} +@opindex tofu-default-policy +The format for the TOFU DB. + +The split file format splits the data across many DBs under the +@code{tofu.d} directory (one per email address and one per key). This +makes it easier to automatically synchronize the data using a tool +such as Unison (@url{https://www.cis.upenn.edu/~bcpierce/unison/}), +since the individual files change rarely. + +The flat file format keeps all of the data in the single file +@code{tofu.db}. This format results in better performance. + +If set to auto (which is the default), GnuPG will first check for the +existence of @code{tofu.d} and @code{tofu.db}. If one of these +exists, the corresponding format is used. If neither or both of these +exist, then GnuPG defaults to the @code{split} format. In the latter +case, a warning is emitted. + @item --max-cert-depth @code{n} @opindex max-cert-depth Maximum depth of a certification chain (default is 5). |