mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Add option --allow-weak-key-signatures.
* g10/gpg.c (oAllowWeakKeySignatures): New. (opts): Add --allow-weak-key-signatures. (main): Set it. * g10/options.h (struct opt): Add flags.allow_weak_key_signatures. * g10/misc.c (print_sha1_keysig_rejected_note): New. * g10/sig-check.c (check_signature_over_key_or_uid): Print note and act on new option. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
f4047f5605
commit
e624c41dba
19
doc/gpg.texi
19
doc/gpg.texi
@ -113,9 +113,12 @@ only one command is allowed. Generally speaking, irrelevant options
|
|||||||
are silently ignored, and may not be checked for correctness.
|
are silently ignored, and may not be checked for correctness.
|
||||||
|
|
||||||
@command{@gpgname} may be run with no commands. In this case it will
|
@command{@gpgname} may be run with no commands. In this case it will
|
||||||
perform a reasonable action depending on the type of file it is given
|
print a warning perform a reasonable action depending on the type of
|
||||||
as input (an encrypted message is decrypted, a signature is verified,
|
file it is given as input (an encrypted message is decrypted, a
|
||||||
a file containing keys is listed, etc.).
|
signature is verified, a file containing keys is listed, etc.).
|
||||||
|
|
||||||
|
If you run into any problems, please add the option @option{--verbose}
|
||||||
|
to the invocation to see more diagnostics.
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
@ -2387,10 +2390,10 @@ opposite meaning. The options are:
|
|||||||
|
|
||||||
@item self-sigs-only
|
@item self-sigs-only
|
||||||
Accept only self-signatures while importing a key. All other
|
Accept only self-signatures while importing a key. All other
|
||||||
key-signatures are skipped at an early import stage. This option
|
key signatures are skipped at an early import stage. This option
|
||||||
can be used with @code{keyserver-options} to mitigate attempts to
|
can be used with @code{keyserver-options} to mitigate attempts to
|
||||||
flood a key with bogus signatures from a keyserver. The drawback is
|
flood a key with bogus signatures from a keyserver. The drawback is
|
||||||
that all other valid key-signatures, as required by the Web of Trust
|
that all other valid key signatures, as required by the Web of Trust
|
||||||
are also not imported.
|
are also not imported.
|
||||||
|
|
||||||
@item repair-keys
|
@item repair-keys
|
||||||
@ -3340,6 +3343,12 @@ weak. See also @option{--allow-weak-digest-algos} to disable
|
|||||||
rejection of weak digests. MD5 is always considered weak, and does
|
rejection of weak digests. MD5 is always considered weak, and does
|
||||||
not need to be listed explicitly.
|
not need to be listed explicitly.
|
||||||
|
|
||||||
|
@item --allow-weak-key-signatures
|
||||||
|
@opindex allow-weak-key-signatures
|
||||||
|
To avoid a minor risk of collision attacks on third-party key
|
||||||
|
signatures made using SHA-1, those key signatures are considered
|
||||||
|
invalid. This options allows to override this restriction.
|
||||||
|
|
||||||
@item --no-default-keyring
|
@item --no-default-keyring
|
||||||
@opindex no-default-keyring
|
@opindex no-default-keyring
|
||||||
Do not add the default keyrings to the list of keyrings. Note that
|
Do not add the default keyrings to the list of keyrings. Note that
|
||||||
|
@ -414,6 +414,7 @@ enum cmd_and_opt_values
|
|||||||
oEnableDSA2,
|
oEnableDSA2,
|
||||||
oDisableDSA2,
|
oDisableDSA2,
|
||||||
oAllowWeakDigestAlgos,
|
oAllowWeakDigestAlgos,
|
||||||
|
oAllowWeakKeySignatures,
|
||||||
oFakedSystemTime,
|
oFakedSystemTime,
|
||||||
oNoAutostart,
|
oNoAutostart,
|
||||||
oPrintPKARecords,
|
oPrintPKARecords,
|
||||||
@ -902,6 +903,9 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_s_n (oNoSymkeyCache, "no-symkey-cache", "@"),
|
ARGPARSE_s_n (oNoSymkeyCache, "no-symkey-cache", "@"),
|
||||||
ARGPARSE_s_n (oUseKeyboxd, "use-keyboxd", "@"),
|
ARGPARSE_s_n (oUseKeyboxd, "use-keyboxd", "@"),
|
||||||
|
|
||||||
|
/* Options to override new security defaults. */
|
||||||
|
ARGPARSE_s_n (oAllowWeakKeySignatures, "allow-weak-key-signatures", "@"),
|
||||||
|
|
||||||
/* Options which can be used in special circumstances. They are not
|
/* Options which can be used in special circumstances. They are not
|
||||||
* published and we hope they are never required. */
|
* published and we hope they are never required. */
|
||||||
ARGPARSE_s_n (oUseOnlyOpenPGPCard, "use-only-openpgp-card", "@"),
|
ARGPARSE_s_n (oUseOnlyOpenPGPCard, "use-only-openpgp-card", "@"),
|
||||||
@ -3639,6 +3643,10 @@ main (int argc, char **argv)
|
|||||||
opt.flags.allow_weak_digest_algos = 1;
|
opt.flags.allow_weak_digest_algos = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case oAllowWeakKeySignatures:
|
||||||
|
opt.flags.allow_weak_key_signatures = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case oFakedSystemTime:
|
case oFakedSystemTime:
|
||||||
{
|
{
|
||||||
size_t len = strlen (pargs.r.ret_str);
|
size_t len = strlen (pargs.r.ret_str);
|
||||||
|
@ -101,6 +101,7 @@ void print_pubkey_algo_note (pubkey_algo_t algo);
|
|||||||
void print_cipher_algo_note (cipher_algo_t algo);
|
void print_cipher_algo_note (cipher_algo_t algo);
|
||||||
void print_digest_algo_note (digest_algo_t algo);
|
void print_digest_algo_note (digest_algo_t algo);
|
||||||
void print_digest_rejected_note (enum gcry_md_algos algo);
|
void print_digest_rejected_note (enum gcry_md_algos algo);
|
||||||
|
void print_sha1_keysig_rejected_note (void);
|
||||||
void print_reported_error (gpg_error_t err, gpg_err_code_t skip_if_ec);
|
void print_reported_error (gpg_error_t err, gpg_err_code_t skip_if_ec);
|
||||||
void print_further_info (const char *format, ...) GPGRT_ATTR_PRINTF(1,2);
|
void print_further_info (const char *format, ...) GPGRT_ATTR_PRINTF(1,2);
|
||||||
void additional_weak_digest (const char* digestname);
|
void additional_weak_digest (const char* digestname);
|
||||||
|
18
g10/misc.c
18
g10/misc.c
@ -362,6 +362,24 @@ print_digest_rejected_note (enum gcry_md_algos algo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
print_sha1_keysig_rejected_note (void)
|
||||||
|
{
|
||||||
|
static int shown;
|
||||||
|
|
||||||
|
if (shown)
|
||||||
|
return;
|
||||||
|
|
||||||
|
shown = 1;
|
||||||
|
es_fflush (es_stdout);
|
||||||
|
log_info (_("Note: third-party key signatures using"
|
||||||
|
" the %s algorithm are rejected\n"),
|
||||||
|
gcry_md_algo_name (GCRY_MD_SHA1));
|
||||||
|
print_further_info ("use option \"%s\" to override",
|
||||||
|
"--allow-weak-key-signatures");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print a message
|
/* Print a message
|
||||||
* "(reported error: %s)\n
|
* "(reported error: %s)\n
|
||||||
* in verbose mode to further explain an error. If the error code has
|
* in verbose mode to further explain an error. If the error code has
|
||||||
|
@ -246,6 +246,7 @@ struct
|
|||||||
unsigned int utf8_filename:1;
|
unsigned int utf8_filename:1;
|
||||||
unsigned int dsa2:1;
|
unsigned int dsa2:1;
|
||||||
unsigned int allow_weak_digest_algos:1;
|
unsigned int allow_weak_digest_algos:1;
|
||||||
|
unsigned int allow_weak_key_signatures:1;
|
||||||
unsigned int large_rsa:1;
|
unsigned int large_rsa:1;
|
||||||
unsigned int disable_signer_uid:1;
|
unsigned int disable_signer_uid:1;
|
||||||
/* Flag to enable experimental features from RFC4880bis. */
|
/* Flag to enable experimental features from RFC4880bis. */
|
||||||
|
@ -1012,12 +1012,14 @@ check_signature_over_key_or_uid (ctrl_t ctrl, PKT_public_key *signer,
|
|||||||
else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
|
else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
|
||||||
{
|
{
|
||||||
log_assert (packet->pkttype == PKT_USER_ID);
|
log_assert (packet->pkttype == PKT_USER_ID);
|
||||||
if (sig->digest_algo == DIGEST_ALGO_SHA1 && !*is_selfsig)
|
if (sig->digest_algo == DIGEST_ALGO_SHA1 && !*is_selfsig
|
||||||
|
&& !opt.flags.allow_weak_key_signatures)
|
||||||
{
|
{
|
||||||
/* If the signature was created using SHA-1 we consider this
|
/* If the signature was created using SHA-1 we consider this
|
||||||
* signature invalid because it makes it possible to mount a
|
* signature invalid because it makes it possible to mount a
|
||||||
* chosen-prefix collision. We don't do this for
|
* chosen-prefix collision. We don't do this for
|
||||||
* self-signatures, though. */
|
* self-signatures, though. */
|
||||||
|
print_sha1_keysig_rejected_note ();
|
||||||
rc = gpg_error (GPG_ERR_DIGEST_ALGO);
|
rc = gpg_error (GPG_ERR_DIGEST_ALGO);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user