前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >tomcat9配置集群EncryptInterceptor配置

tomcat9配置集群EncryptInterceptor配置

原创
作者头像
用户3293499
发布2024-11-18 09:54:10
发布2024-11-18 09:54:10
800
举报
文章被收录于专栏:运维运维

tomcat配置集群时,有个加密通信拦截器,如果不配置则会有高危漏洞,例如CVE-2022-29885。因此需要在集群配置中增加加密通信配置

代码语言:xml
复制
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                 channelSendOptions="8">
          <Manager className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"/>
          <Channel className="org.apache.catalina.tribes.group.GroupChannel">
            <Membership className="org.apache.catalina.tribes.membership.McastService"
                        address="228.0.0.4"
                        port="45564"
                        frequency="500"
                        dropTime="3000"/>
            <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                      address="auto"
                      port="4000"
                      autoBind="100"
                      selectorTimeout="5000"
                      maxThreads="6"/>

            <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
              <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
            </Sender>
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.EncryptInterceptor" encryptionKey="AE5BFD2541CB89421D72B0C0249E3C55"/>
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
          </Channel>

          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
                 filter=""/>
          <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

          <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                    tempDir="/tmp/war-temp/"
                    deployDir="/tmp/war-deploy/"
                    watchDir="/tmp/war-listen/"
                    watchEnabled="false"/>

          <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
        </Cluster>

其中 <Interceptor className="org.apache.catalina.tribes.group.interceptors.EncryptInterceptor" encryptionKey="AE5BFD2541CB89421D72B0C0249E3C55"/> 就是我们的加密通信配置

秘钥可以使用java代码生成

代码语言:java
复制
@Test
	void test3() throws NoSuchAlgorithmException {
		KeyGenerator gen = KeyGenerator.getInstance("AES");
		gen.init(128);
		SecretKey key = gen.generateKey();
		byte[] kb = key.getEncoded();
		System.out.println(Utils.bytesToHex(kb));
	}

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档