0

After updating from image 20.04 to 21.04 I wasnt able to start a bosh sessions anymore, after that i rolled the image back to 20.04 and I still unable to start the session.

Heres the logs with my info obscured

jabberd_1  | 2021-06-04 16:36:38.974369+00:00 [debug] Incoming data: <<"<body content=\"text/xml; charset=utf-8\" hold=\"1\" rid=\"718823993\" to=\"**host**\" ver=\"1.6\" wait=\"59\" xml:lang=\"en\" xmlns=\"http://jabber.org/protocol/httpbind\" xmlns:xmpp=\"urn:xmpp:xbosh\" xmpp:version=\"1.0\"/>">>
ejabberd_1  | 2021-06-04 16:36:38.991090+00:00 [error] Failed to start BOSH session: {error,
ejabberd_1  |                                {noproc,
ejabberd_1  |                                 {gen_server,call,
ejabberd_1  |                                  [mod_bosh_mnesia,
ejabberd_1  |                                   {write,
ejabberd_1  |                                    {bosh,
ejabberd_1  |                                     <<"8beb6dd0e59106b7d3e141b1e07e3f41319f0d81">>,
ejabberd_1  |                                     {1622,824598,990924},
ejabberd_1  |                                     <0.687.0>}},
ejabberd_1  |                                   600000]}}}
ejabberd_1  | 2021-06-04 16:36:38.992080+00:00 [debug] Send error reply:{body,<<"Failed to start BOSH session">>,
ejabberd_1  |                        [{type,<<"terminate">>},
ejabberd_1  |                         {condition,<<"internal-server-error">>}],
ejabberd_1  |                        [],0}
ejabberd_1  | ** Receiced body: {body,<<>>,
ejabberd_1  |                         [{'xmpp:version',<<"1.0">>},
ejabberd_1  |                          {<<"xml:lang">>,<<"en">>},
ejabberd_1  |                          {wait,59},
ejabberd_1  |                          {ver,<<"1.6">>},
ejabberd_1  |                          {to,<<"**host**">>},
ejabberd_1  |                          {rid,718823993},
ejabberd_1  |                          {hold,1},
ejabberd_1  |                          {<<"content">>,<<"text/xml; charset=utf-8">>},
ejabberd_1  |                          {<<"xmlns:xmpp">>,<<"urn:xmpp:xbosh">>}],
ejabberd_1  |                         [],219}
ejabberd_1  | 2021-06-04 16:36:38.990975+00:00 [error] CRASH REPORT:
ejabberd_1  |   crasher:
ejabberd_1  |     initial call: ejabberd_bosh:init/1
ejabberd_1  |     pid: <0.687.0>
ejabberd_1  |     registered_name: []
ejabberd_1  |     exception exit: {noproc,
ejabberd_1  |                         {gen_server,call,
ejabberd_1  |                             [mod_bosh_mnesia,
ejabberd_1  |                              {write,
ejabberd_1  |                                  {bosh,
ejabberd_1  |                                      <<"8beb6dd0e59106b7d3e141b1e07e3f41319f0d81">>,
ejabberd_1  |                                      {1622,824598,990924},
ejabberd_1  |                                      <0.687.0>}},
ejabberd_1  |                              600000]}}
ejabberd_1  |       in function  p1_fsm:init_it/6 (/ejabberd/deps/p1_utils/src/p1_fsm.erl, line 392)
ejabberd_1  |     ancestors: ['mod_bosh_**host**',ejabberd_gen_mod_sup,
ejabberd_1  |                   ejabberd_sup,<0.126.0>]
ejabberd_1  |     message_queue_len: 0
ejabberd_1  |     messages: []
ejabberd_1  |     links: [<0.523.0>]
ejabberd_1  |     dictionary: []
ejabberd_1  |     trap_exit: false
ejabberd_1  |     status: running
ejabberd_1  |     heap_size: 987
ejabberd_1  |     stack_size: 27
ejabberd_1  |     reductions: 572
ejabberd_1  |   neighbours:
ejabberd_1  | 
ejabberd_1  | 2021-06-04 16:36:39.006465+00:00 [debug] Running hook c2s_closed: mod_stream_mgmt:c2s_closed/2
ejabberd_1  | 2021-06-04 16:36:39.006636+00:00 [debug] Running hook c2s_closed: ejabberd_c2s:process_closed/2
ejabberd_1  | 2021-06-04 16:36:39.006787+00:00 [debug] Running hook c2s_terminated: mod_stream_mgmt:c2s_terminated/2
ejabberd_1  | 2021-06-04 16:36:39.006905+00:00 [debug] Running hook c2s_terminated: mod_pubsub:on_user_offline/2
ejabberd_1  | 2021-06-04 16:36:39.007021+00:00 [debug] Running hook c2s_terminated: ejabberd_c2s:process_terminated/2

And heres the ejabberd.yml

###
### ejabberd configuration file
### The parameters used in this configuration file are explained at
### https://docs.ejabberd.im/admin/configuration
### The configuration file is written in YAML.
### *******************************************************
### *******             !!! WARNING !!!             *******
### *******      YAML IS INDENTATION SENSITIVE      *******
### ******* MAKE SURE YOU INDENT SECTIONS CORRECTLY *******
### *******************************************************
### Refer to http://en.wikipedia.org/wiki/YAML for the brief description.
###

auth_method: [external]
auth_use_cache: false
extauth_program: /home/ejabberd/conf/login.py
extauth_pool_size: 1

sql_type: pgsql
sql_server: 'postgres'
sql_database: 'ejabberd'
sql_username: 'ejabberd'
sql_password: 'ejabberd'
sql_port: 5432

allow_multiple_connections: true

default_db: sql

#auth_password_format: scram

hosts:
  - '**host**'

loglevel: debug

certfiles:
 - '/home/ejabberd/conf/server.pem'

ca_file: '/home/ejabberd/conf/cacert.pem'

listen:
  -
    port: 5222
    ip: '::'
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    starttls_required: true
  -
    port: 5443
    ip: '::'
    module: ejabberd_http
    tls: true
    request_handlers:
      /admin: ejabberd_web_admin
      /api: mod_http_api
      /bosh: mod_bosh
      /captcha: ejabberd_captcha
      /upload: mod_http_upload
      /ws: ejabberd_http_ws
  -
    port: 5444
    ip: '::'
    module: ejabberd_http
    request_handlers:
      /admin: ejabberd_web_admin
      /api: mod_http_api
      /bosh: mod_bosh
      /captcha: ejabberd_captcha
      /upload: mod_http_upload
      /ws: ejabberd_http_ws

s2s_use_starttls: optional

acl:
  local:
    user_regexp: ''
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128
  admin:
    user:
      - 'admin': '**host**'
      - 'usr1': '**host**'
      - 'usr2': '**host**'
      - 'usr3': '**host**'

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

api_permissions:
  'api':
    who:
      ip: '10.0.1.42/8'
    what:
      - '*'
  'console commands':
    from:
      - mod_http_api 
      - 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

shaper:
  normal:
    rate: 3000
    burst_size: 20000
  fast: 100000

shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    5000: admin
    100: all
  c2s_shaper:
    none: admin
    normal: all
  s2s_shaper: fast

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce:
    access: announce
  mod_avatar: {}
  mod_blocking: {}
  mod_bosh: {}
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {}
  mod_disco: {}
  mod_fail2ban: {}
  mod_http_api: {}
  mod_http_upload:
    put_url: https://@HOST@:5444/upload
    docroot: /home/ejabberd/upload
    custom_headers:
      "Access-Control-Allow-Origin": "*" # voltar para "https://@HOST@"
      "Access-Control-Allow-Methods": "GET,HEAD,PUT,OPTIONS"
      "Access-Control-Allow-Headers": "Content-Type"
  mod_last: {}
  mod_mam:
    ## Mnesia is limited to 2GB, better to use an SQL backend
    ## For small servers SQLite is a good fit and is very easy
    ## to configure. Uncomment this when you have SQL configured:
    ## db_type: sql
    assume_mam_usage: true
    default: always
  mod_mqtt: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      allow_user_invites: true
      anonymous: false
      max_users: 2000
      mam: true
      members_only: true
      moderated: false
      persistent: true
      public: false
    max_users: 2000
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_proxy65:
    access: local
    max_connections: 5
  mod_pubsub:
    access_createnode: pubsub_createnode
    plugins:
      - flat
      - pep
    force_node_config:
      ## Avoid buggy clients to make their bookmarks public
      storage:bookmarks:
        access_model: whitelist
  mod_push: {}
  mod_push_keepalive: {}
  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
  mod_roster:
    store_current_id: false
    versioning: false
  mod_s2s_dialback: {}
  mod_shared_roster:
    use_cache: false
  mod_stream_mgmt:
    resend_on_timeout: if_offline
  mod_stun_disco: {}
  mod_vcard:
    search: true
  mod_vcard_xupdate: {}
  mod_version:
    show_os: false

### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8

Can somebody help me?

EDIT: I was actually using the 20.04.02 image but it was tagged as latest locally, it seems that this image is not on the repository anymore. I got it working again using the image that now is untagged(20.04.02) but using the 20.04 one doesnt work. I still want to update, if anyone would be kind to guide me in what I did wrong.

