我想使用旁遮普作为Facebook聊天的xmpp代理
Punjab运行良好,但当我问chat.facebook.com时,它将无效
SENT: <body rid='313820892' xmlns='http://jabber.org/protocol/httpbind' to='chat.facebook.com' xml:lang='en' wait='300' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xml='http://www.w3.org/XML/1998/namespace' xmlns:xmpp='urn:xmpp:xbosh'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
当我们看旁遮普日志时,我们看到旁遮普连接到chat.facebook.com但没有任何答案
2012/03/09 10:42 +0200 [-] Log opened.
2012/03/09 10:42 +0200 [-] twistd 2.5.0 (/usr/bin/python 2.5.0) starting up
2012/03/09 10:42 +0200 [-] reactor class: <class 'twisted.internet.selectreactor.SelectReactor'>
2012/03/09 10:42 +0200 [-] Loading punjab.tac...
2012/03/09 10:42 +0200 [-] twisted.web.server.Site starting on 5281
2012/03/09 10:42 +0200 [-] Starting factory <twisted.web.server.Site instance at 0xb785c58c>
2012/03/09 10:42 +0200 [-] Loaded.
2012/03/09 10:42 +0200 [-] twisted.web.server.Site starting on 5280
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] HEADERS 1331282556.16:
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] {'origin': 'http://mydomain.tld', 'content-length': '264', 'via': '1.1 mydomain.tld', 'accept-language': 'fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': 'mydomain.tld', 'x-forwarded-for': 'XXX.XXX.XXX.XXX', 'connection': 'Keep-Alive', 'accept': '*/*', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/17.0.963.65 Chrome/17.0.963.65 Safari/535.11', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'host': 'localhost:5280', 'referer': 'http://mydomain.tld/facebook/', 'max-forwards': '10', 'cookie': '_jsuid=2679835210; fbm_XXXXXXXXX=base_domain=.mydomain.tld; fbsr_XXXXXXXXX=XXXXXXXXX', 'x-forwarded-server': 'mydomain.tld', 'content-type': 'application/xml'}
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] HTTPB POST :
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] <body rid='XXXXXXXXX' xmlns='http://jabber.org/protocol/httpbind' to='chat.facebook.com' xml:lang='en' wait='300' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xml='http://www.w3.org/XML/1998/namespace' xmlns:xmpp='urn:xmpp:xbosh'/>
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] Session Created : afeb0b2bf66d6ca8b5f5fee83ebbb449b64f4c65 1331282556.16
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] ================================== 1331282556.17 connect to chat.facebook.com:5222 ==================================
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] Starting factory <punjab.session.Session instance at 0xb77e4eac>
2012/03/09 10:42 +0200 [HTTPChannel,0,127.0.0.1] twisted.names.dns.DNSDatagramProtocol starting on 55647
2012/03/09 10:42 +0200 [twisted.names.dns.DNSDatagramProtocol (UDP)] <punjab.session.XMPPClientConnector instance at 0xb77e4f6c> will retry in 3 seconds
2012/03/09 10:42 +0200 [twisted.names.dns.DNSDatagramProtocol (UDP)] Stopping factory <punjab.session.Session instance at 0xb77e4eac>
2012/03/09 10:42 +0200 [-] Starting factory <punjab.session.Session instance at 0xb77e4eac>
2012/03/09 10:42 +0200 [twisted.names.dns.DNSDatagramProtocol (UDP)] <punjab.session.XMPPClientConnector instance at 0xb77e4f6c> will retry in 10 seconds
2012/03/09 10:42 +0200 [twisted.names.dns.DNSDatagramProtocol (UDP)] Stopping factory <punjab.session.Session instance at 0xb77e4eac>
2012/03/09 10:42 +0200 [-] Starting factory <punjab.session.Session instance at 0xb77e4eac>
2012/03/09 10:42 +0200 [twisted.names.dns.DNSDatagramProtocol (UDP)] Abandoning <punjab.session.XMPPClientConnector instance at 0xb77e4f6c> after 3 retries.
2012/03/09 10:42 +0200 [twisted.names.dns.DNSDatagramProtocol (UDP)] Stopping factory <punjab.session.Session instance at 0xb77e4eac>
2012/03/09 10:43 +0200 [-] ================================== afeb0b2bf66d6ca8b5f5fee83ebbb449b64f4c65 1331282584.43 startup timeout ==================================
2012/03/09 10:43 +0200 [-] HTTPB Error 200
2012/03/09 10:43 +0200 [-] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
我的旁遮普tac文件与facebook的ssl配置:
# punjab tac file
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")
bosh = HttpbService(1)
root.putChild('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(
'/root/punjab_privkey.pem',
'/root/punjab_cacert.pem',
)
reactor.listenSSL(
5281,
site,
contextFactory=sslContext,
)
你知道为什么我没有chat.facebook.com的答案吗?
谢谢
答案 0 :(得分:0)
我找到了答案 我在punjab.tac中添加此行以获得正确的DNS查找
bosh.connect_srv = False
就在这一行之后
bosh = HttpbService(1)
答案 1 :(得分:0)
您可能会完全禁用证书验证(警告:不安全)
将其放入punjab.tac
文件中
from twisted.internet import _sslverify
_sslverify.platformTrust = lambda : None