Jetty的ssl模块

2024-03-10 09:12
文章标签 模块 ssl jetty

本文主要是介绍Jetty的ssl模块,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

启用ssl模块,执行如下命令:

java -jar $JETTY_HOME/start.jar --add-modules=ssl

命令的输出,如下:

INFO  : ssl             initialized in ${jetty.base}/start.d/ssl.ini
INFO  : Base directory was modified

查看ssl模块的配置文件,执行如下命令:

cat $JETTY_BASE/start.d/ssl.ini

命令的输出,如下:


# ---------------------------------------
# Module: ssl
# Enables a TLS (SSL) connector to support secure protocols.
# Secure HTTP/1.1 is provided by enabling the "https" module and secure HTTP/2 is provided by enabling the "http2" module.
# ---------------------------------------
--modules=ssl### TLS (SSL) Connector Configuration## The host/address to bind the connector to.
# jetty.ssl.host=0.0.0.0## The port the connector listens on.
# jetty.ssl.port=8443## The connector idle timeout, in milliseconds.
# jetty.ssl.idleTimeout=30000## The number of acceptors (-1 picks a default value based on number of cores).
# jetty.ssl.acceptors=1## The number of selectors (-1 picks a default value based on number of cores).
# jetty.ssl.selectors=-1## The ServerSocketChannel accept queue backlog (0 picks the platform default).
# jetty.ssl.acceptQueueSize=0## The thread priority delta to give to acceptor threads.
# jetty.ssl.acceptorPriorityDelta=0## Whether to enable the SO_REUSEADDR socket option.
# jetty.ssl.reuseAddress=true## Whether to enable the SO_REUSEPORT socket option.
# jetty.ssl.reusePort=false## Whether to enable the TCP_NODELAY socket option on accepted sockets.
# jetty.ssl.acceptedTcpNoDelay=true## The SO_RCVBUF socket option to set on accepted sockets.
## A value of -1 indicates that the platform default is used.
# jetty.ssl.acceptedReceiveBufferSize=-1## The SO_SNDBUF socket option to set on accepted sockets.
## A value of -1 indicates that the platform default is used.
# jetty.ssl.acceptedSendBufferSize=-1## Whether client SNI data is required for all secure connections.
## When SNI is required, clients that do not send SNI data are rejected with an HTTP 400 response.
# jetty.ssl.sniRequired=false## Whether client SNI data is checked to match CN and SAN in server certificates.
## When SNI is checked, if the match fails the connection is rejected with an HTTP 400 response.
# jetty.ssl.sniHostCheck=true## The max age, in seconds, for the Strict-Transport-Security response header.
# jetty.ssl.stsMaxAgeSeconds=31536000## Whether to include the subdomain property in any Strict-Transport-Security header.
# jetty.ssl.stsIncludeSubdomains=true### SslContextFactory Configuration
## Note that OBF passwords are not secure, just protected from casual observation.## Whether client SNI data is required for all secure connections.
## When SNI is required, clients that do not send SNI data are rejected with a TLS handshake error.
# jetty.sslContext.sniRequired=false## The Endpoint Identification Algorithm.
## Same as javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String).
# jetty.sslContext.endpointIdentificationAlgorithm=## The JSSE Provider.
# jetty.sslContext.provider=## The KeyStore file path, either an absolute path or a relative path to $JETTY_BASE.
# jetty.sslContext.keyStorePath=etc/keystore.p12## The TrustStore file path, either an absolute path or a relative path to $JETTY_BASE.
# jetty.sslContext.trustStorePath=etc/keystore.p12## The KeyStore password.
# jetty.sslContext.keyStorePassword=## The Keystore type.
# jetty.sslContext.keyStoreType=PKCS12## The KeyStore provider.
# jetty.sslContext.keyStoreProvider=## The KeyManager password.
# jetty.sslContext.keyManagerPassword=## The TrustStore password.
# jetty.sslContext.trustStorePassword=## The TrustStore type.
# jetty.sslContext.trustStoreType=PKCS12## The TrustStore provider.
# jetty.sslContext.trustStoreProvider=## Whether client certificate authentication is required.
# jetty.sslContext.needClientAuth=false## Whether client certificate authentication is desired, but not required.
# jetty.sslContext.wantClientAuth=false## Whether cipher order is significant.
# jetty.sslContext.useCipherSuitesOrder=true## The SSLSession cache size.
# jetty.sslContext.sslSessionCacheSize=-1## The SSLSession cache timeout (in seconds).
# jetty.sslContext.sslSessionTimeout=-1## Whether TLS renegotiation is allowed.
# jetty.sslContext.renegotiationAllowed=true## The max number of TLS renegotiations per connection.
# jetty.sslContext.renegotiationLimit=5

各参数的说明,如下:

  • Connector对象的参数
    • jetty.ssl.host
      监听地址,默认值为0.0.0.0,表示在本机所有的IP均可接收请求。
    • jetty.ssl.port
      SSL服务的监听端口,默认值为8443
    • jetty.ssl.idleTimeout
      SSL链接处于空闲状态的超时值,超时后链接被自动释放,单位:毫秒,默认值为30000,即30秒。
    • jetty.ssl.acceptors
      accept对象的数量,默认值为1。取值为-1时,表示依据CPU核的数量来推算accept对象的数量。
    • jetty.ssl.selectors
      selector对象的数量,默认值为1。取值为-1时,表示依据CPU核的数量来推算selector对象的数量。
    • jetty.ssl.acceptQueueSize
      accept操作的backlog中请求的数量,默认值为0,表示使用操作系统的默认值。
    • jetty.ssl.acceptorPriorityDelta
      执行accept操作的线程的运行期优先级,默认值为0
      依据JDK中线程的文档,不同平台下线程运行优先级的实现存在比较大的差异,因此为保障代码的可移植性和正确性,业务逻辑的正确性不应对线程的优先级做出假设或者依赖。
    • jetty.ssl.reuseAddress
      对应socket选项SO_REUSEADDR,默认值为true
    • jetty.ssl.reusePort
      对应socket选项SO_REUSEPORT,默认值为false
    • jetty.ssl.acceptedTcpNoDelay
      对应socket选项TCP_NODELAY,默认值为true
    • jetty.ssl.acceptedReceiveBufferSize
      接收数据的缓冲区的大小,对应socket选项SO_RCVBUF,默认值为-1,表示使用操作系统的默认值。
    • jetty.ssl.acceptedSendBufferSize
      发送数据的缓冲区的大小,对应socket选项SO_SNDBUF,默认值为-1,表示使用操作系统的默认值。
    • jetty.ssl.sniRequired
      客户的SNI数据是否必需,默认值为false
    • jetty.ssl.sniHostCheck
      是否校验客户的SNI数据中的CNSAN
    • jetty.ssl.stsMaxAgeSeconds
      返回HTTP安全头部Strict Transport Security时,max-age字段的取值,单位:秒,默认值为31536000
      参考资料:
      • HTTP 安全响应头(Security Response header)配置
    • jetty.ssl.stsIncludeSubdomains
      返回HTTP安全头部Strict Transport Security时,是否包含includeSubDomains字段,默认值为true
      参考资料:
      • HTTP 安全响应头(Security Response header)配置
  • SslContextFactory对象的参数
    • jetty.sslContext.sniRequired
      所有安全链接中,客户的SNI数据是否必需,默认值为false
    • jetty.sslContext.endpointIdentificationAlgorithm
      javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)
    • jetty.sslContext.provider
    • jetty.sslContext.keyStorePath
      KeyStore文件的路径,支持使用相对于$JETTY_BASE的路径,也可以使用绝对路径。
    • jetty.sslContext.trustStorePath
      TrustStore文件的路径,支持使用相对于$JETTY_BASE的路径,也可以使用绝对路径。
    • jetty.sslContext.keyStorePassword
      KeyStore文件的口令。
    • jetty.sslContext.keyStoreType
      KeyStore文件的类型,默认值为PKCS12
    • jetty.sslContext.keyStoreProvider
    • jetty.sslContext.keyManagerPassword
      KeyManager的口令。
    • jetty.sslContext.trustStorePassword
      TrustStore文件的口令。
    • jetty.sslContext.trustStoreType
      TrustStore文件的类型,默认值为PKCS12
    • jetty.sslContext.trustStoreProvider
    • jetty.sslContext.needClientAuth
      是否需要执行客户端认证,默认值为false
    • jetty.sslContext.wantClientAuth
      是否期望执行客户端认证,默认值为false
    • jetty.sslContext.useCipherSuitesOrder
      是否验证加密顺序,默认值为true
    • jetty.sslContext.sslSessionCacheSize
      SSLSession缓存占用的容量,默认值为-1
    • jetty.sslContext.sslSessionTimeout
      SSLSession缓存的超时值,单位:秒,默认值为-1
    • jetty.sslContext.renegotiationAllowed
      是否允许尝试重复执行TLS协商,默认值为true
    • jetty.sslContext.renegotiationLimit
      单个通信链接,TLS协商次数的上限值,默认值为5