1 Answers1

0

In a quick look to your configuration, I see nothing strange or obviously wrong.

This is how I setup ejabberd 21.04 using docker. And BOSH can be used correctly. The only big difference is that you use external auth instead of internal. Here are my scripts, in case they give you some clue about your problem. Or you can try them.

If you try my docker-compose.yml file, remember to replace ../../ejabberd/sql/pg.sql with the path to the ejabberd's pg.sql file, and replace ./conf/ejabberd.yml.database.yml with the path to your ejabberd configuration file:

version: '3.7'

services:

  main:
    hostname: main
    container_name: main
    image: ejabberd/ecs:21.04
    depends_on:
      pgsql:
        condition: service_healthy
    environment:
      - CTL_ON_CREATE=register admin pgsql.localhost asd ;
                      register user1pg pgsql.localhost asd
      - CTL_ON_START=stats registeredusers ;
                     status
    command: ["foreground"]
    healthcheck:
      test: netstat -nl | grep -q 5443
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 120
    ports:
      - "5280:5280"
      - "5443:5443"
    volumes:
      - ./conf/ejabberd.yml.database.yml:/home/ejabberd/conf/ejabberd.yml:ro

  pgsql:
    image: postgres:latest
    container_name: pgsql
    healthcheck:
      test: pg_isready -U $$POSTGRES_USER
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - ../../ejabberd/sql/pg.sql:/docker-entrypoint-initdb.d/pg.sql:ro
    environment:
      POSTGRES_PASSWORD: ejabberd_test
      POSTGRES_USER: ejabberd_test
      POSTGRES_DB: ejabberd_test

  adminer:
    image: adminer
    container_name: adminer
    restart: always
    depends_on:
      pgsql:
        condition: service_healthy
      main:
        condition: service_healthy
    ports:
      - 8080:8080

ejabberd.yml

hosts:
  - pgsql.localhost

host_config:
  pgsql.localhost:
    sql_port: 5432
    sql_type: pgsql
    sql_server: "pgsql"
    sql_database: "ejabberd_test"
    sql_username: "ejabberd_test"
    sql_password: "ejabberd_test"
    sql_pool_size: 1
    auth_method: sql
    default_db: sql

loglevel: 4
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100

certfiles:
  - /home/ejabberd/conf/server.pem

ca_file: "/home/ejabberd/conf/cacert.pem"

listen:
  -
    port: 5443
    ip: "::"
    module: ejabberd_http
    tls: true
    request_handlers:
      "/admin": ejabberd_web_admin
      "/bosh": mod_bosh
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/admin": ejabberd_web_admin

s2s_use_starttls: optional

acl:
  local:
    user_regexp: ""
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128
      - ::FFFF:127.0.0.1/128
  admin:
    user:
      - "admin@pgsql.localhost"

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

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

shaper:
  normal: 1000
  fast: 50000

shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    5000: admin
    100: all
  c2s_shaper:
    none: admin
    normal: all
  s2s_shaper: fast

max_fsm_queue: 10000

acme:
   contact: "mailto:example-admin@example.com"
   ca_url: "https://acme-v01.api.letsencrypt.org"

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce:
    access: announce
  mod_avatar: {}
  mod_blocking: {}
  mod_bosh: {}
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {}
  mod_disco: {}
  mod_fail2ban: {}
  mod_http_api: {}
  mod_http_upload:
    put_url: https://@HOST@:5443/upload
  mod_last: {}
  mod_mam:
    ## Mnesia is limited to 2GB, better to use an SQL backend
    ## For small servers SQLite is a good fit and is very easy
    ## to configure. Uncomment this when you have SQL configured:
    ## db_type: sql
    assume_mam_usage: true
    default: never
  mod_mqtt: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      mam: false
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_proxy65:
    access: local
    max_connections: 5
  mod_pubsub:
    access_createnode: pubsub_createnode
    plugins:
      - flat
      - pep
    force_node_config:
      ## Avoid buggy clients to make their bookmarks public
      storage:bookmarks:
        access_model: whitelist
  mod_push: {}
  mod_push_keepalive: {}
  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
  mod_roster:
    versioning: true
  mod_sip: {}
  mod_s2s_dialback: {}
  mod_shared_roster: {}
  mod_stream_mgmt:
    resend_on_timeout: if_offline
  mod_vcard: {}
  mod_vcard_xupdate: {}
  mod_version:
    show_os: false

### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8

Once created those files, sudo docker-compose up, and you should be able to login to the user1pg@pgsql.localhost account using BOSH url https://localhost:5443/bosh/

Badlop
  • 580
  • 3
  • 5