ejabberd: is there a way to configure a different

2019-07-21 00:31发布

问题:

I am building an ejabberd module. I require this module to perform RPC calls to another node on the same LAN (sname). From what I understand, ejabberd configures it owns "cookie" which, of course, will differ from the cookie I use for my other nodes.

Is there a way to force ejabberd to use another cookie?

EDIT: ejabberd starts its daemon under the "ejabberd" username.

EDIT: even when creating /home/ejabberd/.erlang.cookie (username: ejabberd, group: ejabberd) with an appropriate cookie it still does not work.

EDIT: one way to go around the problem (which isn't so nice) is to copy (with the proper permissions) the intended .erlang.cookie file to /var/lib/ejabberd

回答1:

The ejabberdctl script sets the home directory so that the cookie file lives at /var/lib/ejabberd/.erlang.cookie. Erlang itself checks the permissions of the file, so they must be correct.

You have a few options to force the use of a particular cookie:

  • Change the contents of the file - ejabberd won't alter it.
  • Change the ejabberdctl script so that it passes -setcookie 'SomeCookieValue' to erl.
  • Change ejabberdctl to set a different home directory.

The cookie file will be created if it doesn't exist, but won't be changed behind your back if it does exist. Using a common cookie is required to build ejabberd clusters or to integrate with ejabberd via erlang distribution.