Skip to content

Commit 75df3da

Browse files
author
Boris Bobrov
committed
Terminate nova ssl on haproxy (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). (cherry picked from commit 94fc788)
1 parent 2164b78 commit 75df3da

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

chef/cookbooks/nova/attributes/default.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,9 @@
183183
# metadata/vendordata
184184
#
185185
default[:nova][:metadata][:vendordata][:json] = "{}"
186+
187+
#
188+
# SSL settings
189+
#
190+
default[:nova][:ssl][:loadbalancer_terminate_ssl] = false
191+
default[:nova][:ssl][:pemfile] = "/etc/ssl/private/nova.pem"

chef/cookbooks/nova/recipes/controller_ha.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
address "0.0.0.0"
2929
port node[:nova][:ports][:api]
3030
use_ssl node[:nova][:ssl][:enabled]
31+
terminate_ssl node[:nova][:ssl][:loadbalancer_terminate_ssl]
32+
pemfile node[:nova][:ssl][:pemfile]
3133
servers CrowbarPacemakerHelper.haproxy_servers_for_service(node, "nova", "nova-controller", "api")
3234
rate_limit node[:nova][:ha_rate_limit]["nova-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["nova"]["ssl"][key]
4+
attrs["nova"]["ssl"][key] = template_value unless attrs["nova"]["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["nova"]["ssl"].delete(key) unless template_attrs["nova"]["ssl"].key? key
11+
return attrs, deployment
12+
end

chef/data_bags/crowbar/template-nova.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@
116116
"generate_certs": false,
117117
"insecure": false,
118118
"cert_required": false,
119-
"ca_certs": "/etc/nova/ssl/certs/ca.pem"
119+
"ca_certs": "/etc/nova/ssl/certs/ca.pem",
120+
"loadbalancer_terminate_ssl": false,
121+
"pemfile": "/etc/ssl/private/nova.pem"
120122
},
121123
"novnc": {
122124
"ssl": {
@@ -182,7 +184,7 @@
182184
"nova": {
183185
"crowbar-revision": 0,
184186
"crowbar-applied": false,
185-
"schema-revision": 213,
187+
"schema-revision": 214,
186188
"element_states": {
187189
"nova-controller": [ "readying", "ready", "applying" ],
188190
"nova-compute-ironic": [ "readying", "ready", "applying" ],

chef/data_bags/crowbar/template-nova.schema

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@
178178
"generate_certs": { "type" : "bool", "required" : true },
179179
"insecure": { "type" : "bool", "required" : true },
180180
"cert_required": { "type" : "bool", "required" : true },
181-
"ca_certs": { "type" : "str", "required" : true }
181+
"ca_certs": { "type" : "str", "required" : true },
182+
"loadbalancer_terminate_ssl": { "type" : "bool", "required": true},
183+
"pemfile": { "type" : "str", "required": true}
182184
}
183185
},
184186
"novnc": {

0 commit comments

Comments
 (0)