wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz ./configure --prefix=/usr/local make make install
wget http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.8.0.tar.gz#md5=8ab837320b4532774c9c89f030d2a389 tar -zxvf zope.interface-3.8.0.tar.gz python2 setup.py install
wget http://twistedmatrix.com/Releases/Twisted/12.0/Twisted-12.0.0.tar.bz2 bunzip2 Twisted-12.0.0.tar.bz2 tar -xvf Twisted-12.0.0.tar.bz2 cd Twisted-12.0.0 python2 setup.py install
wget https://launchpad.net/pyopenssl/main/0.11/+download/pyOpenSSL-0.11.tar.gz tar -zxvf pyOpenSSL-0.11.tar.gz cd pyOpenSSL-0.11 python2 setup.py install
openssl genrsa > privkey.pem openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1000
You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:TW State or Province Name (full name) [Berkshire]:Taiwan Locality Name (eg, city) [Newbury]: YourCity Organization Name (eg, company) [My Company Ltd]:YourCompany Organizational Unit Name (eg, section) []:YourOU Common Name (eg, your name or your server's hostname) []: YourHostname Email Address []:yourmail@yourdomain.com<script type="text/javascript"> /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ </script>
tar -zxvf twonds-punjab-223f1cf.tar.gz cd twonds-punjab-223f1cf python setup.py install
#在前面加上 from twisted.internet import reactor, ssl #在 bosh = HttpbService(1) 後面加上 bosh.connect_srv = False #最後面加上 sslContext = ssl.DefaultOpenSSLContextFactory( 'privkey.pem', 'cacert.pem', ) reactor.listenSSL( 5281, site, contextFactory=sslContext, )
# 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) bosh.connect_srv = False # 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)) site = server.Site(root) application = service.Application("punjab") internet.TCPServer(5280, site).setServiceParent(application) sslContext = ssl.DefaultOpenSSLContextFactory( 'privkey.pem', 'cacert.pem', ) reactor.listenSSL( 5281, site, contextFactory=sslContext, ) # To run this simply to twistd -y punjab.tac
twistd -y punjab.tac
connectionFB = new Strophe.Connection('http://your-ip:5280/http-bind');