Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1163812 - Cannot control ejabberd with ejabberdctl
Summary: Cannot control ejabberd with ejabberdctl
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ejabberd
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Randy Barlow
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-13 14:09 UTC by Juan Orti
Modified: 2018-07-04 16:05 UTC (History)
14 users (show)

Fixed In Version: ejabberd-16.09-4.fc26 ejabberd-16.09-4.fc25
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-11 00:28:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
ejabberd-ejabberdctl-fix.patch (506 bytes, patch)
2015-05-13 15:24 UTC, Frederik Holden
no flags Details | Diff

Description Juan Orti 2014-11-13 14:09:23 UTC
Description of problem:
After a clean install of ejabberd in Fedora 21, I cannot use the ejabberdctl utility to register users, etc.

I run:
# ejabberdctl register admin localhost password
Failed RPC connection to the node ejabberd@localhost: nodedown

Commands to start an ejabberd node:
  start  Start an ejabberd node in server mode
  debug  Attach an interactive Erlang shell to a running ejabberd node
  live   Start an ejabberd node in live (interactive) mode

Optional parameters when starting an ejabberd node:
  --config-dir dir   Config ejabberd:    /etc/ejabberd
  --config file      Config ejabberd:    /etc/ejabberd/ejabberd.yml
  --ctl-config file  Config ejabberdctl: /etc/ejabberd/ejabberdctl.cfg
  --logs dir         Directory for logs: /var/log/ejabberd
  --spool dir        Database spool dir: /var/lib/ejabberd
  --node nodename    ejabberd node name: ejabberd@localhost

And I see this in the log /var/log/ejabberd/ejabberd.log:

2014-11-13 14:57:30.188 [info] <0.7.0> Application lager started on node ejabberd@localhost
2014-11-13 14:57:30.257 [info] <0.7.0> Application sasl started on node ejabberd@localhost
2014-11-13 14:57:30.286 [info] <0.7.0> Application crypto started on node ejabberd@localhost
2014-11-13 14:57:30.354 [info] <0.7.0> Application asn1 started on node ejabberd@localhost
2014-11-13 14:57:30.354 [info] <0.7.0> Application public_key started on node ejabberd@localhost
2014-11-13 14:57:30.421 [info] <0.7.0> Application ssl started on node ejabberd@localhost
2014-11-13 14:57:30.450 [info] <0.7.0> Application p1_yaml started on node ejabberd@localhost
2014-11-13 14:57:30.482 [info] <0.7.0> Application p1_tls started on node ejabberd@localhost
2014-11-13 14:57:30.492 [info] <0.7.0> Application p1_xml started on node ejabberd@localhost
2014-11-13 14:57:30.498 [info] <0.7.0> Application p1_stringprep started on node ejabberd@localhost
2014-11-13 14:57:30.508 [info] <0.7.0> Application p1_zlib started on node ejabberd@localhost
2014-11-13 14:57:30.515 [info] <0.7.0> Application p1_cache_tab started on node ejabberd@localhost
2014-11-13 14:57:31.015 [info] <0.7.0> Application mnesia started on node ejabberd@localhost
2014-11-13 14:57:33.259 [info] <0.37.0>@cyrsasl_digest:start:57 FQDN used to check DIGEST-MD5 SASL authentication: charm.miceliux.com
2014-11-13 14:57:33.423 [info] <0.7.0> Application p1_iconv started on node ejabberd@localhost
2014-11-13 14:57:42.556 [info] <0.564.0>@ejabberd_listener:listen_tcp:194 Reusing listening port for 5222
2014-11-13 14:57:42.556 [info] <0.565.0>@ejabberd_listener:listen_tcp:194 Reusing listening port for 5269
2014-11-13 14:57:42.557 [info] <0.566.0>@ejabberd_listener:listen_tcp:194 Reusing listening port for 5280
2014-11-13 14:57:42.557 [info] <0.37.0>@ejabberd_app:start:69 ejabberd community is started in the node ejabberd@localhost
2014-11-13 14:57:42.557 [info] <0.7.0> Application ejabberd started on node ejabberd@localhost
2014-11-13 14:59:18.926 [error] <0.567.0> ** Connection attempt from disallowed node 'ejabberdctl-1@charm' **


