Ejabberd:注册/记录用户

时间:2016-03-29 05:53:17

标签: erlang ejabberd

我正在运行ejabberd的本地实例。进程一的默认配置(ejabberd.yml)与adium客户端一起工作正常。在对yml文件进行一些更改后,我重新部署了服务器,并在注册用户时获得了跟踪堆栈跟踪:

 2016-03-29 11:15:45.131 [debug] <0.492.0>@ejabberd_c2s:send_text:1838 Send XML on stream = <<"<stream:features><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='AC6YpUkEgZqi0CJQw6bRvljBJUI='/><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>X-OAUTH2</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms></stream:features>">>
2016-03-29 11:15:45.195 [debug] <0.491.0>@ejabberd_receiver:process_data:284 Received XML on stream = <<"<iq type='get' id='purpled84a3c3'><query xmlns='jabber:iq:register'/></iq>">>
2016-03-29 11:15:45.195 [debug] <0.491.0>@shaper:update:120 State: {maxrate,1000,0.0,1459230345130850}, Size=74
M=37.0, I=64.387
2016-03-29 11:15:45.196 [debug] <0.492.0>@ejabberd_c2s:send_text:1838 Send XML on stream = <<"<iq from='localhost' id='purpled84a3c3' type='error'><error code='503' type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>">>

配置yml文件:

listen:
  -
    port: 5222
    module: ejabberd_c2s
    ##
    ## If TLS is compiled in and you installed a SSL
    ## certificate, specify the full path to the
    ## file and uncomment these lines:
    ##
# Commented by Kirat
#    certfile: "/opt/ejabberd-15.11/conf/server.pem"
#    starttls: true
    ## To enforce TLS encryption for client connections,
    ## use this instead of the "starttls" option:
    ## starttls_required: true
    ##
    ## Custom OpenSSL options
    ##
#    protocol_options:
#      - "no_sslv3"
    ##   - "no_tlsv1"
    max_stanza_size: 65536
    max_resume_timeout: 1000
    certfile: "/Users/karanahuja/Urbanclap_Workspace/ejabberd_live/etc/ejabberd/cert.pem" #$$$ comment before release
    shaper: c2s_shaper
    access: c2s
    zlib: true
    starttls: true

# Maybe we close this too - Kirat
  -
    port: 5269
    module: ejabberd_s2s_in

任何帮助都会非常感激

更新

我可以通过ejabberdctl注册用户名localhost密码注册

Adium仍然无法连接,为ejabberd_c2s提供503服务不可用错误。

更新

问题出在一个模块mod_filter上,它丢弃了IQ数据包。如果没有在yml文件的MODULES下定义mod_filter,adium就可以很好地连接到服务器了。使用mod_filter登录日志:

2016-03-29 12:05:33.404 [debug] <0.1552.0>@ejabberd_router:do_route:351 route KARAN DEBUG
    from {jid,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>}
    to {jid,<<>>,<<"localhost">>,<<>>,<<>>,<<"localhost">>,<<>>}
    packet {xmlel,<<"iq">>,[{<<"type">>,<<"get">>},{<<"id">>,<<"purple1a40a648">>},{<<"to">>,<<"localhost">>}],[{xmlel,<<"query">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/disco#items">>}],[]}]}
2016-03-29 12:05:33.405 [debug] <0.1552.0>@mod_filter:filter_packet:37 filtering packet KARAN KARAN KARAN KARAN...>>>>>>>>>>>>>>>>>>>>>
2016-03-29 12:05:33.405 [debug] <0.1552.0>@mod_filter:check_stanza:62 IQ packet KARAN KARAN KARAN KARAN...>>>>>>>>>>>>>>>>>>>>>
2016-03-29 12:05:33.405 [debug] <0.1552.0>@mod_filter:filter_packet:45 filtering packet...
From: {jid,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>}
To: {jid,<<>>,<<"localhost">>,<<>>,<<>>,<<"localhost">>,<<>>}
Packet: {xmlel,<<"iq">>,[{<<"type">>,<<"get">>},{<<"id">>,<<"purple1a40a648">>},{<<"to">>,<<"localhost">>}],[{xmlel,<<"query">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/disco#items">>}],[]}]}
Result: {drop,mod_filter_iq,sender}
2016-03-29 12:05:33.405 [debug] <0.1552.0>@ejabberd_router:do_route:351 route KARAN DEBUG
    from {jid,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>}
    to {jid,<<>>,<<"localhost">>,<<>>,<<>>,<<"localhost">>,<<>>}
    packet {xmlel,<<"iq">>,[{<<"type">>,<<"get">>},{<<"id">>,<<"purple1a40a649">>},{<<"to">>,<<"localhost">>}],[{xmlel,<<"query">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/disco#info">>}],[]}]}
2016-03-29 12:05:33.405 [debug] <0.1552.0>@mod_filter:filter_packet:37 filtering packet KARAN KARAN KARAN KARAN...>>>>>>>>>>>>>>>>>>>>>
2016-03-29 12:05:33.405 [debug] <0.1552.0>@mod_filter:check_stanza:62 IQ packet KARAN KARAN KARAN KARAN...>>>>>>>>>>>>>>>>>>>>>
2016-03-29 12:05:33.405 [debug] <0.1552.0>@mod_filter:filter_packet:45 filtering packet...
From: {jid,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>,<<"test24">>,<<"localhost">>,<<"Administrators-MacBook-Pro-6">>}
To: {jid,<<>>,<<"localhost">>,<<>>,<<>>,<<"localhost">>,<<>>}
Packet: {xmlel,<<"iq">>,[{<<"type">>,<<"get">>},{<<"id">>,<<"purple1a40a649">>},{<<"to">>,<<"localhost">>}],[{xmlel,<<"query">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/disco#info">>}],[]}]}
Result: {drop,mod_filter_iq,sender}

问题:为什么数据包会被mod_filter删除?

更新

mod_filter问题与503错误无关。将它作为一个单独的问题。 mod_register在yml文件上被注释掉了,这就是用户无法注册的原因。谢谢Mickaël

1 个答案:

答案 0 :(得分:1)

您没有显示模块部分,但可能没有启用注册功能。您需要启用mod_register