如何保护 Infinispan 集群

How to secure Infinispan cluster

我正在尝试使用此处 JGroup 中所述的 SimpleToken 准备一个安全的 Infinispan 集群。虽然我提供了所需的配置,但新节点能够加入集群,即使它们具有不同的 'auth_value' 值。

这是我对第一个节点的配置:

<config xmlns="urn:org:jgroups"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.6.xsd">

    ....
    ....

    <AUTH auth_class="org.jgroups.auth.SimpleToken" auth_value="cluster1"/>
</config>

对于第二个节点,我使用相同的配置但不同 auth_value:

<AUTH auth_class="org.jgroups.auth.SimpleToken" auth_value="cluster2"/>

JGroup xml 文件中配置节点的顺序很重要。 Base one RedHat 支持团队 here

For Asymmetric encryption (A shared keystore is not required): 1) Configure the jgroups subsystem:

  1. ASYM_ENCRYPT should be configured immediately before NAKACK, and AUTH should be immediately before GMS.
  2. Note that the other protocols shown here for context will differ slightly depending on the JGroups version.

这意味着我的 JGroup 文件应该如下所示:

<AUTH auth_class="org.jgroups.auth.SimpleToken" auth_value="cluster1"/>
<pbcast.GMS print_local_addr="false"join_timeout="15000"/>

现在,当我启动具有 auth_value="cluster2" 的第二个节点时,我收到以下警告和错误:

节点 1:

[WARN] AUTH: failed to validate AuthHeader token from xxxx, token: auth_value=cluster1

节点 2:

原因:java.lang.SecurityException:身份验证失败 在 org.jgroups.protocols.pbcast.ClientGmsImpl.isJoinResponseValid(ClientGmsImpl.java:188) 在

请注意,最新版本的 ASYM_ENCRYPT 不再需要 AUTH;如果您使用基于证书的密钥交换,例如 SSL_KEY_EXCHANGE。详情请见 [1].

前面的回答是正确的:协议的顺序很重要。

[1] http://www.jgroups.org/manual4/index.html#Security