### Use a proper LDAP bind dn/password to query accounts
iRedMail generates a LDAP bind dn `cn=vmail,dc=xxx,dc=xxx` with read-only
access to all mail accounts, we use it in ejabberd to query accounts.
Password of `cn=vmail,dc=xxx,dc=xxx` was generated randomly during iRedMail
installation, you can find the full dn and password in
`/etc/postfix/ldap/catchall_maps.cf`:
```
# grep 'bind_' /etc/postfix/ldap/catchall_maps.cf
bind_dn = cn=vmail,dc=example,dc=com
bind_pw = InYTi8qGjamTb6Me2ESwbb6rxQUs5y
```
### Configure ejabberd
Ejabberd's configuration files are written in Erlang syntax, which might be difficult to comprehend. Thankfully, the modifications we need to make are relatively minor and straightforward. The main ejabberd configuration file is located at /etc/ejabberd/ejabberd.cfg. We'll cover each relevant option in turn.
In Erlang, comments begin with the % sign.
* Setting admin and domain, now we setting `www@example.com` as admin.
Login in the ejabberd web admin, We have seting www@example.com as admin for the ejabberd server
You can not create user in webadmin. If you want to create user, you need first add user in iRedAdmin, then enable the jabber service for the user in phpldapadmin.
If you want to add the second virtual domain, you need first create a new domain in iRedAdmin, then modify /etc/ejabberd/ejabberd.cfg .
* Open `/etc/ejabberd/ejabberd.cfg` and set correct values: