首页 文章

通缉:添加客户端节点加密的说明启用了Cassandra集群到DataStax OpsCenter 5.1.0

提问于
浏览
1

我有一个启用了客户端节点加密的Cassandra集群 . 我正在尝试将此群集添加到OpsCenter 5.1.0的实例,但它无法连接到群集 . 日志文件似乎抱怨无法验证SSL证书:

` 
INFO: Starting factory opscenterd.ThriftService.NoReconnectCassandraClientFactory instance at 0x7f2ce05c8638>
2015-06-10 15:09:46+0000 []  WARN: Unable to verify ssl certificate.
2015-06-10 15:09:46+0000 [] Unhandled Error
        Traceback (most recent call last):
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/python/log.py", line 84, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/python/log.py", line 69, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/python/context.py", line 59, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/python/context.py", line 37, in callWithContext
            return func(*args,**kw)
        --- exception caught here ---
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/internet/epollreactor.py", line 217, in _doReadOrWrite
            why = selectable.doRead()
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/internet/tcp.py", line 137, in doRead
            return Connection.doRead(self)
          File "/opt/opscenter-5.1.0/lib/py-debian/2.7/amd64/twisted/internet/tcp.py", line 452, in doRead
            data = self.socket.recv(self.bufferSize)
          File "build/lib/python2.7/site-packages/opscenterd/SslUtils.py", line 12, in ssl_simple_verifyCB 

    opscenterd.Utils.SSLVerifyException: SSL certificate invalid

My question is: what are the step-by-step instructions for being able to add a client-node encrypted cluster to opscenter? Which .pem and .keystore files are needed exactly, how do I get hold of them?

关于该主题的DataStax文档不够详细,因此不太有用 . 我假设那里的一些人必须设法成功地设置它,我相信许多人会赞赏详细的解释/说明 .

1 回答

  • 5

    有一点需要注意,尽管文档确实提到了为每个节点生成密钥,但实际上这并不是很容易扩展 . 在大多数系统中,通常使用所需的密钥和证书创建一个密钥库,然后根据需要在群集中的所有节点和客户端应用程序中使用它 . 您从此密钥库导出证书并将其用于OpsCenter . 对于任何其他客户端,OpsCenter(就SSL而言)是一个SSL客户端 .

    因此,您必须从Java密钥库导出密钥,将其转换为.pem格式并将其用于opscenterd进程 . 代理是基于Java的,因此可以使用java密钥库 . DS文档在那里,但它有点碎片所以它是一个寻找正确的地方的问题:-)

    我将在这里使用OpsCenter最新文档作为参考 . 我假设您只在OpsCenter和Cassandra以及OpsCenter代理和Cassandra之间使用SSL

    准备服务器证书:

    https://docs.datastax.com/en/cassandra/2.1/cassandra/security/secureSSLCertificates_t.html

    配置客户端到节点SSL:

    https://docs.datastax.com/en/cassandra/2.1/cassandra/security/secureSSLClientToNode_t.html

    使用带SSL的cqlsh(可选):

    https://docs.datastax.com/en/cassandra/2.1/cassandra/security/secureCqlshSSL_t.html

    要将密钥转换为pem格式,请参阅此处的步骤7:

    https://docs.datastax.com/en/latest-opsc/opsc/online_help/opscAddingCluster_t.html

    Examples

    请注意,所有这些示例均假设为单向SSL . 您在名为 /etc/dse/keystore 的文件中生成了一个密钥,并在名为 /etc/dse/truststore 的文件中生成了该证书

    说实话,我在OpsCenter UI中直接添加启用了SSL的集群并没有太多运气 . 我总是发现手工创建cluster.conf文件和代理address.yaml文件更快更容易 .

    请注意,像truststore,key.pem等SSL文件需要位于需要它们的所有本地计算机上 .

    示例代理 /var/lib/datastax-agent/conf/address.yaml 文件(注意 use_ssl 用于我们未在此处使用的opscenter <>代理SSL)

    stomp_interface: 192.168.56.29
    use_ssl: 0
    # ssl_keystore settings if using ssl
    ssl_keystore: /etc/dse/truststore
    ssl_keystore_password: datastax
    

    示例opscenter /etc/opscenter/clusters/<cluster_name>.conf 文件

    [jmx]
    username = 
    password = 
    port = 7199
    
    [kerberos_client_principals]
    
    [kerberos]
    
    [agents]
    ssl_keystore = /etc/dse/truststore
    ssl_keystore_password = datastax
    
    [kerberos_hostnames]
    
    [kerberos_services]
    
    [cassandra]
    ssl_ca_certs = /etc/dse/key.pem
    ssl_validate = False
    seed_hosts = 192.168.56.22
    

    Other tips etc

    我总是发现我是否在DSE / Cassandra中对SSL连接进行故障排除 . 我将首先删除所有SSL并使集群正常工作,然后我将一步一步配置SSL,例如打开节点到节点SSL,然后是客户端到节点,然后是OpsCenter等等 . 调试所有SSL错误不适合虚假的心!

    Links

    您可能会觉得有用的其他文档链接:

    https://docs.datastax.com/en/opscenter/5.2/opsc/configure/opscConnectionConfig_r.html

    https://docs.datastax.com/en/opscenter/5.2/opsc/configure/agentAddressConfiguration.html

相关问题