ejabberd - Comments for "CGI Call to ejabberdctl"
https://www.ejabberd.im/node/3208
enExample system call using regular user
https://www.ejabberd.im/node/3208#comment-53572
<p>Ah, ok, I didn't notice the requirement of executing the script with a regular user, not root.</p>
<p>I tried this using ejabberd trunk SVN. In your system probably you will have different ebin path and cookie path.</p>
<pre>$ ejabberdctl
bash: /sbin/ejabberdctl: Permiso denegado
$ erl -noinput -sname ejactl -pa /lib/ejabberd/ebin/ -s ejabberd_ctl -extra ejabberd@localhost connected-users-number
RPC failed on the node ejabberd@localhost: nodedown
</pre><p>
And in the ejabberd log files i see:</p>
<pre>** Connection attempt from disallowed node ejactl@atenea **</pre><p>
Now i provide the cookie:</p>
<pre>
$ COOKIE=`sudo cat /var/lib/ejabberd/.erlang.cookie`
$ echo $COOKIE
PVMCWDKIODNMGKFRAJMW
$ erl -setcookie $COOKIE -noinput -sname ejactl -pa /lib/ejabberd/ebin/ -s ejabberd_ctl -extra ejabberd@localhost connected-users-number
1
</pre>Mon, 22 Sep 2008 16:12:45 +0000mfosscomment 53572 at https://www.ejabberd.imlimited ejabberdctl function from cgi
https://www.ejabberd.im/node/3208#comment-53567
<p>1. ejabberdctl has way too many functions to make it available to any user. Therefore, intentionally limiting the call to the user-resources function as a presence check<br />
2. The above script was called from a perl script cgi apache as the apache user.<br />
3. Don't want to run from cgi as root.</p>
<p>ejabberdctl user-resources user server works in 2.0.2 as advertised, but, that's not the point or the issue.</p>
<p>This was just a handy way for processes (not IM stuff) to check for user/resource presence without having to log in, subscribe, etc., or interrogating the database (mnesia).</p>
<p>Once a user/resource was identified as present, then, and only then, would processes be applied to that user/resource.</p>
<p>Looked into XML-RPC methods - seem too complicated. If I could update the script to run with newer versions of the server, that would be great.</p>
<p>What is missing from the script?</p>
Fri, 19 Sep 2008 18:58:44 +0000MikeDunnecomment 53567 at https://www.ejabberd.imTry ejabberdctl
https://www.ejabberd.im/node/3208#comment-53564
<p>I didn't check in detail your script. I think you can use the included ejabberdctl script instead of it.</p>
<p>I tried this:</p>
<ol>
<li>Installed ejabberd 2.0.2 using source code.
</li><li>Started ejabberd
</li><li>Then I execute:<br />
<pre>$ sudo ejabberdctl user-resources badlop localhost
Home2
$
</pre></li></ol>
<p>Of course, in your case the ejabberdctl script may be in a different location, and may require or not to be root.</p>
Fri, 19 Sep 2008 08:17:37 +0000mfosscomment 53564 at https://www.ejabberd.im