1 import ../make-test-python.nix ({ pkgs, ... }: {
3 meta = with pkgs.lib.maintainers; {
7 client = { nodes, pkgs, ... }: {
8 networking.extraHosts = ''
9 ${nodes.server.config.networking.primaryIPAddress} example.com
12 environment.systemPackages = [
13 (pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; })
16 server = { config, pkgs, ... }: {
17 networking.extraHosts = ''
18 ${config.networking.primaryIPAddress} example.com
23 configFile = "/etc/ejabberd.yml";
26 environment.etc."ejabberd.yml" = {
40 max_stanza_size: 65536
46 module: ejabberd_s2s_in
50 module: ejabberd_service
57 "/upload": mod_http_upload
59 ## Disabling digest-md5 SASL authentication. digest-md5 requires plain-text
60 ## password storage (see auth_password_format option).
61 disable_sasl_mechanisms: "digest-md5"
63 ## Outgoing S2S options
64 ## Preferred address families (which to try first) and connect timeout
66 outgoing_s2s_families:
70 ## auth_method: Method used to authenticate the users.
71 ## The default method is the internal.
72 ## If you want to use a different method,
73 ## comment this line and enable the correct ones.
76 ## Store the plain passwords or hashed for SCRAM:
77 ## auth_password_format: plain
78 auth_password_format: scram
86 ## This option specifies the maximum number of elements in the queue
87 ## of the FSM. Refer to the documentation for details.
90 ###' ACCESS CONTROL LISTS
92 ## The 'admin' ACL grants administrative privileges to XMPP accounts.
93 ## You can put here as many accounts as you want.
96 - "root": "example.com"
98 ## Local users: don't modify this.
107 - "::FFFF:127.0.0.1/128"
111 ## Maximum number of simultaneous sessions allowed for a single user:
112 max_user_sessions: 10
113 ## Maximum number of offline messages that users can have:
114 max_user_offline_messages:
117 ## For C2S connections, all users except admins use the "normal" shaper
121 ## All S2S connections use the "fast" shaper
126 ## This rule allows access only for local users:
129 ## Only non-blocked users can use c2s connections:
133 ## Only admins can send announcement messages:
136 ## Only admins can use the configuration interface:
139 ## Only accounts of the local ejabberd server can create rooms:
142 ## Only accounts on the local ejabberd server can create Pubsub nodes:
145 ## In-band registration allows registration of any possible username.
146 ## To disable in-band registration, replace 'allow' with 'deny'.
149 ## Only allow to register from localhost
157 ## This section allows you to define who and using what method
158 ## can execute commands offered by ejabberd.
160 ## By default "console commands" section allow executing all commands
161 ## issued using ejabberdctl command, and "admin access" section allows
162 ## users in admin acl that connect from 127.0.0.1 to execute all
163 ## commands except start and stop with any available access method
164 ## (ejabberdctl, http-api, xmlrpc depending what is enabled on server).
166 ## If you remove "console commands" there will be one added by
167 ## default allowing executing all commands, but if you just change
168 ## permissions in it, version from config file will be used instead
181 ## Modules enabled in all ejabberd virtual hosts.
184 mod_announce: # recommends mod_adhoc
186 mod_blocking: {} # requires mod_privacy
190 mod_configure: {} # requires mod_adhoc
191 ## mod_delegation: {} # for xep0356
195 # default_encoding: "utf-8"
197 ## mod_http_fileserver:
198 ## docroot: "/var/www"
199 ## accesslog: "/var/log/ejabberd/access.log"
201 thumbnail: false # otherwise needs the identify command from ImageMagick installed
202 put_url: "http://@HOST@:5444/upload"
203 ## # docroot: "@HOME@/upload"
204 #mod_http_upload_quota:
207 ## XEP-0313: Message Archive Management
208 ## You might want to setup a SQL backend for MAM because the mnesia database is
209 ## limited to 2GB which might be exceeded on large servers
217 access_create: muc_create
218 access_persistent: muc_create
222 access_max_user_messages: max_user_offline_messages
231 mod_shared_roster: {}
236 mod_vcard_xupdate: {}
237 ## Convert all avatars posted by Android clients from WebP to JPEG
243 ## The module for S2S dialback (XEP-0220). Please note that you cannot
244 ## rely solely on dialback if you want to federate with other servers,
245 ## because a lot of servers have dialback disabled and instead rely on
246 ## PKIX authentication. Make sure you have proper certificates installed
247 ## and check your accessibility at https://check.messaging.one/
256 networking.firewall.enable = false;
260 testScript = { nodes, ... }: ''
261 ejabberd_prefix = "su ejabberd -s $(which ejabberdctl) "
263 server.wait_for_unit("ejabberd.service")
265 assert "status: started" in server.succeed(ejabberd_prefix + "status")
268 ejabberd_prefix + "register azurediamond example.com hunter2",
269 ejabberd_prefix + "register cthon98 example.com nothunter2",
271 server.fail(ejabberd_prefix + "register asdf wrong.domain")
272 client.succeed("send-message")
274 ejabberd_prefix + "unregister cthon98 example.com",
275 ejabberd_prefix + "unregister azurediamond example.com",