Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0
@ 2023-05-25  3:10 Todd Zullinger
  2023-05-26  4:52 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Todd Zullinger @ 2023-05-25  3:10 UTC (permalink / raw)
  To: git; +Cc: Fabian Stelzer

OpenSSH-9.0 requires a namespace option with `-Y check-novalidate`.
This was added in openssh-portable commit a0b5816f8 (upstream:
ssh-keygen -Y check-novalidate requires namespace or SEGV, 2022-03-18).

The -n option was documented as a required option since check-novalidate
was added in openssh-portable 8aa2aa3cd (upstream: Allow testing
signature syntax and validity without verifying, 2019-09-16).

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
Hi,

I only recently noticed the GPGSSH_VERIFYTIME prereq had
been failing in the Fedora builds.  This began when openssh
was updated to 9.0 in the distribution, which means I've
been slack on checking missing prereqs since last August. :/

Initially, I thought it was another issue, where the final
ssh-keygen call in the prereq lacked a message on stdin,
which caused it to hang.

That only occurs when running the contents of the prereq
manually, so it may not be worth touching.  But if that
seems worthwhile -- if only to avoid anyone else getting
spending time debugging the wrong problem -- I can send the
patch I had prepared which does:

  diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
  index 114785586a..2815df8503 100644
  --- a/t/lib-gpg.sh
  +++ b/t/lib-gpg.sh
  @@ -165,7 +165,7 @@ test_lazy_prereq GPGSSH_VERIFYTIME '
   	# and verify ssh-keygen verifies the key lifetime
   	echo "testpayload" |
   	ssh-keygen -Y sign -n "git" -f "${GPGSSH_KEY_EXPIRED}" >gpgssh_verifytime_prereq.sig &&
  -	! (ssh-keygen -Y verify -n "git" -f "${GPGSSH_ALLOWED_SIGNERS}" -I "principal with expired key" -s gpgssh_verifytime_prereq.sig)
  +	! (echo "testpayload" | ssh-keygen -Y verify -n "git" -f "${GPGSSH_ALLOWED_SIGNERS}" -I "principal with expired key" -s gpgssh_verifytime_prereq.sig)
   '
   
   sanitize_pgp() {

 t/lib-gpg.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 114785586a..28652ed91f 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -136,7 +136,7 @@ test_lazy_prereq GPGSSH '
 
 test_lazy_prereq GPGSSH_VERIFYTIME '
 	# Check if ssh-keygen has a verify-time option by passing an invalid date to it
-	ssh-keygen -Overify-time=INVALID -Y check-novalidate -s doesnotmatter 2>&1 | grep -q -F "Invalid \"verify-time\"" &&
+	ssh-keygen -Overify-time=INVALID -Y check-novalidate -n "git" -s doesnotmatter 2>&1 | grep -q -F "Invalid \"verify-time\"" &&
 
 	# Set up keys with key lifetimes
 	ssh-keygen -t ed25519 -N "" -C "timeboxed valid key" -f "${GPGSSH_KEY_TIMEBOXEDVALID}" >/dev/null &&
-- 
2.41.0.rc2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0
  2023-05-25  3:10 [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0 Todd Zullinger
@ 2023-05-26  4:52 ` Junio C Hamano
  2023-05-26  5:28   ` Todd Zullinger
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2023-05-26  4:52 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: git, Fabian Stelzer

Todd Zullinger <tmz@pobox.com> writes:

> OpenSSH-9.0 requires a namespace option with `-Y check-novalidate`.
> This was added in openssh-portable commit a0b5816f8 (upstream:
> ssh-keygen -Y check-novalidate requires namespace or SEGV, 2022-03-18).
>
> The -n option was documented as a required option since check-novalidate
> was added in openssh-portable 8aa2aa3cd (upstream: Allow testing
> signature syntax and validity without verifying, 2019-09-16).
>
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
> Hi,
>
> I only recently noticed the GPGSSH_VERIFYTIME prereq had
> been failing in the Fedora builds.  This began when openssh
> was updated to 9.0 in the distribution, which means I've
> been slack on checking missing prereqs since last August. :/

Better late than never.  Thanks.

While I was trying to see if the symptom reproduces in my
environment roughly based on Debian testing, I had this trivial test
script

    #!/bin/sh

    test_description='heh???'

    . ./test-lib.sh
    . "$TEST_DIRECTORY/lib-gpg.sh"

    test_expect_success setup '
            : test_have_prereq GPG &&
            test_have_prereq GPGSSH_VERIFYTIME
    '

    test_done

and noticed that GPGSSH_VERIFYTIME prerequisite does not pass
regardless of the version of ssh-keygen installed, without first
triggering GPG prereq to cause "$GNUPGHOME" to get created.
Otherwise, this part

	# Set up keys with key lifetimes
	ssh-keygen -t ed25519 -N "" -C "timeboxed valid key" -f "${GPGSSH_KEY_TIMEBOXEDVALID}" >/dev/null &&

because GPGSSH_KEY_TIMEBOXEDVALID is defined to be created under
GNUPGHOME, would not work.

I notice that GPGSM lazy prereq forces GPG prereq to be triggered
by starting it like so:

    test_lazy_prereq GPGSM '
            test_have_prereq GPG &&

and I think we should do the same for GPGSSH_VERIFYTIME for
completeness in the longer term.  The current users of the
prerequisite all seem to trigger GPG prerequisite check so
this is not all that urgent, though.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0
  2023-05-26  4:52 ` Junio C Hamano
@ 2023-05-26  5:28   ` Todd Zullinger
  2023-06-01  4:46     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Todd Zullinger @ 2023-05-26  5:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Fabian Stelzer

Junio C Hamano wrote:
> While I was trying to see if the symptom reproduces in my
> environment roughly based on Debian testing, I had this trivial test
> script
> 
>     #!/bin/sh
> 
>     test_description='heh???'
> 
>     . ./test-lib.sh
>     . "$TEST_DIRECTORY/lib-gpg.sh"
> 
>     test_expect_success setup '
>             : test_have_prereq GPG &&
>             test_have_prereq GPGSSH_VERIFYTIME
>     '
> 
>     test_done
> 
> and noticed that GPGSSH_VERIFYTIME prerequisite does not pass
> regardless of the version of ssh-keygen installed, without first
> triggering GPG prereq to cause "$GNUPGHOME" to get created.
> Otherwise, this part
> 
> 	# Set up keys with key lifetimes
> 	ssh-keygen -t ed25519 -N "" -C "timeboxed valid key" -f "${GPGSSH_KEY_TIMEBOXEDVALID}" >/dev/null &&
> 
> because GPGSSH_KEY_TIMEBOXEDVALID is defined to be created under
> GNUPGHOME, would not work.
> 
> I notice that GPGSM lazy prereq forces GPG prereq to be triggered
> by starting it like so:
> 
>     test_lazy_prereq GPGSM '
>             test_have_prereq GPG &&
> 
> and I think we should do the same for GPGSSH_VERIFYTIME for
> completeness in the longer term.  The current users of the
> prerequisite all seem to trigger GPG prerequisite check so
> this is not all that urgent, though.

Good idea. Perhaps:

	test_lazy_prereq GPGSSH_VERIFYTIME '
		test_have_prereq GPGSSH &&

is best there?  The GPGSSH prereq creates ${GNUPGHOME}.  It
may not be common, but there may be folks who want to run
the SSH tests and don't care about GPG.

Something like this?  (Sorry to distract you further in the
RC period. :)

-- 8< --
Subject: [PATCH] t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereq

The GPGSSH_VERIFYTIME prequeq makes use of "${GNUPGHOME}" but does not
create it.  Require GPGSSH which creates the "${GNUPGHOME}" directory.

Additionally, it makes sense to require GPGSSH in GPGSSH_VERIFYTIME
because the latter builds on the former.  If we can't use GPGSSH,
there's little point in checking whether GPGSSH_VERIFYTIME is usable.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
 t/lib-gpg.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 114785586a..db63aeb6ed 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -135,6 +135,7 @@ test_lazy_prereq GPGSSH '
 '
 
 test_lazy_prereq GPGSSH_VERIFYTIME '
+	test_have_prereq GPGSSH &&
 	# Check if ssh-keygen has a verify-time option by passing an invalid date to it
 	ssh-keygen -Overify-time=INVALID -Y check-novalidate -s doesnotmatter 2>&1 | grep -q -F "Invalid \"verify-time\"" &&
 
-- 8< --

-- 
Todd

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0
  2023-05-26  5:28   ` Todd Zullinger
@ 2023-06-01  4:46     ` Junio C Hamano
  2023-06-06 21:47       ` [PATCH] t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereq Todd Zullinger
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2023-06-01  4:46 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: git, Fabian Stelzer

Todd Zullinger <tmz@pobox.com> writes:

> Good idea. Perhaps:
>
> 	test_lazy_prereq GPGSSH_VERIFYTIME '
> 		test_have_prereq GPGSSH &&
>
> is best there?  The GPGSSH prereq creates ${GNUPGHOME}.  It
> may not be common, but there may be folks who want to run
> the SSH tests and don't care about GPG.

OK.  I'll certainly forget, so hold on to the patch and resend after
the dust settles from the release.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereq
  2023-06-01  4:46     ` Junio C Hamano
@ 2023-06-06 21:47       ` Todd Zullinger
  0 siblings, 0 replies; 5+ messages in thread
From: Todd Zullinger @ 2023-06-06 21:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Fabian Stelzer

The GPGSSH_VERIFYTIME prequeq makes use of "${GNUPGHOME}" but does not
create it.  Require GPGSSH which creates the "${GNUPGHOME}" directory.

Additionally, it makes sense to require GPGSSH in GPGSSH_VERIFYTIME
because the latter builds on the former.  If we can't use GPGSSH,
there's little point in checking whether GPGSSH_VERIFYTIME is usable.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
Hi,

Junio C Hamano wrote:
>> Good idea. Perhaps:
>>
>>      test_lazy_prereq GPGSSH_VERIFYTIME '
>>              test_have_prereq GPGSSH &&
>>
>> is best there?  The GPGSSH prereq creates ${GNUPGHOME}.  It
>> may not be common, but there may be folks who want to run
>> the SSH tests and don't care about GPG.
> 
> OK.  I'll certainly forget, so hold on to the patch and resend after
> the dust settles from the release.

Alright.  Here's that patch.  Hopefully it's not too dusty
where you are.  If so, I can re-send later. :)

Cheers,

Todd

 t/lib-gpg.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 114785586a..db63aeb6ed 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -135,6 +135,7 @@ test_lazy_prereq GPGSSH '
 '
 
 test_lazy_prereq GPGSSH_VERIFYTIME '
+	test_have_prereq GPGSSH &&
 	# Check if ssh-keygen has a verify-time option by passing an invalid date to it
 	ssh-keygen -Overify-time=INVALID -Y check-novalidate -s doesnotmatter 2>&1 | grep -q -F "Invalid \"verify-time\"" &&
 
-- 
2.41.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-06 21:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  3:10 [PATCH] t/lib-gpg: fix ssh-keygen -Y check-novalidate with openssh-9.0 Todd Zullinger
2023-05-26  4:52 ` Junio C Hamano
2023-05-26  5:28   ` Todd Zullinger
2023-06-01  4:46     ` Junio C Hamano
2023-06-06 21:47       ` [PATCH] t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereq Todd Zullinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).