Installing Ejabberd on Debian
Contents
Install Ejabberd
- For Debian 9
apt-get -t stretch-backports install ejabberd
- For Debian 10
apt install ejabberd
Edit /etc/ejabberd/ejabberd.yml
hosts:
# - localhost
- example.com
Let's Encrypt configuration
- Install Let's Encrypt and get an ECC certificate
- Replace your old Ejabberd certificate with a new one.
mv /etc/ejabberd/ejabberd.pem "/etc/ejabberd/backup.pem.$(date +%Y%m%d-%H%M%S)"; cat /root/.acme.sh/404.city_ecc/404.city.key /root/.acme.sh/404.city_ecc/fullchain.cer >> /etc/ejabberd/ejabberd.pem; chown ejabberd /etc/ejabberd/ejabberd.pem;
- Delete 'mod_s2s_dialback: {}'. This is a deprecated option allowing the use of self-signed certificates s2s
mod_roster:
versioning: true
# mod_s2s_dialback: {}
mod_shared_roster: {}
- Reload config
ejabberdctl reload_config
Creating a user from Linux console
ejabberdctl register user example.com password
Opening a public XMPP server
Uses PostgreSQL or MySQL
Do not use Mnesia or SQLite for public XMPP server. The Mnesia base is limited in size to 2GB and can be damaged at any time. Use PostgreSQL or MySQL. The Postgresql database is preferred, but the Mysql database is more familiar to most administrators.The PostgreSQL database is better suited for storing avatars and allows you to no record many errors. XMPP server 404.city uses the PostgreSQL database. XMPP server faceless.city uses the PostgreSQL database. The SQLite database is not recommended because it will show worse performance on a public server.
apt install erlang-p1-mysql erlang-p1-pgsql
Create database PostgreSQL or MySQL and grant all user rights to the database
Edit file ejabberd.yml (pgsql):
auth_method: sql
auth_password_format: scram
sql_type: pgsql
#sql_type: mysql
sql_server: "localhost"
sql_database: "xmpp"
sql_username: "xmpp"
sql_password: "password"
sql_pool_size: 10
new_sql_schema: true
default_db: sql
SRV DNS configuration
Need if the ip of your site and the ip of your server are different or you use non-standard port
SRV record
_xmpp-client._tcp.example.com. 300 IN SRV 0 1 5222 xmpp.example.com.
_xmpp-server._tcp.example.com. 300 IN SRV 0 1 5269 xmpp.example.com.
A record:
Change ip 8.8.8.8 to your IP-adress
xmpp.example.com. 300 IN A 8.8.8.8
http upload enable
mod_http_upload:
put_url: "https://xmpp.@HOST@:5280/upload"
-
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/api": mod_http_api
"/bosh": mod_bosh
"/upload": mod_http_upload
"/ws": ejabberd_http_ws
## captcha: true
## register: true
tls: true
protocol_options: 'TLS_OPTIONS'
web_admin: true
Captha + open inband registration
apt install imagemagick
chown ejabberd /usr/share/ejabberd/captcha.sh
-
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/api": mod_http_api
"/bosh": mod_bosh
"/usershare": mod_http_upload
"/ws": ejabberd_http_ws
captcha: true
## register: true
tls: true
protocol_options: 'TLS_OPTIONS'
##web_admin: true
captcha_cmd: "/usr/share/ejabberd/captcha.sh"
captcha_host: "xmpp.@HOST@:5280"
captcha_limit: 5
mod_register:
captcha_protected: true
ip_access: all
Ads
- Host your XMPP server to cheap DDoS-protected VPS: KVM & 2GB RAM & 1 Core & 25 GB SSD France & Nederland & UK & Germany Location & Free backup- €3.00/ month