是否可以在 Tomcat 中执行 TLS 握手事件?

发布于 2024-07-08 23:07:54 字数 350 浏览 6 评论 0原文

我正在 tomcat 中运行一个启用了 TLS 的应用程序(Web 服务)(带有客户端和服务器的证书)。

我希望我的应用程序能够在 TLS 握手失败时发送审核消息(日志记录)。 例如,我想在以下情况下记录:

  • 客户端证书已过期、
  • 客户端证书未知(不在服务器信任存储中)
  • 任何其他握手失败

是否有任何我可以捕获和处理的事件来执行此操作?

我的应用程序基于 Web 服务,并在 tomcat 中运行。 Tomcat 正在处理所有网络和 TLS 层,而应用程序并不知道这一点。

由于我自己没有打开任何套接字,我应该在哪里捕获此异常?

I'm running an application (web service) in tomcat with TLS enabled (with certificates both for the client and the server).

I want that my application will be able to send audit message (logging) when TLS handshake fails. For example I want to log when:

  • the client certificate is expired,
  • the client certificate is unknown (not in the server trust store)
  • any other handshake failure

Is there any event that I can catch and handle in order to do that?

My application is web service based and is running in tomcat. Tomcat is handling all network and the TLS layers, and the application does not aware of that.

As I don't open any socket myself, where should I catch this Exception?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

━╋う一瞬間旳綻放 2024-07-15 23:07:54

我不知道您可以向 Tomcat 添加任何内容。

将 Apache HTTPD 放在前面并使用单独的、已配置的 SSL 日志。

I'm not aware of anything you can add to Tomcat.

Put an Apache HTTPD in front and use a separate, configured, SSL log.

梦冥 2024-07-15 23:07:54

由于我过去一周调试 Tomcat 的 SSL 配置,因此我非常确定在代码中捕获 javax.net.ssl.SSLHandshakeException 并记录它应该可以解决所有这三个错误。

当您在应用程序中实例化新的 Web 服务连接时,就会发生异常。

Since I spent the past week debugging Tomcat's SSL configuration, I am pretty sure catching javax.net.ssl.SSLHandshakeException in your code and logging it should take care of all three of those errors.

When you instantiate a new webservice connection in your application, that is when the exception will occur.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文