【问题标题】:Not able to connect the ssl node throgh cqlsh无法通过 cqlsh 连接 ssl 节点
【发布时间】:2018-05-18 15:09:42
【问题描述】:

在解释我面临的问题之前,我会告诉你我本地机器上的验证点。

  • 我拥有所有与 Cassandra 相关的配置,并且我拥有我的机器所需的权限(访问)。
  • 我可以通过 cqlsh 连接禁用 SSL 的 Cassandra 节点或禁用 TLS 的节点>.

    • 例如,我可以使用以下命令连接到以下 C* 节点
    • cqlsh -u xxxxx -p xxxxxx 123.abc.com
    • 但同时我无法使用选项 SSL 连接到以下节点
    • cqlsh --ssl -u xxxxx -p xxxxxx 123.xyz.com
  • 以下是我的 cqlshrc 文件内容:

    [Authentication] Usename = xxxx password = xxxx [connection] hostname = 123.xyz.com port = 9042 factory = cqlshlib.ssl.ssl_transport_factory [ssl] certfile=~/certfiles/xyz.pem validate = false

  • 即使我尝试将 certFile 路径设置为环境变量。

我收到以下异常:

启用验证; SSL 传输工厂需要指定有效的证书文件。请在 /XXXX/XXXXX/.cassandra/cqlshrc(或使用 [certfiles] 部分)中将 [ssl] 部分中的证书文件路径作为“certfile”选项提供,或设置 SSL_CERTFILE 环境变量。

【问题讨论】:

标签: ssl cassandra cqlsh


【解决方案1】:

我猜你的路径可能是有效的,但你的证书文件可能不是。以下是一些快速步骤,可从您的节点之一的密钥库生成有效的证书文件:

1 - 检查您的 cassandra.yaml 中的密钥库位置和密码:

client_encryption_options:
  enabled: true
  keystore: /etc/cassandra/.keystore
  keystore_password: flynnLives

2 - 将您的密钥库转换为 PKCS12 密钥库:

$ keytool -importkeystore -srckeystore /etc/cassandra/.keystore 
    -destkeystore ~/.cassandra/p12.keystore -deststoretype PKCS12 
    -srcstorepass flynnLives -deststorepass flynnLives

3 - 从 PKCS12 密钥库生成证书文件:

$ openssl pkcs12 -in ~/.cassandra/p12.keystore -nokeys -out ~/.cassandra/xyz.pem
    -passin pass:flynnLives

4 - 在您的 cqlshrc 中指定连接和 ssl 部分,以及默认传输工厂和证书名称。除非您使用双向 SSL,否则请将 validate 设置为 false。

[connection]
factory = cqlshlib.ssl.ssl_transport_factory

[ssl]
certfile = ~/.cassandra/xyz.pem
validate = false

5 - 通过 cqlsh 连接:

$ bin/cqlsh 192.168.0.100 -u flynn -p reindeerFlotilla --ssl
Connected to MasterControl at 192.168.0.100:9042.
[cqlsh 5.0.1 | Cassandra 2.2.5 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
flynn@cqlsh>

【讨论】:

    猜你喜欢
    • 2015-02-05
    • 2018-08-12
    • 2014-12-18
    • 2023-01-17
    • 2016-01-25
    • 2018-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多