New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ejabberd_xmlrpc changes in 15.09 #771

Closed
bangarharshit opened this Issue Oct 11, 2015 · 15 comments

Comments

Projects
None yet
7 participants
@bangarharshit

bangarharshit commented Oct 11, 2015

I was using xmlrpc to generate new user in ejabberd in 15.07. But with 15.09 it is failing with following error log. Are there any accesss related changes?

My config file:

  • port: 4560 module: ejabberd_xmlrpc

2015-10-11 03:51:33.805 [info] <0.442.0>@ejabberd_listener🉑299 (#Port<0.3870>) Accepted connection 115.99.236.138:52677 -> 10.240.0.2:45602015-10-11 03:51:33.805 [debug] <0.458.0>@ejabberd_http:init:153 S: [{[],ejabberd_xmlrpc}]2015-10-11 03:51:33.805 [info] <0.458.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.3870>}2015-10-11 03:51:33.805 [debug] <0.458.0>@ejabberd_http:process_header:283 (#Port<0.3870>) http query: 'POST' <<"/RPC2">>2015-10-11 03:51:33.805 [debug] <0.458.0>@ejabberd_http:extract_path_query:403 client data: <<"registerhostejabberd.sandwitch.inpasswordarbit6userarbit6">>2015-10-11 03:51:33.806 [debug] <0.458.0>@ejabberd_http:process:361 [<<"RPC2">>] matches []2015-10-11 03:51:33.806 [debug] <0.458.0>@ejabberd_xmlrpc:process:245 got XML-RPC request: {call,register,[{struct,[{host,<<"ejabberd.sandwitch.in">>},{password,<<"arbit6">>},{user,<<"arbit6">>}]}]}2015-10-11 03:51:33.806 [warning] <0.458.0>@ejabberd_xmlrpc:build_fault_response:386 Error -118A problem '{error,account_unprivileged}' occurred executing the command register with arguments[{host,<<"ejabberd.sandwitch.in">>}, {password,<<"arbit6">>}, {user,<<"arbit6">>}]

@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 11, 2015

Looks to me that it is due to oauth - http://docs.ejabberd.im/admin/guide/oauth/ in 15.09. I will try to fix it and close the issue.

@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 11, 2015

Looked into #759 but it is not working for me.

Here are my config files

 - port: 4560 
module: ejabberd_xmlrpc 
maxsessions: 10
timeout: 5000
 access_commands: xmlrpc: 
commands:
 - register 
- set_last
 - check_account 
- check_password 
- change_password
 - send_message
 - registered_users 
- unregister options: []
acl: 
## ## The 'admin' ACL grants administrative privileges to XMPP accounts. 
## You can put here as many accounts as you want. 
## admin: 
user: 
xmlrpc: 
user: 
- "nishant": "ejabberd.sandwitch.in"
xmlrpc:
 xmlrpc: allow

Client code

public class XMLRPCCheck {

    static int xmlrpcConnTimeout = 10000; // Connection timeout
    static int xmlrpcReplyTimeOut = 60000; // Reply timeout
    public static void main(String[] args) {
        try {
            XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
            config.setServerURL(new URL("http://ejabberd.sandwitch.in:4560/RPC2"));
            config.setBasicUserName("nishant@ejabberd.sandwitch.in");
            config.setBasicPassword("freebsd");
            config.setConnectionTimeout(xmlrpcConnTimeout);
            config.setReplyTimeout(xmlrpcReplyTimeOut);
            XmlRpcClient client = new XmlRpcClient();
            client.setConfig(config);

            /* Command string */
            String command = "register";

            /* Parameters as struct */
            Map struct = new HashMap();
            struct.put("user", "arbit6");
            struct.put("host", "ejabberd.sandwitch.in");
            struct.put("password", "arbit6");

            Object[] params = new Object[]{struct};
            HashMap<Object, Object> hashMap = (HashMap<Object, Object>) client.execute(command, params);
            for (Object obj : hashMap.keySet()) {
                System.out.println(ToStringBuilder.reflectionToString(obj));
            }
            for (Object obj : hashMap.values()) {
                System.out.println(ToStringBuilder.reflectionToString(obj));
            }
            System.out.println(ToStringBuilder.reflectionToString(hashMap.get("text")));
        } catch (Exception e) {
            System.out.println(e);
        }
    }
@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 12, 2015

Updated client code.

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

public class XMLRPCCheck {

    static int xmlrpcConnTimeout = 10000; // Connection timeout
    static int xmlrpcReplyTimeOut = 60000; // Reply timeout
    public static void main(String[] args) {
        try {
            XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
            config.setServerURL(new URL("http://ejabberd.sandwitch.in:4560/RPC2"));
            config.setBasicUserName("nishant@ejabberd.sandwitch.in");
            config.setBasicPassword("freebsd");
            config.setConnectionTimeout(xmlrpcConnTimeout);
            config.setReplyTimeout(xmlrpcReplyTimeOut);
            XmlRpcClient client = new XmlRpcClient();
            client.setConfig(config);

            /* Command string */
            String command = "register";

            /* Parameters as struct */
            Map struct = new HashMap();
            struct.put("user", "nishant");
            struct.put("host", "ejabberd.sandwitch.in");
            struct.put("password", "freebsd");

            Map struct1 = new HashMap();
            struct1.put("user", "arbit6");
            struct1.put("host", "ejabberd.sandwitch.in");
            struct1.put("password", "arbit6");          

            Object[] params = new Object[]{struct, struct1};
            HashMap<Object, Object> hashMap = (HashMap<Object, Object>) client.execute(command, params);
            for (Object obj : hashMap.keySet()) {
                System.out.println(ToStringBuilder.reflectionToString(obj));
            }
            for (Object obj : hashMap.values()) {
                System.out.println(ToStringBuilder.reflectionToString(obj));
            }
            System.out.println(ToStringBuilder.reflectionToString(hashMap.get("text")));
        } catch (Exception e) {
            System.out.println(e);
        }
    }

}
@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 14, 2015

Hi Guys,
Any update. If it is an issue and fixed in later release or it's not an issue. I am trying to debug and currently looking through ejabberd_commands.erl and ejabberd_xmlrpc.elr to patch the release commit locally.

In case you guys have a fix I can try to patch the same. Sorry if it intrudes in your work.

@CyrilPeponnet

This comment has been minimized.

CyrilPeponnet commented Oct 15, 2015

Same for me was working fine on 15.07 no longer working on 15.09.

{error,account_unprivileged}

Even with admin account. If I revert to 15.07 it works.

@mremond mremond added this to the ejabberd 15.10 milestone Oct 15, 2015

@badlop

This comment has been minimized.

Member

badlop commented Oct 20, 2015

There are recent improvements in the source code that may solve this problem: 1f2b7e8, 7c1e7e5, and 8a2fa62. Can you update git and test them?

@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 20, 2015

I am patching them on 15.09 tag and testing on the same.

@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 21, 2015

I have patched the release with thee commits.
I am getting a new issue:
A problem '{error,invalid_account_data}' occurred executing the command register with arguments
[{host,<<"ejabberd.sandwitch.in">>},
{password,<<"arbit6">>},
{user,<<"arbit6">>}]

I am able to register the same using ejabberdctl. I have enabled scram for password hashing.

@beherit

This comment has been minimized.

beherit commented Oct 21, 2015

@bangarharshit In your configuration file is missing "commands_admin_access" option.

@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 21, 2015

I have commands_admin_access:xmlrpc in my config but I don't have commands and oauth field. I don't want oauth for now so haven't added those.

@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 23, 2015

Also attaching anonymized yml file - https://gist.github.com/bangarharshit/05b4d16e3b45ae9ef2d5. For my setup I have just patched 15.09 with the three commits and no change in yml files. Let me know if you need more details.

@alexeyshch

This comment has been minimized.

Contributor

alexeyshch commented Oct 23, 2015

I've tried your config with the git version, and it seems working. I've only changed the xmlrpc user to test@localhost and replaced auth_method with internal. An example xmlrpc request:

<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><methodCall><methodName>register</methodName><params><param><value><struct><member><name>user</name><value><string>test</string></value></member><member><name>server</name><value><string>localhost</string></value></member><member><name>password</name><value><string>test</string></value></member></struct></value></param><param><value><struct><member><name>user</name><value><string>arbit6</string></value></member><member><name>host</name><value><string>abc.xyz.in</string></value></member><member><name>password</name><value><string>arbit6</string></value></member></struct></value></param></params></methodCall>

The same in Erlang syntax:

{call,register,[{struct,[{user,<<"test">>},{server,<<"localhost">>},{password,<<"test">>}]},{struct,[{user,<<"arbit6">>},{host,<<"abc.xyz.in">>},{password,<<"arbit6">>}]}]}

And the response:

{ok,{response,[{struct,[{res,0},
                        {text,"User arbit6@abc.xyz.in successfully registered"}]}]}}
@bangarharshit

This comment has been minimized.

bangarharshit commented Oct 23, 2015

You are right. It's my mistake. It seems my authentication password was wrong and the message was not indicative for that. Thanks for all your help. Closing the ticket

@j4hangir

This comment has been minimized.

j4hangir commented Nov 12, 2015

Regarding Ejabberd 15.10, the documentation is misleading/outdated; in order to have authorization-free access, omitting the AccessCommands is not enough, as in addition an empty list must be passed:

Listen:
  -
    port: 4560
    ip: "127.0.0.1"
    module: ejabberd_xmlrpc
    AccessCommands: {}
    access_commands: {}

@mremond mremond reopened this Nov 15, 2015

badlop added a commit to processone/docs.ejabberd.im that referenced this issue Nov 17, 2015

badlop added a commit that referenced this issue Nov 17, 2015

@badlop

This comment has been minimized.

Member

badlop commented Nov 17, 2015

Thanks for reporting! I've fixed everywhere I could find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment