配置服务器端加密

如果无法通过SSL发送加密请求,您可以设置服务器端加密,使用 HTTP 向 Ceph Object Gateway发送请求。

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

先决条件

  • 运行中的 IBM Storage Ceph 集群。

  • 对存储集群中所有节点的根级别访问。

  • 安装 Ceph Object Gateway 软件。

  • 安装 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