Clustering + Mod_Rest Configuration

I'm trying to cluster two machines together and I have them successfully clustered. However, I now want to use mod_rest for account management and can't seem to get it configured so that I get both clustering and mod_rest functioning. My cluster ID is ecs.dev and my machine's name is centora. I have run through the steps here: http://tdewolf.blogspot.com/2009/07/clustering-ejabberd-nodes-using-mnes... with a few tweaks, but have confirmed on the admin web at 5280 that the cluster is functioning with 2 nodes. The ACL is configured such that it is allowing the admin connections on 5280, but the erlang.log is complaining about not having mod_rest started on the right v_host:
--------------------------------------------------------------
=CRASH REPORT==== 21-Nov-2011::13:19:11 ===
crasher:
pid: <0.234.0>
registered_name: []
exception throw: {module_must_be_started_in_vhost,mod_rest,"centora"}
in function mod_rest:try_get_option/3
in call from mod_rest:check_member_option/3
in call from mod_rest:process/2
in call from ejabberd_http:process/2
in call from ejabberd_http:process_request/1
in call from ejabberd_http:process_header/2
in call from ejabberd_http:receive_headers/1
initial call: ejabberd_http:init({gen_tcp,#Port<0.331>},
[inet,
{request_handlers,[{["rest"],mod_rest}]},
web_admin,
{ip,{0,0,0,0}}])
ancestors: [ejabberd_http_sup,ejabberd_sup,<0.37.0>]
messages: []
links: [<0.215.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 987
stack_size: 23
reductions: 751
neighbours:

=SUPERVISOR REPORT==== 21-Nov-2011::13:19:11 ===
Supervisor: {local,ejabberd_http_sup}
Context: child_terminated
Reason: {module_must_be_started_in_vhost,mod_rest,"centora"}
Offender: [{pid,<0.234.0>},
{name,undefined},
{mfa,
{ejabberd_http,start_link,
[{gen_tcp,#Port<0.331>},
[inet,
{request_handlers,[{["rest"],mod_rest}]},
web_admin,
{ip,{0,0,0,0}}]]}},
{restart_type,temporary},
{shutdown,brutal_kill},
{child_type,worker}]
--------------------------------------------------------------
Just a quick recap: the machine I'm running on is centora, but my cluster is named "ecs.dev" sans quotes. The ejabberd.cfg configuration for mod_rest looks like:
--------------------------------------------------------------
{hosts, ["ecs.dev"]}.

{listen,
[

{5280, ejabberd_http, [
{request_handlers, [
{["rest"], mod_rest}
]},
web_admin
]}

]}.
--------------------------------------------------------------

What do I need to change in configuration so that I can use mod_rest to administer accounts (create/update/delete) using the EJabberD rest APIs?

Thank you,
Zach Calvert

Hmmm, very odd. I just

Hmmm, very odd. I just discovered that I can simply update the hosts file to have

{hosts, ["ecs.dev", "centora"]}.

and it seems to allow me to create ecs.dev users even though the plugin is activated as centora. Does this leave security holes open, or am I missing something of danger here?

Thanks,
Zach Calvert

Zach Calvert wrote: {hosts,

Zach Calvert wrote:

{hosts, ["ecs.dev", "centora"]}.

This is a dirty trick. It works, I am not aware why this should be a problem initially. But please try this alternative:

Your client sets the TCP connection to "centora", but your HTTP query should have as "Host" request header one of the XMPP domain names that you configured in ejabberd.cfg

For example, if you have configured: {hosts, ["ecs.dev"]}.
Then this should work:

$ telnet centora 5280
POST /rest HTTP/1.1
Host: ecs.dev
Content-Length: 85
whatever

if you try this, please confirm if it works too, or not.

Very nice, it does indeed

Very nice, it does indeed work. Thank you very much for your heads up!

For future reference, is there a document or something that I'm missing on these modules? I can't seem to find much in the way of docs on some of these ACLs and EJabberD modules.

As a side note, I discovered

As a side note, I discovered this falls apart if using Java's built in HttpURLConnection -- see http://stackoverflow.com/questions/7648872/can-i-override-the-host-heade...

Syndicate content