Skip to content

Commit 015bd0f

Browse files
author
Boris Bobrov
committed
Terminate ssl on haproxy for cinder (bsc#1149535)
If ssl is passed-thru on haproxy, the source ip gets replaced with the one of the node where haproxy lives, and there is no way to get the original ip on the services side. Add ssl termination on haproxy. Two new hidden options are added: loadbalancer_terminate_ssl (boolean) and pemfile (path to the certificate to use in haproxy-recognized format). This patch adds support for cinder. (cherry picked from commit 44e0f6a)
1 parent a4f0824 commit 015bd0f

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

chef/cookbooks/cinder/attributes/default.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@
5454
default[:cinder][:ha][:op][:monitor][:interval] = "10s"
5555
# Ports to bind to when haproxy is used for the real ports
5656
default[:cinder][:ha][:ports][:api] = 5520
57+
58+
#
59+
# SSL settings
60+
#
61+
default[:cinder][:ssl][:loadbalancer_terminate_ssl] = false
62+
default[:cinder][:ssl][:pemfile] = "/etc/ssl/private/cinder.pem"

chef/cookbooks/cinder/recipes/controller_ha.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
address node[:cinder][:api][:bind_open_address] ? "0.0.0.0" : cluster_admin_ip
2929
port node[:cinder][:api][:bind_port]
3030
use_ssl (node[:cinder][:api][:protocol] == "https")
31+
terminate_ssl node[:cinder][:ssl][:loadbalancer_terminate_ssl]
32+
pemfile node[:cinder][:ssl][:pemfile]
3133
servers CrowbarPacemakerHelper.haproxy_servers_for_service(node, "cinder", "cinder-controller", "api")
3234
rate_limit node[:cinder][:ha_rate_limit]["cinder-api"]
3335
action :nothing
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def upgrade(template_attrs, template_deployment, attrs, deployment)
2+
key = "loadbalancer_terminate_ssl"
3+
template_value = template_attrs["cinder"]["ssl"][key]
4+
attrs["cinder"]["ssl"][key] = template_value unless attrs["cinder"]["ssl"].key? key
5+
return attrs, deployment
6+
end
7+
8+
def downgrade(template_attrs, template_deployment, attrs, deployment)
9+
key = "loadbalancer_terminate_ssl"
10+
attrs["cinder"]["ssl"].delete(key) unless template_attrs["cinder"]["ssl"].key? key
11+
return attrs, deployment
12+
end

chef/data_bags/crowbar/template-cinder.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@
155155
"generate_certs": false,
156156
"insecure": false,
157157
"cert_required": false,
158-
"ca_certs": "/etc/cinder/ssl/certs/ca.pem"
158+
"ca_certs": "/etc/cinder/ssl/certs/ca.pem",
159+
"loadbalancer_terminate_ssl": false,
160+
"pemfile": "/etc/ssl/private/cinder.pem"
159161
},
160162
"db": {
161163
"password": "",
@@ -182,7 +184,7 @@
182184
"cinder": {
183185
"crowbar-revision": 0,
184186
"crowbar-applied": false,
185-
"schema-revision": 207,
187+
"schema-revision": 208,
186188
"element_states": {
187189
"cinder-controller": [ "readying", "ready", "applying" ],
188190
"cinder-volume": [ "readying", "ready", "applying" ]

chef/data_bags/crowbar/template-cinder.schema

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@
330330
"generate_certs": { "type" : "bool", "required" : true },
331331
"insecure": { "type" : "bool", "required" : true },
332332
"cert_required": { "type" : "bool", "required" : true },
333-
"ca_certs": { "type" : "str", "required" : true }
333+
"ca_certs": { "type" : "str", "required" : true },
334+
"loadbalancer_terminate_ssl": { "type" : "bool", "required": true},
335+
"pemfile": { "type" : "str", "required": true}
334336
}},
335337
"db": {
336338
"type": "map",

0 commit comments

Comments
 (0)