这篇关于Jetty的ssl模块的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/793760

相关文章

Python中模块graphviz使用入门

《Python中模块graphviz使用入门》graphviz是一个用于创建和操作图形的Python库,本文主要介绍了Python中模块graphviz使用入门,具有一定的参考价值,感兴趣的可以了解一... 目录1.安装2. 基本用法2.1 输出图像格式2.2 图像style设置2.3 属性2.4 子图和聚

Python的time模块一些常用功能(各种与时间相关的函数)

《Python的time模块一些常用功能(各种与时间相关的函数)》Python的time模块提供了各种与时间相关的函数,包括获取当前时间、处理时间间隔、执行时间测量等,:本文主要介绍Python的... 目录1. 获取当前时间2. 时间格式化3. 延时执行4. 时间戳运算5. 计算代码执行时间6. 转换为指

Python正则表达式语法及re模块中的常用函数详解

《Python正则表达式语法及re模块中的常用函数详解》这篇文章主要给大家介绍了关于Python正则表达式语法及re模块中常用函数的相关资料,正则表达式是一种强大的字符串处理工具,可以用于匹配、切分、... 目录概念、作用和步骤语法re模块中的常用函数总结 概念、作用和步骤概念: 本身也是一个字符串,其中

Python中的getopt模块用法小结

《Python中的getopt模块用法小结》getopt.getopt()函数是Python中用于解析命令行参数的标准库函数,该函数可以从命令行中提取选项和参数,并对它们进行处理,本文详细介绍了Pyt... 目录getopt模块介绍getopt.getopt函数的介绍getopt模块的常用用法getopt模

python logging模块详解及其日志定时清理方式

《pythonlogging模块详解及其日志定时清理方式》:本文主要介绍pythonlogging模块详解及其日志定时清理方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录python logging模块及日志定时清理1.创建logger对象2.logging.basicCo

Qt spdlog日志模块的使用详解

《Qtspdlog日志模块的使用详解》在Qt应用程序开发中,良好的日志系统至关重要,本文将介绍如何使用spdlog1.5.0创建满足以下要求的日志系统,感兴趣的朋友一起看看吧... 目录版本摘要例子logmanager.cpp文件main.cpp文件版本spdlog版本:1.5.0采用1.5.0版本主要

如何将Tomcat容器替换为Jetty容器

《如何将Tomcat容器替换为Jetty容器》:本文主要介绍如何将Tomcat容器替换为Jetty容器问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Tomcat容器替换为Jetty容器修改Maven依赖配置文件调整(可选)重新构建和运行总结Tomcat容器替

Python使用date模块进行日期处理的终极指南

《Python使用date模块进行日期处理的终极指南》在处理与时间相关的数据时,Python的date模块是开发者最趁手的工具之一,本文将用通俗的语言,结合真实案例,带您掌握date模块的六大核心功能... 目录引言一、date模块的核心功能1.1 日期表示1.2 日期计算1.3 日期比较二、六大常用方法详

python中time模块的常用方法及应用详解

《python中time模块的常用方法及应用详解》在Python开发中,时间处理是绕不开的刚需场景,从性能计时到定时任务,从日志记录到数据同步,时间模块始终是开发者最得力的工具之一,本文将通过真实案例... 目录一、时间基石:time.time()典型场景:程序性能分析进阶技巧:结合上下文管理器实现自动计时

Python如何获取域名的SSL证书信息和到期时间

《Python如何获取域名的SSL证书信息和到期时间》在当今互联网时代,SSL证书的重要性不言而喻,它不仅为用户提供了安全的连接,还能提高网站的搜索引擎排名,那我们怎么才能通过Python获取域名的S... 目录了解SSL证书的基本概念使用python库来抓取SSL证书信息安装必要的库编写获取SSL证书信息