Version-Release number of selected component (if applicable):
ejabberd-14.07-3.fc21.x86_64

How reproducible:
Always

Steps to Reproduce:
1. yum install ejabberd
2. systemctl start ejabberd
3. ejabberdctl register admin localhost password

Actual results:
Cannot register a user.

Expected results:
Register a user.

Additional info:

Comment 1 Chris Sharp 2015-03-07 14:25:53 UTC
In my case, it's doing *anything* with ejabberdctl - not just registering.

My steps on a clean installation of Fedora 21:

1. yum install ejabberd
2. systemctl start ejabberd.service
3. ejabberdctl status

[root@localhost ~]# ejabberdctl status
Failed RPC connection to the node ejabberd@localhost: nodedown

Commands to start an ejabberd node:
  start  Start an ejabberd node in server mode
  debug  Attach an interactive Erlang shell to a running ejabberd node
  live   Start an ejabberd node in live (interactive) mode

Optional parameters when starting an ejabberd node:
  --config-dir dir   Config ejabberd:    /etc/ejabberd
  --config file      Config ejabberd:    /etc/ejabberd/ejabberd.yml
  --ctl-config file  Config ejabberdctl: /etc/ejabberd/ejabberdctl.cfg
  --logs dir         Directory for logs: /var/log/ejabberd
  --spool dir        Database spool dir: /var/lib/ejabberd
  --node nodename    ejabberd node name: ejabberd@localhost

/var/log/ejabberd/error.log:

2015-03-07 09:18:31.948 [error] <0.562.0> ** Connection attempt from disallowed node 'ejabberdctl-1@localhost' **

There are hints from possibly related issues from ejabberd support that point to .erlang.cookie mismatches - that's the current rabbit I'm chasing down the hole...

Comment 2 cds 2015-03-09 03:34:42 UTC
Not a fix, but temporary workaround is to 'stop' ejabberd via systemctl and start ejabberd via ejabberdctl.
e.g.,
$ sudo systemctl stop ejabberd
$ sudo ejabberdctl start ejabberd
$ sudo ejabberdctl register user host pass

Comment 3 Juan Orti 2015-04-21 12:53:34 UTC
This bug is also present in Fedora 22. Any progress?

Comment 4 Paul Wouters 2015-05-13 14:50:06 UTC
upgrading f19 to f22 also caused my jabber server to reject everything

ejabberd-14.07-6.fc22.x86_64

Comment 5 Paul Wouters 2015-05-13 14:54:22 UTC
my problem was that I ended up with /etc/ejabberd/ejabberd.cfg.rpmnew and  /etc/ejabberd/ejabberd.cfg.rpmsave without leaving any  /etc/ejabberd/ejabberd.cfg

I copied my rpmsave back and then ejabberd started working again.

Comment 6 Frederik Holden 2015-05-13 15:24:54 UTC
Created attachment 1025103 [details]
ejabberd-ejabberdctl-fix.patch

The problem with ejabberdctl being denied connection seems to be related to the .erlang.cookie file. I made a small change to ejabberdctl that fixed this. See the attached file.

Comment 7 Jerry C 2015-05-15 10:03:09 UTC
comment 2 didn't work for me
comment 5 doesn't even make sense, since the new config format is the yml format
editing ejabberdctl as suggested in comment6 worked for me.

I did however lose my user database after upgrading and had to re-create all users.

Comment 8 Paul Wouters 2015-06-04 21:45:55 UTC
it seems my #5 comment was pidgin oddly and false claiming i had logged in. Indeed it never worked.

I spend too much time in trying to get the new config file to work. It would never fully start allowing client login. I even ended up installing a fresh new fedora19 server to load the /etc/ejabberd and /var/lib/ejabberd data onto, but that failed as well some error about Error reading Mnesia database

so my ejabberd data is no good on old or new versions. I finally gave up and declared a loss of my buddy list and went with the recommend jabber server prosody. Too bad the prosody migration scripts needed a dump made by ejabberctl that it is not able to do on the f22 or the f19 server :P

