Skip to content

Update documentation for SSL VERIFY hooks.#4385

Merged
shinrich merged 1 commit intoapache:masterfrom
shinrich:update-verify-hook-documentation
Oct 19, 2018
Merged

Update documentation for SSL VERIFY hooks.#4385
shinrich merged 1 commit intoapache:masterfrom
shinrich:update-verify-hook-documentation

Conversation

@shinrich
Copy link
Copy Markdown
Member

No description provided.

@shinrich shinrich added this to the 9.0.0 milestone Oct 10, 2018
@shinrich shinrich self-assigned this Oct 10, 2018
@zwoop
Copy link
Copy Markdown
Contributor

zwoop commented Oct 12, 2018

Hmmm, is this documentation for a yet to be landed hook? If so, why not merge this in with that commit?

@zwoop
Copy link
Copy Markdown
Contributor

zwoop commented Oct 12, 2018

Also, not that it matters much, but I think we (for some reason :-), try to keep documentation lines < 80 characters.

@shinrich
Copy link
Copy Markdown
Member Author

shinrich commented Oct 12, 2018

Both hooks already exist in the code. Just wasn't documented yet. Hmm. But looking more closely, it looks like the SERVER version of the name is a bit different. Back in again to tidy up.

@shinrich shinrich force-pushed the update-verify-hook-documentation branch from 342a93b to c17e893 Compare October 12, 2018 14:18
@shinrich
Copy link
Copy Markdown
Member Author

I updated the docs and the constants to be consistent. Both hooks already existing, but one was TS_SSL_VERIFY_CLIENT_HOOK and the other was TS_SSL_SERVER_VERIFY_HOOK. I changed them both to the TS_SSL_VERIFY_* form. Updated the enums, but left aliases of the old versions for backwards compatibility.

Will be adding tests in a separate PR.

TS_SSL_VERIFY_SERVER_HOOK
-------------------------

This hooks is called when a client connects to Traffic Server and presents a
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This comment does not sound correct. It seems to be copied verbatim from the TS_SSL_VERIFY_CLIENT_HOOK section.

TS_SSL_VERIFY_CLIENT_HOOK
-------------------------

This hooks is called when a client connects to Traffic Server and presents a
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

s/hooks/hook/

@shinrich shinrich force-pushed the update-verify-hook-documentation branch from c17e893 to 9c909bb Compare October 16, 2018 13:24
@shinrich
Copy link
Copy Markdown
Member Author

Updated to address @CrendKing's review comments.

TS_SSL_VERIFY_SERVER_HOOK
-------------------------

This hooks is called when a Traffic Server connections to an origin and the origin
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

s/connections/connects/

@shinrich shinrich force-pushed the update-verify-hook-documentation branch from 9c909bb to a7a1b57 Compare October 17, 2018 13:51
@shinrich
Copy link
Copy Markdown
Member Author

Updated to address @CrendKing's comment.

@shinrich
Copy link
Copy Markdown
Member Author

@CrendKing @zwoop Any other comments or are we good to go?

@shinrich shinrich merged commit 458bb1f into apache:master Oct 19, 2018
presents a certificate. The callback can get the SSL object from the TSVConn
argument and use that to access the origin certificate and make any additional checks.

Processing will continue regardless of whether the hook callback executes
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correct me if I'm wrong. #4427 adds the possibility to "interrupt" the workflow by calling TSVConnReenableEx() with TS_EVENT_ERROR. Seems contradictory once both PRs are committed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct. The underlying openssl structure limits what we can do. However, in the case of the verify_server hook, we cannot leave the callback not-enabled. But we can return an ERROR and have the core ATS verify_callback interpret that to fail the certificate verification.

Copy link
Copy Markdown

@CrendKing CrendKing Oct 19, 2018

Choose a reason for hiding this comment

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

The underlying openssl structure limits what we can do

Just to make sure we are on the side page. We agree that if the callback function from SSL_set_verify() returns 0, the OpenSSL will stop the TLS handshake, right? So what do you mean here?

https://www.openssl.org/docs/man1.0.2/ssl/SSL_set_verify.html

The return value of verify_callback controls the strategy of the further verification process. If verify_callback returns 0, the verification process is immediately stopped with "verification failed" state.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct. The verify_callback() function is registered by Traffic Server via the SSL_CTX_set_verify or SSL_set_verify openssl function. It will eventually return either 0 or 1. If it returns 0, the handshake will fail . It it returns 1, the handshake will continue on.

The VERIFY_SERVER_HOOK gives a place for plugins to insert logic and influence the return value of the verify_callback(). If the hook reenables with a TS_EVENT_ERROR, the verify_callback() will return 0.

@bryancall bryancall removed this from the 9.0.0 milestone Apr 11, 2019
@bryancall
Copy link
Copy Markdown
Contributor

Because of conflicts a new PR was created to merge into 8.1.0: #5236

@zwoop zwoop modified the milestones: 9.0.0, Backported Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants