2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-15 12:17:47 +00:00

Have sockapi properly run alongside httpapi

Have sockapi force TLSv1
This commit is contained in:
Jarrod Johnson 2013-09-14 20:21:58 -04:00
parent 2644801929
commit 4fee4082b9
3 changed files with 17 additions and 10 deletions

View File

@ -141,15 +141,18 @@ def resourcehandler(env, start_response):
start_response('404 Not Found', [])
return ["Unrecognized directive (404)"]
def serve():
# TODO(jbjohnso): move to unix socket and explore
# either making apache deal with it
# or just supporting nginx or lighthttpd
# for now, http port access
scgi.WSGIServer(resourcehandler, bindAddress=("localhost",4004)).run())
class HttpApi(object):
def start(self):
# TODO(jbjohnso): move to unix socket and explore
# either making apache deal with it
# or just supporting nginx or lighthttpd
# for now, http port access
self.server = eventlet.spawn(
scgi.WSGIServer(resourcehandler,
bindAddress=("localhost",4004)).run())
self.server = eventlet.spawn(serve)

View File

@ -13,6 +13,7 @@
import confluent.pluginapi as pluginapi
import confluent.httpapi as httpapi
import confluent.sockapi as sockapi
import eventlet
from eventlet.green import socket
from eventlet import wsgi
@ -24,8 +25,8 @@ def run():
pluginapi.load_plugins()
webservice = httpapi.HttpApi()
webservice.start()
sockapi = sockapi.SockApi()
sockapi.start()
sockservice = sockapi.SockApi()
sockservice.start()
while (1):
eventlet.sleep(100)

View File

@ -8,6 +8,7 @@ import confluent.console as console
import confluent.config as config
import eventlet.green.socket as socket
import eventlet.green.ssl as ssl
import eventlet
def sessionhdl(connection):
#TODO: authenticate and authorize peer
@ -23,7 +24,9 @@ def sessionhdl(connection):
def _handler():
plainsocket = socket.socket()
srv = ssl.wrap_socket(plainsocket, keyfile="/etc/confluent/privkey.pem",
cert="/etc/confluent/srvcert.pem", server_side=True)
certfile="/etc/confluent/srvcert.pem",
ssl_version=ssl.PROTOCOL_TLSv1,
server_side=True)
srv.bind(('0.0.0.0', 4001))
srv.listen(5)
while (1): # TODO: exithook