diff options
author | Fabian Stelzer <fs@gigacodes.de> | 2021-12-09 09:52:45 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-09 13:38:04 -0800 |
commit | 6393c956f4e7061d6b19981bd8cd28ef037b911e (patch) | |
tree | 100c3a720d68ab90e315e72a6b410f5417eea406 /commit.c | |
parent | ssh signing: add key lifetime test prereqs (diff) | |
download | tgif-6393c956f4e7061d6b19981bd8cd28ef037b911e.tar.xz |
ssh signing: make verify-commit consider key lifetime
If valid-before/after dates are configured for this signatures key in the
allowedSigners file then the verification should check if the key was valid at
the time the commit was made. This allows for graceful key rollover and
revoking keys without invalidating all previous commits.
This feature needs openssh > 8.8. Older ssh-keygen versions will simply
ignore this flag and use the current time.
Strictly speaking this feature is available in 8.7, but since 8.7 has a
bug that makes it unusable in another needed call we require 8.8.
Timestamp information is present on most invocations of check_signature.
However signer ident is not. We will need the signer email / name to be able
to implement "Trust on first use" functionality later.
Since the payload contains all necessary information we can parse it
from there. The caller only needs to provide us some info about the
payload by setting payload_type in the signature_check struct.
- Add payload_type field & enum and payload_timestamp to struct
signature_check
- Populate the timestamp when not already set if we know about the
payload type
- Pass -Overify-time={payload_timestamp} in the users timezone to all
ssh-keygen verification calls
- Set the payload type when verifying commits
- Add tests for expired, not yet valid and keys having a commit date
outside of key validity as well as within
Signed-off-by: Fabian Stelzer <fs@gigacodes.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1213,6 +1213,7 @@ int check_commit_signature(const struct commit *commit, struct signature_check * if (parse_signed_commit(commit, &payload, &signature, the_hash_algo) <= 0) goto out; + sigc->payload_type = SIGNATURE_PAYLOAD_COMMIT; sigc->payload = strbuf_detach(&payload, &sigc->payload_len); ret = check_signature(sigc, signature.buf, signature.len); |