[ejabberd] Routing between Virtual Hosts

Jeffrey Rogiers jeffrey.rogiers at gmail.com
Sun Mar 1 09:34:52 MSK 2009


The issue is not ODBC related at all. I was able to completely
reproduce this bug using the internal and anonymous auth methods.

I am using the default config file, with only the host/acl information added.

Additions are as follows:
{hosts, ["x.local","guest.x.local"]}.
{host_config, "x.local", [{auth_method, [internal]}]}.
{host_config, "guest.x.local", [{auth_method, [anonymous]},
{anonymous_protocol, login_anon}]}.
{acl, admin, {user, "admin", "x.local"}}.

After starting the server I simply register a user for the internal auth vhost
./ejabberdctl register abc x.local abc

Then sign in to both vhosts and try to subscribe from (abc at x.local to
abc at guest.x.local) or (abc at guest.x.local to abc at x.local).

The presence request is never received unless you sign out and sign back in.

This is the full ejabberd.cfg:
------------------------
{loglevel, 4}.
{hosts, ["x.local","guest.x.local"]}.

{listen,
 [
  {5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper},
{max_stanza_size, 65536}]},
  {5269, ejabberd_s2s_in, [{shaper, s2s_shaper},{max_stanza_size, 131072}]},
  {5280, ejabberd_http, [http_poll, web_admin]}
 ]}.

{host_config, "x.local",       [{auth_method, [internal]}]}.
{host_config, "guest.x.local", [{auth_method, [anonymous]},
{anonymous_protocol, login_anon}]}.

{acl, admin, {user, "admin", "x.local"}}.
{acl, local, {user_regexp, ""}}.

{shaper, normal, {maxrate, 1000}}.
{shaper, fast, {maxrate, 50000}}.

{access, max_user_sessions, [{10, all}]}.
{access, local, [{allow, local}]}.
{access, c2s, [{deny, blocked},{allow, all}]}.
{access, c2s_shaper, [{none, admin},{normal, all}]}.
{access, s2s_shaper, [{fast, all}]}.
{access, announce, [{allow, admin}]}.
{access, configure, [{allow, admin}]}.
{access, muc_admin, [{allow, admin}]}.
{access, muc, [{allow, all}]}.
{access, pubsub_createnode, [{allow, all}]}.
{access, register, [{allow, all}]}.

{language, "en"}.

{modules, [
  {mod_adhoc,    []},
  {mod_announce, [{access, announce}]}, % recommends mod_adhoc
  {mod_caps,     []},
  {mod_configure,[]}, % requires mod_adhoc
  {mod_disco,    []},
  {mod_irc,      []},
  {mod_last,     []},
  {mod_muc,      [{access, muc}, {access_create, muc},
{access_persistent, muc}, {access_admin, muc_admin}]},
  {mod_offline,  []},
  {mod_privacy,  []},
  {mod_private,  []},
  {mod_pubsub,   [{access_createnode, pubsub_createnode}, {plugins,
["default", "pep"]}]},
  {mod_register, [{welcome_message, {"Welcome!", "Hi\nWelcome to this
Jabber server."}}, {access, register}]},
  {mod_roster,   []},
  {mod_shared_roster,[]},
  {mod_stats,    []},
  {mod_time,     []},
  {mod_vcard,    []},
  {mod_version,  []}
 ]}.
------------------------

Thanks,
Jeffrey Rogiers



2009/2/28 Badlop <badlop at gmail.com>:
> 2009/2/19 Jeffrey Rogiers <jeffrey.rogiers at gmail.com>:
>> I have narrowed this down to using the anonymous login method.
>> I logged in using 2 users from each domain.
>> ODBC (mysql):
>> abc123 at x.org
>> qwerty at x.org
>> ANON (anonymous):
>> abc123 at guest.x.org
>> qwerty at guest.x.org
>>
>> These were the results of my test when trying to request presence.
>> abc123 (ODBC) -> qwerty  (ODBC) [Pres - Both]
>> abc123 (ANON) -> qwerty  (ANON) [Pres - None]
>> abc123 (ODBC) -> abc123 (ANON) [Pres - None]
>> abc123 (ANON) -> abc123 (ODBC) [Pres - 1Way]
>>
>> Im curious if anonymous users intentionally not supposed to have
>> roster at all? or if this is definitely a bug.
>
> I tried with ejabberd 2.0.3 and trunk SVN, using mysql auth for a
> vhost and login_anon for the other, with a configuration similar to
> yours.
>
> If guest.localhost uses mod_roster: roster, subscriptions and
> presences work correctly.
> If guest.localhost uses mod_roster_odbc: I see the same problems than
> you, and ejabberd.log shows:
> **************
> =ERROR REPORT==== 28-Feb-2009::23:31:44 ===
> E(<0.590.0>:ejabberd_hooks:190) : {noproc,
>                                   {gen_server,call,
>                                    ['ejabberd_odbc_sup_guest.localhost',
>                                     which_children,infinity]}}
> running hook: {roster_out_subscription,
>                  ["badlop","guest.localhost",
>                   {jid,"badlop","localhost",[],"badlop","localhost",[]},
>                   subscribe]}
>
> =ERROR REPORT==== 28-Feb-2009::23:31:44 ===
> E(<0.590.0>:ejabberd_hooks:205) : {noproc,
>                                   {gen_server,call,
>                                    ['ejabberd_odbc_sup_guest.localhost',
>                                     which_children,infinity]}}
> running hook: {roster_in_subscription,
>                  ["badlop","guest.localhost",
>                   {jid,"badlop","localhost",[],"badlop","localhost",[]},
>                   subscribed,[]]}
>
> =ERROR REPORT==== 28-Feb-2009::23:31:44 ===
> E(<0.424.0>:gen_iq_handler:118) : {noproc,
>                                   {gen_server,call,
>                                    ['ejabberd_odbc_sup_guest.localhost',
>                                     which_children,infinity]}}
> **************
>
>
> You configured in ejabberd.cfg something like this, right?:
> {hosts, ["x.org", "guest.x.org"]}.
> {modules, [
>  %%{mod_roster, []},
>  {mod_roster_odbc, []},
>  ...
>  ]}.
>
> With that setup, ejabberd will use mod_roster_odbc in x.org and also
> in guest.x.org
> However, mod_roster_odbc does not seem compatible for anonymous authentication.
>
> The solution is to move the mod_roster* definition from the main
> modules section to individual vhost definitions:
>
> {hosts, ["x.org", "guest.x.org"]}.
> {modules, [
>  %%{mod_roster, []},
>  %%{mod_roster_odbc, []},
>  ...
>  ]}.
> {host_config, "localhost",
>  [{{add, modules},
>   [
>    {mod_roster_odbc,   []}
>   ]
>  }
>  ]}.
>
> {host_config, "guest.localhost",
>  [{{add, modules},
>   [
>    {mod_roster,   []}
>   ]
>  }
>  ]}.
>
>
>
> ---
> Badlop,
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>


More information about the ejabberd mailing list