Comment 9 Carl-Johan Schenström 2015-06-09 22:42:54 UTC
I just upgraded from FC20 (ejabberd-2.1.13-7.fc20.x86_64) to FC22 (ejabberd-14.07-6.fc22.x86_64), which broke ejabberd in the following ways:

1. The configuration file wasn't converted, only saved as /etc/ejabberd/ejabberd.cfg.rpmsave. Possibly connected to #2, since "ejabberdctl convert_to_yaml" is used for converting.

2. .erlang.cookie mismatch. Solved this one by copying /var/lib/ejabberd/.erlang.cookie to my home directory. Converted configuration file as in #1.

3. All users gone. Copied /var/lib/ejabberd/spool to the same directory on another FC20 host, mucked about with hostnames, dumped the data with "ejabberdctl dump", copied it back to the FC22 host, loaded it with "ejabberdctl load" and restarted the service. Using "ejabberdctl backup" and "ejabberdctl restore" didn't work, since the database schema is different.

Comment 10 Jan Kurik 2016-07-26 04:33:06 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 11 Randy Barlow 2016-11-27 16:55:28 UTC
I submitted a patch that was inspired by Frederik Holden's patch upstream:

https://github.com/processone/ejabberd/pull/1395

That patch seems to work on my ejabberd box, so I think I will apply it as is for now while we wait on upstream to decide how they want to proceed with my proposal.

Comment 12 Randy Barlow 2016-11-27 18:05:30 UTC
A workaround that I've been using is to use sudo to execute ejabberdctl as the ejabberd user. For example:

$ sudo -u ejabberd /usr/bin/sh /usr/bin/ejabberdctl <args>

It's not pretty, but it does work!

Comment 13 Fedora Update System 2016-11-28 01:00:55 UTC
ejabberd-16.09-3.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-69b7266f39

Comment 14 Fedora Update System 2016-11-28 09:37:08 UTC
ejabberd-16.09-3.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-69b7266f39

Comment 15 Randy Barlow 2016-11-28 14:32:55 UTC
I learned that the erlang cookie is a bit like a password (I had thought it was just the id of the node the user wants to connect to). Thus it should not be passed with -set-cookie because we don't want it to appear in the process table. Thus I will have to solve this another way.

Comment 16 Fedora Update System 2016-12-01 17:15:53 UTC
ejabberd-16.09-4.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-89b50bf88a

Comment 17 Randy Barlow 2016-12-01 17:17:14 UTC
I fixed this by setting the INSTALLUSER variable in ejabberdctl and patching it to use bash when executing erl with su.

Comment 18 Fedora Update System 2016-12-03 04:35:28 UTC
ejabberd-16.09-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-89b50bf88a

Comment 19 Fedora Update System 2016-12-11 00:28:55 UTC
ejabberd-16.09-4.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 stephane de Labrusse 2018-07-04 16:05:28 UTC
I hit this big on centos7 and ejabberd-18.06, I solved it in my case by this systemd script :

# /usr/lib/systemd/system/ejabberd.service
[unit]
Description=XMPP Server
After=network.target

[Service]
Type=forking
User=ejabberd
Group=ejabberd
LimitNOFILE=65536
Restart=on-failure
RestartSec=5
Environment=LOGS_DIR=/var/log/ejabberd 
Environment=EJABBERD_CONFIG_PATH=/etc/ejabberd/ejabberd.yml 
Environment=SPOOL_DIR=/var/lib/ejabberd
ExecStart=/bin/sh -c '/opt/ejabberd-18.06/bin/ejabberdctl start && /opt/ejabberd-18.06/bin/ejabberdctl started'
ExecStop=/bin/sh -c '/opt/ejabberd-18.06/bin/ejabberdctl stop && /opt/ejabberd-18.06/bin/ejabberdctl stopped'
ExecReload=/bin/sh -c '/opt/ejabberd-18.06/bin/ejabberdctl reload_config'
PrivateDevices=true


[Install]
WantedBy=multi-user.target


I can control now ejabberd by systemd and ejabberdctl


Note You need to log in before you can comment on or make changes to this bug.