_What version of ejabberd are you using?_
19.02
_What operating system (version) are you using?_
Windows 10 Pro
_How did you install ejabberd (source, package, distribution)?_
Windows Installer
_What did not work as expected? Are there error messages in the log? What
was the unexpected behavior? What was the expected result?_
The installation didn't create the admin user.
Log:
```
Log started 03/14/2019 at 15:58:47
Preferred installation mode : win32
Trying to init installer in mode win32
Mode win32 successfully initialized
Preparing to Install
Preparing to Install
Creating directory C:Program Filesejabberd-19.02
Creating directory C:Program Filesejabberd-19.02doc
Creating directory C:Program Filesejabberd-19.02docimg
Creating directory C:Program Filesejabberd-19.02logs
Creating directory C:Program Filesejabberd-19.02database
Creating directory C:Program Filesejabberd-19.02conf
Unpacking files
Unpacking C:Program Filesejabberd-19.02docimgsplash_p1.png
...
Unpacking C:Program Filesejabberd-19.02binmsvcr120.dll
Creating Desktop Shortcut for Start ejabberd
Creating Desktop Shortcut for Stop ejabberd
Executing final installation script
Script output:
C:Userslasj3Downloads>rem @echo off
C:Userslasj3Downloads>cd /D "C:Program Filesejabberd-19.02bin"
C:Program Filesejabberd-19.02bin>set RuntimeDir="C:ProgramDataejabberd"
C:Program Filesejabberd-19.02bin>rem Maybe convert from old installation
C:Program Filesejabberd-19.02bin>if exist "C:Userslasj3AppDataRoamingejabberd" move "C:Userslasj3AppDataRoamingejabberd" "C:ProgramData"
C:Program Filesejabberd-19.02bin>if exist "C:.ejabberd-modules" move "C:.ejabberd-modules" ""C:ProgramDataejabberd""
C:Program Filesejabberd-19.02bin>if exist ""C:ProgramDataejabberd"databasemnesia" move ""C:ProgramDataejabberd"databasemnesia" ""C:ProgramDataejabberd"databaseejabberd@localhost"
C:Program Filesejabberd-19.02bin>rem Move runtime files in ProgramData
C:Program Filesejabberd-19.02bin>for / %I in (..) do set InstallDir=%~fI
C:Program Filesejabberd-19.02bin>set InstallDir=C:Program Filesejabberd-19.02
C:Program Filesejabberd-19.02bin>copy ..confinetrc ""C:ProgramDataejabberd"conf"
1 arquivo(s) copiado(s).
C:Program Filesejabberd-19.02bin>copy ..conf*.pem ""C:ProgramDataejabberd"conf"
..confcacert.pem
..confdhparams.pem
..confserver.pem
3 arquivo(s) copiado(s).
C:Program Filesejabberd-19.02bin>sed -i "s!\!/!g" erl.ini
C:Program Filesejabberd-19.02bin>sed -i "/C:/ s!\!/!g" ""C:ProgramDataejabberd"confejabberd.yml"
C:Program Filesejabberd-19.02bin>rem Register ejabberd service
C:Program Filesejabberd-19.02bin>erlsrv add ejabberd -i "ejabberd" -c "Robust, massively scalable and extensible XMPP server" -sname ejabberd-srv@localhost -w "C:Program Filesejabberd-19.02bin" -ar "-s win_service" -st "win_service:stop()." -on restart
erlsrv: Service ejabberd added to system.
C:Program Filesejabberd-19.02bin>rem Start ejabberd
C:Program Filesejabberd-19.02bin>bash ejabberdctl start
C:Program Filesejabberd-19.02bin>if errorlevel 126 goto error
C:Program Filesejabberd-19.02bin>bash ejabberdctl started
C:Program Filesejabberd-19.02bin>if errorlevel 1 goto error
C:Program Filesejabberd-19.02bin>rem Register admin user
C:Program Filesejabberd-19.02bin>bash ejabberdctl register "admin" "localhost" "123456"
Error: cannot_register
C:Program Filesejabberd-19.02bin>rem Stop ejabberd
C:Program Filesejabberd-19.02bin>bash ejabberdctl stop
C:Program Filesejabberd-19.02bin>bash ejabberdctl stopped
C:Program Filesejabberd-19.02bin>rem Cleanup install directory
C:Program Filesejabberd-19.02bin>cd ..
C:Program Filesejabberd-19.02>rmdir conf database /s /q
C:Program Filesejabberd-19.02>exit 0
Creating Uninstaller
Creating uninstaller 25%
Creating uninstaller 50%
Creating uninstaller 75%
Creating uninstaller 100%
Uninstaller icon changed
Installation completed
Log finished 03/14/2019 at 15:59:45
Can anyone help me?
In the installation I changed the administrator name to another and now it worked. There may have been a conflict with the default admin.
if you have a previously installed ejabberd, and admin user is already created, when you install a new version it's expected to get Error: cannot_register, because admin user already exists. You can just dismiss this "error".
@cromain I am getting the same error and when I check the users' list in my MySQL database there is no such user;
also, the user is not showing by hitting this below command:
ejabberdctl registered_users localhost
@sandeepjangir What version?
That's mydomain.tld and not really "localhost" right?
@licaon-kter yes
@sandeepjangir but what does it output? Logs?
@licaon-kter it says:
error: cannot_register
PS: I installed the same ejabberd version previously and registered the same user but when I reinstalled the ejabberd, I also deleted the previous mysql database which was ejabberd;
I am still getting the same error
I might see the same...
HEAD ( e623678747ab9996a1104148b95d7c5ea34ba9ec ), Debian Buster arm64, pgsql11, OTP21
For a new user (or an existing user...it's the same error)
~ $ sudo -u ejabberd ejabberdctl user3 mydomain.tld password3
Error: cannot_register
Looking at loglevel 5 for a new user
[debug] <0.287.0>@ejabberd_access_permissions:handle_call:140 Command 'register' execution allowed by rule 'console commands' (CallerInfo=#{caller_module => ejabberd_ctl})
[debug] <0.7284.0>@ejabberd_commands:do_execute_command:494 Executing command ejabberd_admin:register with Args=[<<"user3">>,<<"mydomain.tld">>,<<"password3">>]
But doing it straight through with some erlang magic ( thanks @zinid )
~ $ sudo -u ejabberd ejabberdctl debug
Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Eshell V10.2.4 (abort with ^G)
(ejabberd@localhost)1> ejabberd_auth:try_register(<<"user3">>, <<"mydomain.tld">>, <<"password3">>).
ok
And checking, by trying again
(ejabberd@localhost)2> ejabberd_auth:try_register(<<"user3">>, <<"mydomain.tld">>, <<"password3">>).
{error,exists}
My config: https://gist.github.com/licaon-kter/51f8be973f743d453f515ef3e91bccd5
If I set your config and execute this with a valid hostname, it works as expected:
(ejabberd@localhost)4> ejabberd_auth:try_register(<<"user3">>, <<"domain.tld">>, <<"password3">>).
ok
And then this fails, as you saw:
$ ejabberdctl register user4 domain.tld password4
Error: cannot_register
Why does it fail? Because the "register" command uses mod_register configuration, and your config has:
register:
- deny
Because the "register" command uses mod_register configuration, and your config has
But why does it use mod_register configuration?
Why does it fail? Because the "register" command uses mod_register configuration, and your config has
And it worked until now (where *now is like until a month ago when I did my last test user registrations)* because it was a bug? And now that's fixed?
Also from the docs:
This configuration prohibits usage of In-Band Registration to create or delete accounts, but allows existing accounts to change the password:
access_rules:
register:
- deny
modules:
...
mod_register:
access: register
...
...right?
@badlop, I don't understand, so, if I don't want to provide in-band registration (XEP-0077), then I cannot create new users? But that's nonsense.
If an admin wants to provide his users a custom registration service, he can write a registration script locally that calls the "register" command with ejabberdctl, ejabberd_xmlrpc, mod_http_api or mod_rest. And those registrations should be restricted using the rules specified for mod_register, right?
if I don't want to provide in-band registration (XEP-0077), then I cannot create new users? But that's nonsense.
That should be possible to configure, of course. Considering that the registration script is local and the IBR clients are not local, then:
acl:
loopback:
ip:
- "127.0.0.0/8"
access_rules:
register:
- allow
trusted_network:
- allow: loopback
modules:
mod_register:
access: register
ip_access: trusted_network
That should be possible to configure, of course
Of course. But this is additional burden for the administrators and we want to avoid that. Also, a typical lazy administrator will not spend a lot of time thinking and will configure it as mod_register: {} potentially creating an open relay.
@badlop That works, thanks.
@zinid What now? Add more options to mod_register? I'd like that more than to fiddle with ACLs...
The changes introduced in the register command for #2837 were problematic and have been reverted.
Most helpful comment
@badlop, I don't understand, so, if I don't want to provide in-band registration (XEP-0077), then I cannot create new users? But that's nonsense.