Multiple vhosts on separate addresses

I have a server with multiple IP addresses, and I have ejabberd configured to support multiple domains:

{hosts, ["domain1.com", "domain2.org"]}.

Let's assume domain1.com has IP 100.1.1.1, and domain2.org has IP 200.2.2.2. Is it possible to configure ejabberd in such a way that an incomming connection on address 100.1.1.1 will only support domain1.com users, and incoming connections on address 200.2.2.2 will only support domain2.org users?

It is possible using the development version from trunk SVN

This is not possible in ejabberd 2.0.3. The feature was implemented recently, and is available only in the development code in SVN. It will be available in a future release ejabberd 2.1.0 or similar, but it will not be released soon (not at least in the next weeks). You can compile ejabberd from SVN yourself if you really want this feature now.

Example configuration for ejabberd 2.1.0-alpha from trunk SVN:

{hosts, ["domain1.com", "domain2.org"]}.

{acl, domain1com, {server, "domain1.com"}}.
{acl, domain2org, {server, "domain2.org"}}.

{access, c2s_1com, [{deny, blocked}, {allow, domain1com}, {deny, all}]}.
{access, c2s_2org, [{deny, blocked}, {allow, domain2org}, {deny, all}]}.

{listen,
 [

  {{5222, "100.1.1.1"}, ejabberd_c2s, [
                        {certfile, "/etc/ejabberd/ssl.pem"}, starttls,
                        {access, c2s_1com},
                        {shaper, c2s_shaper},
                        {max_stanza_size, 65536}
                       ]},

  {{5222, "200.2.2.2"}, ejabberd_c2s, [
                        {certfile, "/etc/ejabberd/ssl.pem"}, starttls,
                        {access, c2s_2org},
                        {shaper, c2s_shaper},
                        {max_stanza_size, 65536}
                       ]},
  ...
 ]
}.

With this configuration, there will be two different listeners of port number 5222, each one in a different IP address.

$ netstat -n -l | grep 5222
tcp        0      0 100.1.1.1:5222       0.0.0.0:*               LISTEN
tcp        0      0 200.2.2.2:5222          0.0.0.0:*               LISTEN

Each listener allows only connections for the specified virtual host.

Syndicate content