Skip to content

Commit a4f0824

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 f54cfa8 commit a4f0824

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
@@ -186,3 +186,9 @@
186186
# metadata/vendordata
187187
#
188188
default[:nova][:metadata][:vendordata][:json] = "{}"
189+
190+
#
191+
# SSL settings
192+
#
193+
default[:nova][:ssl][:loadbalancer_terminate_ssl] = false
194+
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
@@ -119,7 +119,9 @@
119119
"generate_certs": false,
120120
"insecure": false,
121121
"cert_required": false,
122-
"ca_certs": "/etc/nova/ssl/certs/ca.pem"
122+
"ca_certs": "/etc/nova/ssl/certs/ca.pem",
123+
"loadbalancer_terminate_ssl": false,
124+
"pemfile": "/etc/ssl/private/nova.pem"
123125
},
124126
"novnc": {
125127
"ssl": {
@@ -185,7 +187,7 @@
185187
"nova": {
186188
"crowbar-revision": 0,
187189
"crowbar-applied": false,
188-
"schema-revision": 211,
190+
"schema-revision": 212,
189191
"element_states": {
190192
"nova-controller": [ "readying", "ready", "applying" ],
191193
"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
@@ -183,7 +183,9 @@
183183
"generate_certs": { "type" : "bool", "required" : true },
184184
"insecure": { "type" : "bool", "required" : true },
185185
"cert_required": { "type" : "bool", "required" : true },
186-
"ca_certs": { "type" : "str", "required" : true }
186+
"ca_certs": { "type" : "str", "required" : true },
187+
"loadbalancer_terminate_ssl": { "type" : "bool", "required": true},
188+
"pemfile": { "type" : "str", "required": true}
187189
}
188190
},
189191
"novnc": {

0 commit comments

Comments
 (0)