maskit commented on issue #13985:
URL: 
https://github.com/apache/trafficserver/issues/13985#issuecomment-6985807279

   @Maaz2212 I'd prefer neither option as proposed.
   
   Why not option 1 (pass the `X509_STORE_CTX`):
   
   - Before RPK, a non-null context in this hook always carried a certificate, 
so plugins have no reason to check `X509_STORE_CTX_get_current_cert()` for 
NULL. With an RPK context it returns NULL, and a plugin that passes that to 
`X509_get_subject_name()` or similar would crash `traffic_server`.
   - BoringSSL has no store context on the RPK path, so plugins would need 
library-specific code.
   
   Why not option 2 (`TSVConnSslVerifyRPKGet`):
   
   It adds a second getter that is only valid while the hook is running. That's 
the pattern I want to move away from. These comments already describe passing 
the data to verify along with the event, so `TSVConnSslVerifyCTXGet` and its 
internal state can eventually go away:
   
   
https://github.com/apache/trafficserver/blob/9e15eaf4a24be987663226cf442c5fbdac6b92ff/include/iocore/net/TLSBasicSupport.h#L64-L70
   
https://github.com/apache/trafficserver/blob/9e15eaf4a24be987663226cf442c5fbdac6b92ff/src/iocore/net/SSLNetVConnection.cc#L2333-L2337
   
   
   Since RPK is only in 11.x, I'd make a bigger change.
   
   - Make `TS_SSL_VERIFY_CLIENT_HOOK` and `TS_SSL_VERIFY_SERVER_HOOK` 
X.509-only: don't invoke them when the peer authenticates with a raw public 
key. Today they are invoked with a null context for RPK, which crashes plugins 
written before RPK that don't check `TSVConnSslVerifyCTXGet()` for NULL. This 
should be a separate PR, and it needs to land before 11.0 is released.
   - Add a new pair of verify hooks, one per direction, invoked for both X.509 
certificates and raw public keys. Instead of the vconn, their `edata` is an 
opaque handle with accessors for:
     - the vconn (also needed for `TSVConnReenable`)
     - the `X509_STORE_CTX`, null for RPK
     - the peer public key, null for X.509
     - the library's verification result before the hook runs
   - Once the new hooks are in, deprecate `TS_SSL_VERIFY_CLIENT_HOOK`, 
`TS_SSL_VERIFY_SERVER_HOOK`, and `TSVConnSslVerifyCTXGet`, so plugins move to 
the new hooks.
   
   This is a rough direction rather than a final design, and I may have missed 
something. I'd appreciate it if you could take it from here and work out the 
full design you think is best, including changing anything above that doesn't 
hold up.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to