Skip to content

Refactor verification options#10132

Closed
richsalz wants to merge 5 commits intoopenssl:masterfrom
richsalz:refactor-doc-flags-5
Closed

Refactor verification options#10132
richsalz wants to merge 5 commits intoopenssl:masterfrom
richsalz:refactor-doc-flags-5

Conversation

@richsalz
Copy link
Copy Markdown
Contributor

@richsalz richsalz commented Oct 9, 2019

This refactors all verification options to common documentation in openssl.pod
I also rewrote the prose text about how verification works.

I'd like #10118 to get reviewed and merged first because the options that control the trust chain (no-cafile, etc) affect this and I can add the necessary L<> link.

@richsalz richsalz changed the title Refactor doc flags 5 Refactor verification options Oct 10, 2019
@richsalz
Copy link
Copy Markdown
Contributor Author

I did some editing on the verification options in openssl.pod, and I tried to put them into a more sensible ordering. Once this is reviewed and merged, I will change OPT_V_OPTIONS
in include/opt.h to match the ordering.

@richsalz
Copy link
Copy Markdown
Contributor Author

This is now based on #10159 and needs that to go in first.

@richsalz
Copy link
Copy Markdown
Contributor Author

Rebased since #10159 was merged.

@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Nov 1, 2019

re-pushing to restart hung CI jobs.

@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Nov 4, 2019

rebased and fixed conflicts.

Copy link
Copy Markdown

@vdukhovni vdukhovni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, a few nits.

Comment thread doc/man1/openssl-s_client.pod.in Outdated
Comment thread doc/man1/openssl-verify.pod.in Outdated
Comment thread doc/man1/openssl.pod Outdated
Comment thread doc/man1/openssl.pod Outdated
Comment thread doc/man1/openssl.pod Outdated
Comment thread doc/man1/openssl.pod Outdated
@richsalz
Copy link
Copy Markdown
Contributor Author

Thanks for reading this, @vdukhovni I appreciate it. Fixup commit pushed.

@richsalz
Copy link
Copy Markdown
Contributor Author

I had to rebase because of a conflict. I fixed various failure descriptions and moved the verification error description all to the man3 file. That file now has the define name and the text. Should the text, which is basically a repetition of the text description, be removed? I think so.

@richsalz
Copy link
Copy Markdown
Contributor Author

Travis failure is a timeout.

@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Dec 29, 2019

I restarted the job.

Copy link
Copy Markdown

@vdukhovni vdukhovni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty close now.

Comment thread doc/man1/openssl-cms.pod.in Outdated
Comment thread doc/man1/openssl-s_client.pod.in Outdated
Comment thread doc/man1/openssl-s_server.pod.in Outdated
Comment thread doc/man1/openssl-smime.pod.in Outdated
Comment thread doc/man1/openssl-ts.pod.in Outdated
Comment thread doc/man1/openssl-verify.pod.in Outdated
vdukhovni
vdukhovni previously approved these changes Dec 30, 2019
Copy link
Copy Markdown

@vdukhovni vdukhovni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, close enough.

@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Jan 3, 2020

Ping for a second review. Should be easy, it made it past one of the harder reviewers already :) And #10587 is kinda waiting on this.

Comment thread crypto/x509/x509_txt.c Outdated
Comment thread doc/man1/openssl-smime.pod.in Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I find it hard to verify that no option got lost on the way. Any hints how to achieve this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess look at the "opt_v_synopsis" variable in one window, and compare it against the "-" lines in another?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It occurred to me that I could also compare the generated files. But I didn't find the time to do it yet.

@mspncp mspncp added approval: review pending This pull request needs review by a committer branch: master Applies to master branch labels Jan 4, 2020
@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Jan 6, 2020

There were conflicts, so I did a squash/rebase. The conflicts were simple, but this probably needs another review from @vdukhovni (as well as a committer).

@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Jan 6, 2020

I generated the pod files using 8062c027e9cdef644f1e63b210384e760c65a354 and its parent, see attached comparison.zip. For better comparison I sorted the options in the SYNOPSIS section.

The diff shows some duplicates (-CAfile, -CApath, -certfile) and some options which have disappeared (-no_check_time) or appeared (-verbose). I think the duplicates need to be removed and the other changes need a closer look and/or an explanation why they were changed.

See for example openssl-cms.pod:

msp@msppc:~/src/openssl$ diff before/openssl-cms.pod after/openssl-cms.pod
--- before/openssl-cms.pod	2020-01-06 16:25:32.978669176 +0100
+++ after/openssl-cms.pod	2020-01-06 16:26:16.407071393 +0100
@@ -15,6 +15,8 @@
 
 B<openssl> B<cms>
 [B<-CAfile> I<file>]
+[B<-CAfile> I<file>]
+[B<-CApath> I<dir>]
 [B<-CApath> I<dir>]
 [B<-CAstore> I<uri>]
 [B<-EncryptedData_encrypt>]
@@ -25,6 +27,7 @@
 [B<-binary>]
 [B<-cades>]
 [B<-certfile> I<file>]
+[B<-certfile> I<file>]
 [B<-certsout> I<file>]
 [B<-check_ss_sig>]
 [B<-cmsout>]
@@ -56,10 +59,11 @@
 [B<-keyopt> I<name>:I<parameter>]
 [B<-md> I<digest>]
 [B<-no-CAfile>]
+[B<-no-CAfile>]
+[B<-no-CApath>]
 [B<-no-CApath>]
 [B<-no-CAstore>]
 [B<-no_alt_chains>]
-[B<-no_check_time>]
 [B<-noattr>]
 [B<-nocerts>]
 [B<-nodetach>]
@@ -102,6 +106,7 @@
 [B<-trusted_first>]
 [B<-uncompress>]
 [B<-use_deltas>]
+[B<-verbose>]
 [B<-verify>]
 [B<-verify_depth> I<num>]
 [B<-verify_email> I<email>]
@@ -476,14 +481,16 @@
 
 =item B<-attime>, B<-check_ss_sig>, B<-crl_check>, B<-crl_check_all>,
 B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>, B<-inhibit_any>,
-B<-inhibit_map>, B<-no_alt_chains>, B<-no_check_time>, B<-partial_chain>, B<-policy>,
+B<-inhibit_map>, B<-no_alt_chains>, B<-partial_chain>, B<-policy>,
 B<-policy_check>, B<-policy_print>, B<-purpose>, B<-suiteB_128>,
 B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>,
 B<-auth_level>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
 B<-verify_ip>, B<-verify_name>, B<-x509_strict>
 
-Set various certificate chain validation options. See the
-L<openssl-verify(1)> manual page for details.
+Set various options of certificate chain verification.
+See L<openssl(1)/Verification Options> for details.
+
+Any verification errors cause the command to exit.
 
 =item B<-CAfile> I<file>, B<-no-CAfile>, B<-CApath> I<dir>, B<-no-CApath>,
 B<-CAstore> I<uri>, B<-no-CAstore>

Note: I did not go through all the diffs yet.

@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Jan 6, 2020

The duplicates (CApath,no-CApath,CAfile,no-CAfile,certfile) where rebase mistakes that slipped through; fixup commit pushed. The no_check_time isn't implemented so I removed it. As you go through the review, I'll fix each one in turn. Thanks!

@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Jan 6, 2020

The no_check_time isn't implemented so I removed it.

Are you sure it's not implemented?

$ git grep -in no_check_time apps
apps/include/opt.h:30: OPT_V_PARTIAL_CHAIN, OPT_V_NO_ALT_CHAINS, OPT_V_NO_CHECK_TIME,
apps/include/opt.h:82: { "no_check_time", OPT_V_NO_CHECK_TIME, '-', "ignore certificate validity time" },
apps/include/opt.h:115: case OPT_V_NO_CHECK_TIME:
apps/lib/opt.c:608: case OPT_V_NO_CHECK_TIME:
apps/lib/opt.c:609: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_CHECK_TIME);

@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Jan 6, 2020

Thanks @mspncp you're right. Lucky a simple fix in only one file fixes it everywhere :)

@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Jan 6, 2020

-no_check_time

Did you restore -no_check_time already?

More duplicates

I see more duplicates of the following options:

-CAfile, -CApath, -no-CAfile, -no-CApath

I'm sure you'll find them all using grep ;-)

Verbosity

The -verbose option was somehow 'inverted': it is now documented where it previously wasn't and vice versa.

msp@msppc:~/src/openssl$ grep -- -verbose before/*
before/openssl-verify.pod:[B<-verbose>]
before/openssl-verify.pod:=item B<-verbose>

msp@msppc:~/src/openssl$ grep -- -verbose after/*
after/openssl-cms.pod:[B<-verbose>]
after/openssl-ocsp.pod:[B<-verbose>]
after/openssl-s_client.pod:[B<-verbose>]
after/openssl-s_server.pod:[B<-verbose>]
after/openssl-smime.pod:[B<-verbose>]
after/openssl-ts.pod:[B<-verbose>]

According to my quick test, none of the latter commands supports this flag:

msp@msppc:~/src/openssl$ for cmd in cms ocsp s_client smime ts; do openssl $cmd -verbose ; done

cms: Unrecognized flag verbose
ocsp: Unrecognized flag verbose
ocsp: Use -help for summary.
s_client: Option unknown option -verbose
s_client: Use -help for summary.
smime: Unrecognized flag verbose
smime: Use -help for summary.
ts: Unrecognized flag verbose
ts: Use -help for summary.

@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Jan 6, 2020

Apropos: the missing-flag error messages are also very higgledy-piggledy:

cms: Unrecognized flag verbose
ocsp: Unrecognized flag verbose
ocsp: Use -help for summary.
s_client: Option unknown option -verbose
s_client: Use -help for summary.
smime: Unrecognized flag verbose
smime: Use -help for summary.
ts: Unrecognized flag verbose
ts: Use -help for summary.

@richsalz
Copy link
Copy Markdown
Contributor Author

richsalz commented Jan 7, 2020

Could you open a separate issue for #10132 (comment) ? Thanks.

@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Jan 7, 2020

Could you open a separate issue for #10132 (comment) ? Thanks.

Done, see #10773.

@mspncp mspncp requested a review from vdukhovni January 18, 2020 08:26
@richsalz
Copy link
Copy Markdown
Contributor Author

@vdukhovni any chance you'll be able to take another (quick) look, or should I try to find someone else?

@richsalz
Copy link
Copy Markdown
Contributor Author

Rebased to address .gitignore conflict. Also squashed most fixup commits. Still needs review.

Comment thread doc/man1/openssl-s_server.pod.in Outdated
Comment thread doc/man1/openssl.pod Outdated
Comment thread doc/man1/openssl.pod Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be better smth like

If an issuer certificate is a certificate itself, the certificate is assumed to be the root CA.

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a slightly different wording, let me know what you think.

Comment thread doc/man1/openssl.pod Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not always the current - at least can be overwritten by the -attime option.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a sentence about -attime

Copy link
Copy Markdown
Member

@beldmit beldmit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@beldmit beldmit added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Jan 22, 2020
Comment thread doc/man1/openssl-s_server.pod.in Outdated
Comment thread doc/man1/openssl.pod Outdated
Comment thread doc/man1/openssl.pod Outdated
@vdukhovni
Copy link
Copy Markdown

@vdukhovni any chance you'll be able to take another (quick) look, or should I try to find someone else?

Cycles a bit scarce lately, I hope someone else will take you across the finish line. At least I got the ball rolling. Thanks for hanging in to the bitter end!

Copy link
Copy Markdown
Contributor

@mspncp mspncp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconfirmed. No need to reset the grace period timer for this trivial typo fix.

@mattcaswell
Copy link
Copy Markdown
Member

Travis red cross not relevant. See #10932

Move the x509_V_ERR_xxx definitions from openssl-verify to
X509_STORE_CTX_get_error.pod.  Add some missing ones.  Consistently
start with a lowercase letter, unless it's an acronym.

Fix some markup mistakes in X509_verify_cert.
@richsalz
Copy link
Copy Markdown
Contributor Author

Rebased to pick up the fix in #10932; no other changes made.

@mspncp mspncp self-assigned this Jan 23, 2020
@mspncp mspncp added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Jan 23, 2020
openssl-machine pushed a commit that referenced this pull request Jan 23, 2020
Move the x509_V_ERR_xxx definitions from openssl-verify to
X509_STORE_CTX_get_error.pod.  Add some missing ones.  Consistently
start with a lowercase letter, unless it's an acronym.

Fix some markup mistakes in X509_verify_cert.

Reviewed-by: Dmitry Belyavskiy <[email protected]>
Reviewed-by: Matthias St. Pierre <[email protected]>
(Merged from #10132)
@mspncp
Copy link
Copy Markdown
Contributor

mspncp commented Jan 23, 2020

Merged to master in 21d08b9, thanks for your patience :-)

@mspncp mspncp closed this Jan 23, 2020
@richsalz richsalz deleted the refactor-doc-flags-5 branch January 23, 2020 22:56
@richsalz
Copy link
Copy Markdown
Contributor Author

Thanks for the grammar correction, folks. Sheesh. 3:1 you were right and i was wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants