processone / ejabberd

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

Hook adhoc_local_items crashed when running mod_announce:announce_items #3466

Open FathiBenNasr opened 3 years ago

FathiBenNasr commented 3 years ago

Environment

Configuration

access_rules: announce_access:

Errors from error.log/crash.log

2021-01-03 21:02:28.268 [info] <0.675.0>@ejabberd_c2s:bind:442 (tls|<0.675.0>) Opened c2s session for ftou7@competenceslinux.com/39372597113298864541234 2021-01-03 21:02:28.521 [error] <0.675.0>@ejabberd_hooks:safe_apply:240 Hook disco_local_items crashed when running mod_announce:disco_items/5: exception error: {module_not_loaded,mod_announce,<<"conf.tn">>} in function gen_mod:get_module_opts/2 (src/gen_mod.erl, line 338) in call from gen_mod:get_module_opt/3 (src/gen_mod.erl, line 318) in call from mod_announce:disco_items/5 (src/mod_announce.erl, line 319) in call from ejabberd_hooks:safe_apply/4 (src/ejabberd_hooks.erl, line 236) in call from ejabberd_hooks:run_fold1/4 (src/ejabberd_hooks.erl, line 217) in call from mod_disco:process_local_iq_items/1 (src/mod_disco.erl, line 143) in call from gen_iq_handler:process_iq/3 (src/gen_iq_handler.erl, line 131) in call from gen_iq_handler:process_iq/4 (... Arg 1 = empty Arg 2 = {jid,<<"ftou7">>,<<"competenceslinux.com">>,<<"39372597113298864541234">>,<<"ftou7">>,<<"competenceslinux.com">>,<<"39372597113298864541234">>} Arg 3 = {jid,<<>>,<<"competenceslinux.com">>,<<>>,<<>>,<<"competenceslinux.com">>,<<>>} Arg 4 = <<>> Arg 5 = <<"fr">> 2021-01-03 21:02:28.681 [error] <0.675.0>@ejabberd_hooks:safe_apply:240 Hook disco_local_features crashed when running mod_announce:disco_features/5: exception error: {module_not_loaded,mod_announce,<<"conf.tn">>} in function gen_mod:get_module_opts/2 (src/gen_mod.erl, line 338) in call from gen_mod:get_module_opt/3 (src/gen_mod.erl, line 318) in call from mod_announce:disco_features/5 (src/mod_announce.erl, line 271) in call from ejabberd_hooks:safe_apply/4 (src/ejabberd_hooks.erl, line 236) in call from ejabberd_hooks:run_fold1/4 (src/ejabberd_hooks.erl, line 217) in call from mod_disco:process_local_iq_info/1 (src/mod_disco.erl, line 163) in call from gen_iq_handler:process_iq/3 (src/gen_iq_handler.erl, line 131) in call from gen_iq_handler:process_iq/... Arg 1 = empty Arg 2 = {jid,<<"ftou7">>,<<"competenceslinux.com">>,<<"39372597113298864541234">>,<<"ftou7">>,<<"competenceslinux.com">>,<<"39372597113298864541234">>} Arg 3 = {jid,<<>>,<<"competenceslinux.com">>,<<>>,<<>>,<<"competenceslinux.com">>,<<>>} Arg 4 = <<>> Arg 5 = <<"fr">> 2021-01-03 21:02:29.228 [error] <0.675.0>@ejabberd_hooks:safe_apply:240 Hook disco_local_items crashed when running mod_announce:disco_items/5: exception error: {module_not_loaded,mod_announce,<<"conf.tn">>} in function gen_mod:get_module_opts/2 (src/gen_mod.erl, line 338) in call from gen_mod:get_module_opt/3 (src/gen_mod.erl, line 318) in call from mod_announce:disco_items/5 (src/mod_announce.erl, line 349) in call from ejabberd_hooks:safe_apply/4 (src/ejabberd_hooks.erl, line 236) in call from ejabberd_hooks:run_fold1/4 (src/ejabberd_hooks.erl, line 217) in call from mod_disco:process_local_iq_items/1 (src/mod_disco.erl, line 143) in call from gen_iq_handler:process_iq/3 (src/gen_iq_handler.erl, line 131) in call from gen_iq_handler:process_iq/4 (... Arg 1 = empty Arg 2 = {jid,<<"ftou7">>,<<"competenceslinux.com">>,<<"39372597113298864541234">>,<<"ftou7">>,<<"competenceslinux.com">>,<<"39372597113298864541234">>} Arg 3 = {jid,<<>>,<<"competenceslinux.com">>,<<>>,<<>>,<<"competenceslinux.com">>,<<>>} Arg 4 = <<"http://jabber.org/protocol/commands">> Arg 5 = <<"fr">>

Bug description

Sending messages works, sending images also, but admin account can't send announces or setup/change welcome message (pidgin menus not even chowing).

prefiks commented 3 years ago

Hello,

Could you show me your full config (or at least tell me if you have conf.tn in your host and separate config for that host?

prefiks commented 3 years ago

One more question, do you have host: "conf.tn" in your ejabber.yml but don't have conf.tn in hosts?

FathiBenNasr commented 3 years ago

Hello,

Could you show me your full config (or at least tell me if you have conf.tn in your host and separate config for that host?

Hello @prefiks, Here is the beginning of my ejabberd.yml

language: "fr"
hosts:
  - "conf.tn"
  - "competenceslinux.com"
##  - "sncftwifi.eu.org"

loglevel: 4
log_rotate_size: 10485760
log_rotate_count: 1

certfiles:
  - "/opt/ejabberd/conf/privkey.pem"
  - "/opt/ejabberd/conf/fullchain.pem"

host_config:
  "conf.tn":
    access_rules:
      trusted_network:
        - allow: all
    modules:
      mod_register:
        ## Only accept registration requests from the "trusted"
        ## network (see access_rules section above).
        ## Think twice before enabling registration from any
        ## address. See the Jabber SPAM Manifesto for details:
        ## https://github.com/ge0rg/jabber-spam-fighting-manifesto
        ip_access: trusted_network
        welcome_message:
          subject: "Bienvenue !"
          body: |-
            Bonjour,
            Bienvenue sur notre serveur de communications unifiées.
            Nous utilisons la même technologie que les plus grands noms de l'Internet sans vous espionner et tout en respectant vos données à caractère personnel.
            Installez-vous confortablement.
            Vous roulez en Rolls.
        registration_watchers:
          - "superadmin@conf.tn"
        redirect_url: "https://conf.tn/register"
      mod_register_web: {}
prefiks commented 3 years ago

Thank you, so it looks like conf.tn doesn't have mod_announce enabled (there is no entry in modules in host_config for that host), and that confuses this module. You can workaround that problem by changing placing "competenceslinux.com" as first in hosts, but i'll try to prepare proper fix for this problem.

FathiBenNasr commented 3 years ago

Thank you, so it looks like conf.tn doesn't have mod_announce enabled (there is no entry in modules in host_config for that host), and that confuses this module. You can workaround that problem by changing placing "competenceslinux.com" as first in hosts, but i'll try to prepare proper fix for this problem.

I thought having an entire modules section outside host_config means it applies site wide. I have mod_announce in the site wide config as shown here after.

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce:
    access: announce_access
  mod_avatar: {}
  mod_blocking: {}
  mod_bosh: {}
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state:
    queue_chat_states: true
    queue_pep: false
    queue_presence: true
  mod_configure: {}
  mod_sip: {}
  mod_time: {}
  mod_disco:
    server_info:
    -
      modules: all
      name: "abuse-addresses"
      urls: ["mailto:fbennasr@competenceslinux.com"]
  mod_stun_disco:
    credentials_lifetime: 12h
    services:
      -
        host: 51.254.33.96
        port: 3478
        type: stun
        transport: udp
        restricted: false
      -
        host: 51.254.33.96
        port: 3478
        type: turn
        transport: udp
        restricted: true
      -
        host: xmpp.conf.tn
        port: 5349
        type: stuns
        transport: tcp
        restricted: false
      -
        host: xmpp.conf.tn
        port: 5349
        type: turns
        transport: tcp
        restricted: true
  mod_fail2ban: {}
  mod_http_api: {}
  mod_http_upload:
    access: local
    max_size: 250000000 #250 MByte
    thumbnail: false
    file_mode: "0644"
    dir_mode: "0744"
    rm_on_unregister: true
    custom_headers:
      "Access-Control-Allow-Origin": "https://@HOST@"
      "Access-Control-Allow-Methods": "HEAD, PATCH, DELETE, PUT, GET, POST, DELETE, OPTIONS"
      "Access-Control-Allow-Headers": "Content-Type, Origin, X-Requested-With, Accept"
    get_url: "https://uploads.convergent.tn/ejabberd/@HOST@"
    put_url: "https://uploads.convergent.tn/ejabberd/@HOST@"
    external_secret: "removed from comment"
  mod_last:
    use_cache: true
    db_type: sql
  mod_mam:
    assume_mam_usage: true
    default: always
    use_cache: true
    db_type: sql
    compress_xml: true
  mod_mqtt: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    db_type: sql
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      mam: true
      allow_private_messages: true
      allow_private_messages_from_visitors: moderators
      allow_query_users: true
      allow_user_invites: true
      allow_visitor_nickchange: true
      allow_visitor_status: true
      anonymous: true
      members_by_default: true
      members_only: true
      moderated: false
      password_protected: false
      captcha_protected: true
      persistent: true
      presence_broadcast: [moderator, participant, visitor]
      public: false
      public_list: false
  mod_muc_admin: {}
  mod_offline:
    db_type: sql
    store_empty_body: true
    access_max_user_messages: max_user_offline_messages
  mod_ping:
    send_pings: true
    ping_interval: 60
    ping_ack_timeout: 32
  mod_privacy:
    db_type: sql
    use_cache: true
  mod_private:
    db_type: sql
    use_cache: true
  mod_proxy65:
    host: proxy.conf.tn
    hostname: proxy.conf.tn
    name: "File Transfer Proxy"
    ip: 51.254.33.96
    port: 7777
    ram_db_type: redis
    hosts: [proxy.@HOST@,51.254.33.96,'2001:41d0:401:3000::200d','2001:470:1f15:119e::1',51.83.124.98,'2001:470:1f14:119e::2']
    access: local
    shaper: proxy65_shaper
    recbuf: 10240
    sndbuf: 10240
    max_connections: 50
  mod_pubsub:
    access_createnode: pubsub_createnode
    plugins:
      - "flat"
      - "pep"
    force_node_config:
      ## Change from "whitelist" to "open" to enable OMEMO support
      ## See https://github.com/processone/ejabberd/issues/2425
      "eu.siacs.conversations.axolotl.*":
        access_model: open
      ## Avoid buggy clients to make their bookmarks public
      "storage:bookmarks":
        access_model: whitelist
  mod_push:
    db_type: sql
    use_cache: true
    include_sender: true
    include_body: true
  mod_push_keepalive:
    resume_timeout: 259200
    wake_on_start: false
    wake_on_timeout: true
  mod_register:
    ## Only accept registration requests from the "trusted"
    ## network (see access_rules section above).
    ## Think twice before enabling registration from any
    ## address. See the Jabber SPAM Manifesto for details:
    ## https://github.com/ge0rg/jabber-spam-fighting-manifesto
    ip_access: trusted_network
    welcome_message:
      subject: "Bienvenue !"
      body: |-
        Bonjour,
        Bienvenue sur notre serveur de communications unifiées.
        Nous utilisons les mêmes technologies que les plus grands noms de l'Internet sans vous espionner et tout en respectant vos données à caractère personnel.
        Installez-vous confortablement.
        Vous roulez en Rolls.
    registration_watchers:
      - "fbennasr@competenceslinux.com"
      - "l_admin@conf.tn"
      - "ftou7@competenceslinux"
    redirect_url: "https://o2.tn/register"
    captcha_protected: true
  mod_register_web: {}
  mod_roster:
    versioning: true
    db_type: sql
    use_cache: true
    store_current_id: true
  mod_s2s_dialback: {}
  mod_shared_roster:
    db_type: sql
  mod_stream_mgmt:
    resend_on_timeout: if_offline
  mod_vcard:
    use_cache: true
    matches: 30
    allow_return_all: true
    db_type: sql
  mod_vcard_xupdate: {}
  mod_version:
    show_os: false
  mod_stats: {}
prefiks commented 3 years ago

There is append_host_config that allows doing that, host_config overrides global options,