2.11. 配置服务器端加密
作为存储管理员,您可以在无法通过 SSL 发送加密请求的情况下设置服务器端加密来使用 HTTP 将请求发送到 Ceph 对象网关。
此流程使用 HAProxy 作为代理和负载均衡器。
先决条件
- 对存储集群中所有节点的根级别访问权限。
- 一个正在运行的 Red Hat Ceph Storage 集群。
- 已安装 Ceph 对象网关。
- 已安装 HAProxy。
流程
编辑
haproxy.cfg
文件:示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend http_web bind *: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
frontend http_web bind *: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
注释掉允许访问
http
前端的行,并添加指令来指示 HAProxy 使用https
前端:示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow frontend http_web bind *:80 mode http default_backend rgw here we set the incoming HTTPS port on the load balancer (eg : 443)
# frontend http_web # bind *: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
在集群的所有节点上,将以下参数添加到 Ceph 配置文件的
[global]
部分:Copy to Clipboard Copied! Toggle word wrap Toggle overflow rgw_trust_forwarded_https=true
rgw_trust_forwarded_https=true
启用并启动 HAProxy:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow systemctl enable haproxy systemctl start haproxy
[root@haproxy]# systemctl enable haproxy [root@haproxy]# systemctl start haproxy
要确保在 Ansible
运行时 rgw_trust_forwarded_https=true
不会从 Ceph 配置文件中删除,请编辑 ceph-ansibleall.yml
文件,并在 ceph_conf
_overrides / global 部分中将 ceph-ansible all.yml 文件设置为 rgw_
trust_forwarded_https。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ceph_conf_overrides: global: rgw_trust_forwarded_https: true
ceph_conf_overrides: global: rgw_trust_forwarded_https: true
- 完成更改后,运行 ceph-ansible playbook 以在所有 Ceph 节点上更新配置。