You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "maskit (via GitHub)" <gi...@apache.org> on 2024/08/27 16:59:22 UTC

[PR] Add TLSEventSupport [trafficserver]

maskit opened a new pull request, #11744:
URL: https://github.com/apache/trafficserver/pull/11744

   This is preparation to support [TLS User Agent Hooks](https://docs.trafficserver.apache.org/en/latest/developer-guide/plugins/hooks-and-transactions/ssl-hooks.en.html) on QUIC connections. The goal on this PR is, like other TLS*Support mix-ins, to remove dynamic_casts to SSLNetVC. Wiring for QUICNetVC will be made later on another PR.
   
   


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add TLSEventSupport [trafficserver]

Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit merged PR #11744:
URL: https://github.com/apache/trafficserver/pull/11744


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add TLSEventSupport [trafficserver]

Posted by "brbzull0 (via GitHub)" <gi...@apache.org>.
brbzull0 commented on code in PR #11744:
URL: https://github.com/apache/trafficserver/pull/11744#discussion_r1764810029


##########
src/iocore/net/SSLNetVConnection.cc:
##########
@@ -1581,28 +1465,18 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
       }
     }
 
-    sslHandshakeHookState = HANDSHAKE_HOOKS_OUTBOUND_PRE;
+    this->set_handshake_hook_state(TLSEventSupport::SSLHandshakeHookState::HANDSHAKE_HOOKS_OUTBOUND_PRE);
   }
 
   // Do outbound hook processing here
   // Continue on if we are in the invoked state.  The hook has not yet reenabled
-  if (sslHandshakeHookState == HANDSHAKE_HOOKS_OUTBOUND_PRE_INVOKE) {
+  if (this->is_invoked_state()) {

Review Comment:
   is it relevant in which particular `INVOKE` state it is?



-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add TLSEventSupport [trafficserver]

Posted by "brbzull0 (via GitHub)" <gi...@apache.org>.
brbzull0 commented on PR #11744:
URL: https://github.com/apache/trafficserver/pull/11744#issuecomment-2363287355

   [approve ci autest]


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add TLSEventSupport [trafficserver]

Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #11744:
URL: https://github.com/apache/trafficserver/pull/11744#discussion_r1767613829


##########
src/iocore/net/SSLNetVConnection.cc:
##########
@@ -1581,28 +1465,18 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
       }
     }
 
-    sslHandshakeHookState = HANDSHAKE_HOOKS_OUTBOUND_PRE;
+    this->set_handshake_hook_state(TLSEventSupport::SSLHandshakeHookState::HANDSHAKE_HOOKS_OUTBOUND_PRE);
   }
 
   // Do outbound hook processing here
   // Continue on if we are in the invoked state.  The hook has not yet reenabled
-  if (sslHandshakeHookState == HANDSHAKE_HOOKS_OUTBOUND_PRE_INVOKE) {
+  if (this->is_invoked_state()) {

Review Comment:
   No, not really in terms of the flow. Like the function name suggests, whether it's one of `INVOKE`s is the key.



-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add TLSEventSupport [trafficserver]

Posted by "brbzull0 (via GitHub)" <gi...@apache.org>.
brbzull0 commented on code in PR #11744:
URL: https://github.com/apache/trafficserver/pull/11744#discussion_r1764803111


##########
include/iocore/net/TLSEventSupport.h:
##########
@@ -0,0 +1,89 @@
+/** @file
+
+  TLSEventSupport implements common methods and members to
+  support TLS related events
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#pragma once
+
+#include "iocore/eventsystem/Lock.h"
+
+class Continuation;
+
+class TLSEventSupport
+{
+public:
+  enum class SSLHandshakeHookState {
+    HANDSHAKE_HOOKS_PRE,
+    HANDSHAKE_HOOKS_PRE_INVOKE,
+    HANDSHAKE_HOOKS_CLIENT_HELLO,
+    HANDSHAKE_HOOKS_CLIENT_HELLO_INVOKE,
+    HANDSHAKE_HOOKS_SNI,
+    HANDSHAKE_HOOKS_CERT,
+    HANDSHAKE_HOOKS_CERT_INVOKE,
+    HANDSHAKE_HOOKS_CLIENT_CERT,
+    HANDSHAKE_HOOKS_CLIENT_CERT_INVOKE,
+    HANDSHAKE_HOOKS_OUTBOUND_PRE,
+    HANDSHAKE_HOOKS_OUTBOUND_PRE_INVOKE,
+    HANDSHAKE_HOOKS_VERIFY_SERVER,
+    HANDSHAKE_HOOKS_DONE
+  };
+
+  static char const *get_ssl_handshake_hook_state_name(SSLHandshakeHookState state);
+
+  virtual ~TLSEventSupport() = default;
+
+  static void             initialize();
+  static TLSEventSupport *getInstance(SSL *ssl);
+  static void             bind(SSL *ssl, TLSEventSupport *es);
+  static void             unbind(SSL *ssl);
+
+  bool                    callHooks(TSEvent eventId);
+  bool                    calledHooks(TSEvent eventId) const;
+  virtual Continuation   *getContinuationForTLSEvents() = 0;
+  virtual EThread        *getThreadForTLSEvents()       = 0;
+  virtual Ptr<ProxyMutex> getMutexForTLSEvents()        = 0;
+  virtual void            reenable(int event)           = 0;
+
+protected:
+  void clear();
+
+  SSLHandshakeHookState get_handshake_hook_state();
+  void                  set_handshake_hook_state(SSLHandshakeHookState state);
+  bool                  is_invoked_state() const;
+  int                   invoke_tls_event();
+  void                  resume_tls_event();
+
+  virtual bool _is_tunneling_requested()   = 0;

Review Comment:
   I would make it `const`.



-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org