Skip to content

Unable to get certificate in TS_SSL_VERIFY_SERVER_HOOK #4569

@CrendKing

Description

@CrendKing

@shinrich Thanks for the recent commits about the TS_SSL_VERIFY_SERVER_HOOK. I tried to update our plugin to use the new hook. Unfortunately I found two problems of the current implementation. Could you please help verify?

  1. Both TS_SSL_VERIFY_SERVER_HOOK and TS_VCONN_OUTBOUND_START_HOOK can only be global hook, not transaction hook. The advantage of transaction hook is that it can be used per remap rule. Imagine we have 100 remaps, only 1 of them uses this plugin. Instead of being able to add hook during TSRemapDoRemap on-demand, now we have to call TSNetInvokingTxnGet and get related fields to see if the connction needs special TLS verification, most of the time.
    I understand the document says TLS hook runs before HTTP transaction, thus TLS hooks can't be transaction hook, but I believe that doc is out of date. According to this, TS_SSL_VERIFY_SERVER_HOOK happens just barely before TS_HTTP_SEND_REQUEST_HDR_HOOK. Is it possible to make relevant TLS hooks transaction hooks?

  2. Once inside the hook, we can only get the SSL * by calling TSVConnSSLConnectionGet (BTW, the documentation has wrong camel case typo). AFAIK, there is no way to server certificate X509 * from client side SSL *. All OpenSSL documentation and Google search suggest to use SSL_CTX_set_verify to get X509_STORE_CTX * in the callback. Unfortunately, the hook can't get either (ref). The test only used SSL_get_servername, whose information comes from the Hello message, not the server certificate. I could be wrong though.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions