1.4. 启用和保护 Ceph API 模块

Red Hat Ceph Storage Dashboard 模块通过 SSL 保护的连接提供存储集群的 RESTful API 访问。

重要

如果禁用 SSL,则用户名和密码会以未加密的形式发送到 Red Hat Ceph Storage 仪表板。

先决条件

  • Ceph 监控节点的根级别访问权限.
  • 确保至少有一个 ceph-mgr 守护进程处于活跃状态。
  • 如果您使用防火墙,请确保在带有活跃 ceph-mgr 守护进程的节点上打开 TCP 端口 8443 (对于 SSL)和 TCP 端口 8080。

流程

  1. 登录到 Cephadm shell:

    示例

    root@host01 ~]# cephadm shell

  2. 启用 RESTful 插件:

    [ceph: root@host01 /]# ceph mgr module enable dashboard
  3. 配置 SSL 证书。

    1. 如果机构的证书颁发机构(CA)提供证书,则使用证书文件设置:

      语法

      ceph dashboard set-ssl-certificate HOST_NAME -i CERT_FILE
      ceph dashboard set-ssl-certificate-key HOST_NAME -i KEY_FILE

      示例

      [ceph: root@host01 /]# ceph dashboard set-ssl-certificate -i dashboard.crt
      [ceph: root@host01 /]# ceph dashboard set-ssl-certificate-key -i dashboard.key

      如果要设置基于节点的唯一证书,请向命令中添加 HOST_NAME

      示例

      [ceph: root@host01 /]# ceph dashboard set-ssl-certificate host01 -i dashboard.crt
      [ceph: root@host01 /]# ceph dashboard set-ssl-certificate-key host01 -i dashboard.key

    2. 或者,您可以生成自签名证书。但是,使用自签名证书无法提供 HTTPS 协议的完整安全优势:

      [ceph: root@host01 /]# ceph dashboard create-self-signed-cert
      警告

      大部分现代 Web 浏览器将提示自签名证书,这需要您在建立安全连接之前进行确认。

  4. 创建用户,设置密码并设置角色:

    语法

    echo -n "PASSWORD" > PATH_TO_FILE/PASSWORD_FILE
    ceph dashboard ac-user-create USER_NAME -i PASSWORD_FILE ROLE

    示例

    [ceph: root@host01 /]# echo -n "p@ssw0rd" > /root/dash-password.txt
    [ceph: root@host01 /]# ceph dashboard ac-user-create user1 -i /root/dash-password.txt administrator

    这个示例创建一个名为 user1 的用户,该用户具有 administrator 角色。

  5. 连接到 RESTful 插件网页。打开 Web 浏览器,并输入以下 URL:

    语法

    https://HOST_NAME:8443

    示例

    https://host01:8443

    如果您使用自签名证书,请确认安全例外。

其它资源

  • ceph dashboard --help 命令。
  • https://HOST_NAME:8443/doc 页面,其中 HOST_NAME 是运行 ceph-mgr 实例的节点的 IP 地址或名称。
  • Red Hat Enterprise Linux 8 安全强化指南。