What version of ejabberd are you using?
17.07
What operating system (version) are you using?
Ubuntu 16.04
How did you install ejabberd (source, package, distribution)?
distribution
What did not work as expected? Are there error messages in the log? What
was the unexpected behavior? What was the expected result?
I'm getting an "AccessRules: Account does not have the right to perform the operation" error
api_permissions:
"parse server":
who:
- ip: "myIP"
what:
- "register"
- "registered_users"
- "registered_vhosts"
- "change_password"
- "unregister"
Double checked on the logs:
API call registered_vhosts [] from ::FFFF:myIP:22139
sample raw request from Postman:
POST /api/registered_vhosts HTTP/1.1
Host: myserver:5280
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 750df6e6-25c0-5003-2dfa-116c85bb6c48
{}
Any idea what seems to be the problem? Can I not access admin commands even if I allow my server's IP?
With those settings:
listen:
-
port: 5280
## ip: "::"
module: ejabberd_http
request_handlers:
"/api": mod_http_api
api_permissions:
"public commands":
who:
- ip: "127.0.0.1/8"
what:
- "registered_vhosts"
And this client:
<?php
$url='localhost:5280/api/registered_vhosts/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$output=curl_exec($ch);
curl_close($ch);
print_r($output);
?>
The qurey returns correctly:
$ php mha3-registeredvhosts-httpapi.php
["example.com","localhost"]1
And I see in the logs:
17:59:14.123 [info] API call registered_vhosts [] ({127,0,0,1})
Notice that I set the listener to IPv4, and granted access to an IPv4 address in api_permissions. If you use IPv6, you may need to retouch all this.
ah it was my listeners
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
With those settings:
And this client:
The qurey returns correctly:
And I see in the logs:
Notice that I set the listener to IPv4, and granted access to an IPv4 address in api_permissions. If you use IPv6, you may need to retouch all this.