Skip to content

Instantly share code, notes, and snippets.

@bobwolff68
Created March 5, 2012 21:07
Show Gist options
  • Save bobwolff68/1981101 to your computer and use it in GitHub Desktop.
Save bobwolff68/1981101 to your computer and use it in GitHub Desktop.
Trying to enable SSL/TLS in punjab
# punjab tac file
# tac documentation is at the following URL:
# http://twistedmatrix.com/documents/current/core/howto/application.html
from twisted.web import server, resource, static
from twisted.application import service, internet
from twisted.internet import reactor, ssl
from punjab.httpb import Httpb, HttpbService
root = static.File("./html")
# uncomment only one of the bosh lines, use_raw does no xml
# parsing/serialization but is potentially less reliable
#bosh = HttpbService(1, use_raw=True)
bosh = HttpbService(1)
# You can limit servers with a whitelist.
# The whitelist is a list of strings to match domain names.
# bosh.white_list = ['jabber.org', 'thetofu.com']
# or a black list
# bosh.block_list = ['jabber.org', '.thetofu.com']
root.putChild('http-bind', resource.IResource(bosh))
# RMW root.putChild('nodejs-http-bind', resource.IResource(bosh))
site = server.Site(root)
application = service.Application("punjab")
internet.TCPServer(5280, site).setServiceParent(application)
#
# RMW adding TLS support for Facebook chat/xmpp support
#
sslContext = ssl.DefaultOpenSSLContextFactory('/home/ec2-user/certinfo/gocast_ssl_decrypted.key',
'/home/ec2-user/certinfo/video_gocast_it.cert',)
reactor.listenSSL(5281, site, contextFactory=sslContext,)
# To run this simply to twistd -y punjab.tac
# To run in debug mode twistd -n -l - -y punjab.tac
@ramitwadhwa
Copy link

Did this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment