processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/ejabberd/
Other
6.12k stars 1.51k forks source link

Error: Apparently your account has no administration rights in this server. Please check how to grant admin rights: #4257

Closed ArsiKbArsikLR closed 4 months ago

ArsiKbArsikLR commented 4 months ago

Снимок экрана от 2024-07-17 12-48-10 Before creating a ticket, please consider if this should fit the discussion forum better.

Environment

Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml


  admin:
     user:
       - "admin@localhost"
admin:
  user:
    - "admin@localhost"

  local:
    user_regexp: ""
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128

auth_method: sql
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "admin"
sql_password: "1234"

access_rules:
  local:
    allow: local
  c2s:
    deny: blocked
    allow: all
  announce:
    allow: admin
  configure:
    allow: admin
  muc_create:
    allow: local
  pubsub_createnode:
    allow: local
  trusted_network:
    allow: loopback```

## Errors from error.log/crash.log

2024-07-15 13:55:22.495834+10:00 [info] <0.386.0>@ejabberd_listener:accept/7:273 (<0.822.0>) Accepted connection [::ffff:127.0.0.1]:43438 -> [::ffff:127.0.0.1]:5280
2024-07-15 13:55:22.496649+10:00 [info] <0.386.0>@ejabberd_listener:accept/7:273 (<0.823.0>) Accepted connection [::ffff:127.0.0.1]:43450 -> [::ffff:127.0.0.1]:5280
2024-07-15 14:06:01.549926+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting TCP connections at [::]:5222 for ejabberd_c2s
2024-07-15 14:06:01.550056+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting TLS connections at [::]:5223 for ejabberd_c2s
2024-07-15 14:06:01.550121+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting TCP connections at [::]:5269 for ejabberd_s2s_in
2024-07-15 14:06:01.550208+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting TLS connections at [::]:5443 for ejabberd_http
2024-07-15 14:06:01.550283+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting TLS connections at [::]:5280 for ejabberd_http
2024-07-15 14:06:01.550383+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting UDP connections at [::]:3478 for ejabberd_stun
2024-07-15 14:06:01.550486+10:00 [info] <0.123.0>@ejabberd_listener:stop_listener/3:405 Stop accepting TCP connections at [::]:1883 for mod_mqtt
2024-07-15 14:06:01.555684+10:00 [info] <0.123.0>@ejabberd_app:stop/1:111 ejabberd 23.01-1 is stopped in the node ejabberd@localhost

## Bug description

When I visit http://localhost:5280/admin/ and register as admin, i see the message on this web site, that i don't have administration rights. I've changed my /etc/ejabberd/ejabberd.yml to have such rights, but it doesn't work anyway
badlop commented 4 months ago

ejabberd version: 18.09

Are you really using that ejabberd version?

You only provide some parts of your configuration file, but forget the important ones: acl, access_rules and api_permissions.

And the few lines that you copied, apparently are wrongly copied or wrongly set.

This configuration will work:

acl:
  admin:
    user: admin@localhost

access_rules:
  configure:
    allow: admin

api_permissions:
  "webadmin":
    from: ejabberd_web_admin
    who: admin
    what: "*"
licaon-kter commented 4 months ago

The log says "starting 23.01"

ArsiKbArsikLR commented 4 months ago

I fixed my configuration file:


  admin:
     user:
       - "admin@localhost"

  local:
    user_regexp: ""
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128

auth_method: sql
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "admin"
sql_password: "1234"

access_rules:
  configure:
    allow: admin

api_permissions:
  "webadmin":
    from: ejabberd_web_admin
    who: admin
    what: "*"
  "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``` 

But anyway nothing has changed.
badlop commented 4 months ago

If your current instalaltion doesn't work at all, you can try this:

  1. Uninstall ejabberd
  2. Delete all the ejabberd binaries, configuration files, mnesia spool directory... everything you have installed for ejabberd, or that ejabberd may have created
  3. Download ejabberd 24.07
  4. Install it
  5. Start it
  6. Does it start correctly?
  7. Register an account, can you login with it to the WebAdmin?
  8. Then make 1 small change in the configuration. For example, put your desired server name in the hosts option. Restart ejabberd. Does everything work perfectly?
  9. Then do another small change in the configuration. Restart ejabberd, Test it works

If something does not work, please explain in what step number did you find the problem, and all the changes you made to the configuration file.

ArsiKbArsikLR commented 4 months ago

Thank you so much. Now everything is working!