summaryrefslogtreecommitdiff
path: root/neutron/wsgi.py
diff options
context:
space:
mode:
authorVincent Untz <vuntz@suse.com>2015-11-17 17:47:56 +0100
committerVincent Untz <vuntz@suse.com>2015-11-18 02:28:45 +0100
commit7a306e2918775ebb94d9e1408aaa2b7c3ed26fc6 (patch)
treed2a938e537792f648714f1b603726b56ac027132 /neutron/wsgi.py
parent26fb41962ebfe12623cdc7da37285b1d86b3e193 (diff)
downloadneutron-7a306e2918775ebb94d9e1408aaa2b7c3ed26fc6.tar.gz
Ensure metadata agent doesn't use SSL for UNIX socket
The communication between the ns metadata proxy and the metadata agent is pure HTTP, and should not switch to HTTPS when neutron is using SSL. We're therefore telling wsgi.Server to forcefully disable SSL in that case. Change-Id: I2cb9fa231193bcd5c721c4d5cf0eb9c16e842349 Closes-Bug: #1514424
Diffstat (limited to 'neutron/wsgi.py')
-rw-r--r--neutron/wsgi.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/neutron/wsgi.py b/neutron/wsgi.py
index 9fe21fbcb7..ade21826b3 100644
--- a/neutron/wsgi.py
+++ b/neutron/wsgi.py
@@ -76,9 +76,10 @@ def encode_body(body):
class WorkerService(worker.NeutronWorker):
"""Wraps a worker to be handled by ProcessLauncher"""
- def __init__(self, service, application):
+ def __init__(self, service, application, disable_ssl=False):
self._service = service
self._application = application
+ self._disable_ssl = disable_ssl
self._server = None
def start(self):
@@ -89,7 +90,7 @@ class WorkerService(worker.NeutronWorker):
# errors on service restart.
# Duplicate a socket object to keep a file descriptor usable.
dup_sock = self._service._socket.dup()
- if CONF.use_ssl:
+ if CONF.use_ssl and not self._disable_ssl:
dup_sock = sslutils.wrap(CONF, dup_sock)
self._server = self._service.pool.spawn(self._service._run,
self._application,
@@ -112,10 +113,11 @@ class WorkerService(worker.NeutronWorker):
class Server(object):
"""Server class to manage multiple WSGI sockets and applications."""
- def __init__(self, name, num_threads=1000):
+ def __init__(self, name, num_threads=1000, disable_ssl=False):
# Raise the default from 8192 to accommodate large tokens
eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
self.num_threads = num_threads
+ self.disable_ssl = disable_ssl
# Pool for a greenthread in which wsgi server will be running
self.pool = eventlet.GreenPool(1)
self.name = name
@@ -123,7 +125,7 @@ class Server(object):
# A value of 0 is converted to None because None is what causes the
# wsgi server to wait forever.
self.client_socket_timeout = CONF.client_socket_timeout or None
- if CONF.use_ssl:
+ if CONF.use_ssl and not self.disable_ssl:
sslutils.is_enabled(CONF)
def _get_socket(self, host, port, backlog):
@@ -186,7 +188,7 @@ class Server(object):
self._launch(application, workers)
def _launch(self, application, workers=0):
- service = WorkerService(self, application)
+ service = WorkerService(self, application, self.disable_ssl)
if workers < 1:
# The API service should run in the current process.
self._server = service