6.4. 配置服务器端加密

如果可能无法通过 SSL 发送加密的请求,设置服务器端加密,以使用 HTTP 向 Ceph 对象网关发送请求。

此流程使用 HAProxy 作为代理和负载均衡器。

先决条件

  • 对存储集群中所有节点的根级别访问权限。
  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 安装 Ceph 对象网关软件.
  • 安装 HAProxy 软件.

流程

  1. 编辑 haproxy.cfg 文件:

    示例

    frontend http_web *:80
        mode http
        default_backend rgw
    
    frontend rgw­-https
      bind *:443 ssl crt /etc/ssl/private/example.com.pem
      default_backend rgw
    
    backend rgw
        balance roundrobin
        mode http
        server  rgw1 10.0.0.71:8080 check
        server  rgw2 10.0.0.80:8080 check

  2. 注释掉允许访问 http 前端的行,并添加指令来指示 HAProxy 使用 https 前端:

    示例

    #     frontend http_web *:80
    #     mode http
    #     default_backend rgw
    
    frontend rgw­-https
      bind *:443 ssl crt /etc/ssl/private/example.com.pem
      http-request set-header X-Forwarded-Proto https if { ssl_fc }
      http-request set-header X-Forwarded-Proto https
    # here we set the incoming HTTPS port on the load balancer (eg : 443)
      http-request set-header X-Forwarded-Port 443
      default_backend rgw
    
    backend rgw
        balance roundrobin
        mode http
        server  rgw1 10.0.0.71:8080 check
        server  rgw2 10.0.0.80:8080 check

  3. rgw_trust_forwarded_https 选项设置为 true

    示例

    [ceph: root@host01 /]# ceph config set client.rgw rgw_trust_forwarded_https true

  4. 启用并启动 HAProxy:

    [root@host01 ~]# systemctl enable haproxy
    [root@host01 ~]# systemctl start haproxy

其它资源

  • 如需了解更多详细信息,请参阅 Red Hat Ceph Storage Object Gateway 指南中的 高可用性服务 部分。
  • 如需了解更多详细信息,请参阅 Red Hat Ceph Storage 安装 指南中的 Red Hat Ceph Storage 安装一章