question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Anonymous login not working with ejabberd using HttpBind

See original GitHub issue

The following is my loading config file:

<script>
		converse.initialize({
			bosh_service_url: 'http://localhost:5280/http-bind/',
			keepalive: true,
			message_carbons: true,
			play_sounds: true,
			roster_groups: false,
			show_controlbox_by_default: false,
			xhr_user_search: false,
			allow_bookmarks: false,
			allow_contact_removal: false,
			allow_contact_requests: false,
			allow_muc: false,
			allow_muc_invitations: false,
			allow_registration: false,
			auto_list_rooms: false,
			auto_login: true,
			jid: 'guest@localhost',
			password: 'guest',
			authentication: 'anonymous',
			auto_reconnect: true
		});
	</script>

I am able to login anonymously using pidgin client on port 5222, but its not working with converse,js. It keeps showing connecting…

If i change the “authentication : ‘login’” and provided existing user credentials, it works fine and logs in automatically.

The following is my ejabberd config file:

hosts:
  - "localhost"

listen:
  - 
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    starttls: true
    certfile: 'CERTFILE'
    protocol_options: 'TLSOPTS'

    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
  - 
    port: 5269
    ip: "::"
    module: ejabberd_s2s_in
    max_stanza_size: 131072
    shaper: s2s_shaper
  - 
    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/websocket": ejabberd_http_ws
      "/api": mod_http_api
      "/web": mod_http_fileserver
    web_admin: true
    http_bind: true
    http_poll: true	
    register: false
    captcha: false

auth_method:
       - internal
       - anonymous
anonymous_protocol: both
allow_multiple_connections: true

acl:
  admin:
    user:
      - "sharat@localhost"
	  
  local:
    user_regexp: ""

  loopback:
    ip:
      - "127.0.0.0/8"

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

###'  ACCESS RULES
access_rules:
  ## This rule allows access only for local users:
  local:
    - allow: local
  ## Only non-blocked users can use c2s connections:
  c2s:
    - deny: blocked
    - allow
  ## Only admins can send announcement messages:
  announce:
    - allow: admin
  ## Only admins can use the configuration interface:
  configure:
    - allow: admin
  ## Only accounts of the local ejabberd server can create rooms:
  muc_create:
    - allow: all
  ## Only accounts on the local ejabberd server can create Pubsub nodes:
  pubsub_createnode:
    - allow: local
  ## In-band registration allows registration of any possible username.
  ## To disable in-band registration, replace 'allow' with 'deny'.
  register:
    - allow
  ## Only allow to register from localhost
  trusted_network:
    - allow: loopback
  
api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who:
      - access:
          - allow:
            - ip: "127.0.0.1/8"
            - acl: admin
      - oauth:
        - scope: "ejabberd:admin"
        - access:
          - allow:
              - ip: "127.0.0.1/8"
              - acl: admin
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who:
      - ip: "127.0.0.1/8"
    what:
      - "status"
      - "connected_users_number"

language: "en"

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce: # recommends mod_adhoc
    access: announce
  mod_blocking: {} # requires mod_privacy
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {} # requires mod_adhoc

  mod_disco: {}
  mod_bosh: {}
  mod_http_fileserver:
     docroot: "C:/ProgramData/ejabberd/www"
     accesslog: "C:/Program Files/ejabberd-17.04/logs/access.log"
  mod_last: {}
  mod_muc:
    host: "conference.localhost"
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
  mod_muc_admin: {}
  mod_muc_log: {}

  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_pubsub:
    access_createnode: pubsub_createnode
    ## reduces resource comsumption, but XEP incompliant
    ignore_pep_from_offline: true
    ## XEP compliant, but increases resource comsumption
    ## ignore_pep_from_offline: false
    last_item_cache: false
    plugins:
      - "flat"
      - "pep" # pep requires mod_caps
  mod_register:
    welcome_message:
      subject: "Welcome!"
      body: |-
        Hi.
        Welcome to this XMPP server.
    ip_access: trusted_network
    access: register
  mod_roster: {}
  mod_shared_roster: {}
  mod_vcard:
    search: false
  mod_version: {}
  mod_stream_mgmt: {}
  mod_s2s_dialback: {}
  mod_http_api: {}

allow_contrib_modules: true

I am new to both converse.js and ejabberd. Any help would be great. Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sinsharatcommented, Apr 24, 2017

@jcbrand Thank you so much for your input. it worked. I had one more question, I wanted to have a chat window open of an admin, (say admin@localhost for every user) instead of a complete chat display with no contact, so that the user can directly chat with the admin. Something similar to your anonymous chat room example. But instead of the chat room i wanted to show for chat user. Is that possible with current implementation. Thanks!

0reactions
sinsharatcommented, Apr 24, 2017

@jcbrand ok Thanks will look into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Anonymous Login Not Authorized | ejabberd
I'm using the Psi Client and JWChat installed on the server. Both will login if an account exists..but I'm getting Authentication Failed if ......
Read more >
trouble setting up anonymous login in ejabberd - Stack Overflow
And finally, the room name in local_settings.js of speeqe had to have the chat server as well: alpha@conference.domain.com (and not ...
Read more >
[BOSH] Enabling ANONYMOUS login support in ejabberd server
Now I am able to login anonymously using any username and without a password, but i am having trouble sending messages to the...
Read more >
Anonymous Login - Google Groups
I was able to make Candy work and run with ejabberd, and now I want to connect an anonymous user, but I get...
Read more >
ejabberd getting 404 Not Found at /http-bind - Server Fault
Check how you configure. If you tell ejabberd to listen in path /bosh , then that's the URL you must use. For example:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found