Cannot register admin user in v17.11.20

Hi All,

I have compiled and installed 17.11.20 ejabberd in ubuntu 16.04.2. Everything is fine, except registering admin user after launch. I am trying to register admin account (with user "ejabberd"), but I am gettinhg error "cannot_register". No clues from logs. I have pasted my configuration file and logs as is below. Can you please give me few pointers or problem with config. Anything wrong related to api permissions or any difference between ejabberdctl and ejabberd_ctl ?

Thanks a lot in advance.

Error:

ejabberd@ip-xxx:~$ /usr/local/sbin/ejabberdctl register admin ec2-35-167-159-255.us-west-2.compute.amazonaws.com password
Error: cannot_register

startup looks good:

ejabberd@ip-xxx:~$ /usr/local/sbin/ejabberdctl status
The node ejabberd@localhost is started with status: started
ejabberd 17.11.20 is running in that node

Config file:

loglevel: 5
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100
hosts:
  - "ec2-34-XXXXX.us-west-2.compute.amazonaws.com"
  - "localhost"
listen:
  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
  -
    port: 5269
    ip: "::"
    module: ejabberd_s2s_in
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/ws": ejabberd_http_ws
      "/bosh": mod_bosh
      "/api": mod_http_api
    web_admin: true
    captcha: true
auth_method: internal
shaper:
  normal: 1000
  fast: 50000
max_fsm_queue: 10000
acl:
  admin:
    user:
      - "admin@ec2-XXXXXXXX.us-west-2.compute.amazonaws.com"
  local:
    user_regexp: ""
  loopback:
    ip:
      - "127.0.0.0/8"
      - "::1/128"
      - "::FFFF:127.0.0.1/128"
shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    - 5000: admin
    - 100
  c2s_shaper:
    - none: admin
    - normal
  s2s_shaper: fast
access_rules:
  local:
    - allow: local
  c2s:
    - deny: blocked
    - allow
  announce:
    - allow: admin
  configure:
    - allow: admin
  muc_create:
    - allow: local
  pubsub_createnode:
    - allow: local
  register:
    - allow: all
  trusted_network:
    - allow: loopback
api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who:
      - access:
          - allow:
            - acl: loopback
            - acl: admin
      - oauth:
        - scope: "ejabberd:admin"
        - access:
          - allow:
            - acl: loopback
            - acl: admin
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who:
      - ip: "127.0.0.1/8"
    what:
      - "status"
      - "connected_users_number"

language: "en"
acme:
   contact: "mailto:example-admin@example.com"
   ca_url: "https://acme-v01.api.letsencrypt.org"
modules:
  mod_adhoc: {}
  mod_admin_extra: {}
    access: announce
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_disco: {}
  mod_echo: {}
  mod_irc: {}
  mod_bosh: {}
  mod_last: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_pubsub:
    access_createnode: pubsub_createnode
    ignore_pep_from_offline: true
    last_item_cache: false
    plugins:
      - "flat"
      - "hometree"
  mod_push: {}
  mod_push_keepalive: {}
  mod_register:
    ip_access: trusted_network
    access: register
  mod_roster: {}
  mod_shared_roster: {}
  mod_stats: {}
  mod_time: {}
  mod_vcard:
    search: false
  mod_vcard_xupdate: {}
  mod_avatar:
    convert:
      webp: jpeg
  mod_version: {}
  mod_stream_mgmt: {}
  mod_s2s_dialback: {}
  mod_http_api: {}
allow_contrib_modules: true

logs:

2017-12-02 14:57:08.173 [debug] <0.305.0>@ejabberd_access_permissions:handle_call:139 Command 'register' execution allowed by rule 'console commands' (CallerInfo=#{caller_module => ejabberd_ctl})
2017-12-02 14:57:08.173 [debug] <0.508.0>@ejabberd_commands:do_execute_command:495 Executing command ejabberd_admin:register with Args=[<<"admin">>,<<"ec2-xxxus-west-2.compute.amazonaws.com">>,<<"password">>]

As mentioned in

As mentioned in https://github.com/processone/ejabberd/issues/2141

In the beginning of the config file you define hosts localhost and "ec2-34-XXXXX.us-west-2.compute.amazonaws.com", but later you try to register an account in another host that you didn't define in the config: ec2-35-167-159-255.us-west-2.compute.amazonaws.com

Try to register in localhost, and you will see that one works.

Thanks a lot for your quick

Thanks a lot for your quick tip. Actually I switched EC2 server and I had typo in ip hostname. Once I have corrected typo it worked fine.

Syndicate content