45Drives Knowledge Base
KB450270 - Configuring Ceph RGW to use SSL with HAProxy
https://knowledgebase.45drives.com/kb/kb450270-configuring-ceph-rgw-to-use-ssl-with-haproxy/

KB450270 - Configuring Ceph RGW to use SSL with HAProxy

Posted on January 8, 2021 by Brett Kelly


Scope/Description

Prerequisites

Steps

Obtain SSL Certificate

# openssl genrsa -out mydomain.key 2048
# openssl req -new -key mydomain.key -out mydomain.csr
- At this point there are two options, using a self signed cert, or registering with a third party SSL authentication authority.
This doc will continue with the self signed route. If registering with third party, once you recieve your .crt start the process again at step (4)
# openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
# cat mydomain.key mydomain.crt >> mydomain.pem
# ssh rgw1 "mkdir -p /etc/ssl/private/" && scp mydomain.pem rgw1:/etc/ssl/private/

Configure Ansible Varibles

# cp group_vars/rgwloadbalancers.yml.sample group_vars/rgwloadbalancers.yml
haproxy_frontend_port : When not using SSL this is the port the S3 service is accessible from
haproxy_frontend_ssl_port: When using SSL this is the port the S3 service is accessible from
haproxy_frontend_ssl_certificate: The path to the SSL cert local to the RGW server. This is the path to the .pem file we created above
virtual_ips: The IPs haproxy will use as the floating IP(s). Multiple entires supported, recommended not to use more IPs than rgws.
virtual_ip_netmask: The netmask for the virtual IPs above
virtual_ip_interface: The interface that will host the VIP

Example of Ansible Variables

haproxy_frontend_port: 80
haproxy_frontend_ssl_port: 443
haproxy_frontend_ssl_certificate: /etc/ssl/private/your-pem-here.pem
virtual_ips: 192.168.1.1
virtual_ip_netmask: 16
virtual_ip_interface: public-bond

Deploy HAProxy with Ansible

# ansible-playbook radosgw-lb.yml

Verification

Troubleshooting

-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAuBA1qjPvlrArwNHt9Ny8bD6fS9gkY2AIcN1FbYtCSlUx3UFK
/SMWYHUx9K5H6FCYP6YSZe2U2AUZdwNsBRmM9BgXLLbnOMJxEf15k8ZvCgnVUTJh
......
7nZv0uAZ70hRM4cfORzRcttAJeImOI/MHe14rhWgizZZlIaCA7CF6Imb31l+dq6z
YginGvUdoySr2N8q8yZSpOvxYgxBrePsqj37sYYofQamH0bI6uwVVk8=
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIDMjCCAhoCCQCfx9aLU4aT3jANBgkqhkiG9w0BAQsFADBbMQswCQYDVQQGEwJD
QTEUMBIGA1UECAwLTm92YSBTY290aWExDzANBgNVBAcMBlN5ZG5leTERMA8GA1UE
.....
Hq17g3a7QOcTYggf9SZgcmfut5Liuz9MxfihEkWOw9hBVudsZqxGyhK/nzSrb4Xz
MKCdzzJg0ojbrm4FMbh+SLJzkHmcQiQrMOJLOLNn/eFM/SKXW3PCVseLoUp84FGk
LOBZ3974
-----END CERTIFICATE-----