4 pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
5 openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=muc.example.com' -days 36500
7 cp key.pem cert.pem $out
10 import ../make-test-python.nix (
14 meta = with pkgs.lib.maintainers; {
21 security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
22 networking.extraHosts = ''
23 ${nodes.server.config.networking.primaryIPAddress} example.com
26 environment.systemPackages = [
27 (pkgs.callPackage ./xmpp-sendmessage.nix {
28 connectTo = nodes.server.config.networking.primaryIPAddress;
33 { config, pkgs, ... }:
35 security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
36 networking.extraHosts = ''
37 ${config.networking.primaryIPAddress} example.com
42 configFile = "/etc/ejabberd.yml";
45 systemd.services.ejabberd.serviceConfig.TimeoutStartSec = "15min";
46 environment.etc."ejabberd.yml" = {
60 max_stanza_size: 65536
67 module: ejabberd_s2s_in
71 module: ejabberd_service
78 "/upload": mod_http_upload
81 - ${cert pkgs}/key.pem
82 - ${cert pkgs}/cert.pem
84 ## Disabling digest-md5 SASL authentication. digest-md5 requires plain-text
85 ## password storage (see auth_password_format option).
86 disable_sasl_mechanisms: "digest-md5"
88 ## Outgoing S2S options
89 ## Preferred address families (which to try first) and connect timeout
91 outgoing_s2s_families:
95 ## auth_method: Method used to authenticate the users.
96 ## The default method is the internal.
97 ## If you want to use a different method,
98 ## comment this line and enable the correct ones.
101 ## Store the plain passwords or hashed for SCRAM:
102 ## auth_password_format: plain
103 auth_password_format: scram
111 ## This option specifies the maximum number of elements in the queue
112 ## of the FSM. Refer to the documentation for details.
115 ###' ACCESS CONTROL LISTS
117 ## The 'admin' ACL grants administrative privileges to XMPP accounts.
118 ## You can put here as many accounts as you want.
121 - "root": "example.com"
123 ## Local users: don't modify this.
132 - "::FFFF:127.0.0.1/128"
136 ## Maximum number of simultaneous sessions allowed for a single user:
137 max_user_sessions: 10
138 ## Maximum number of offline messages that users can have:
139 max_user_offline_messages:
142 ## For C2S connections, all users except admins use the "normal" shaper
146 ## All S2S connections use the "fast" shaper
151 ## This rule allows access only for local users:
154 ## Only non-blocked users can use c2s connections:
158 ## Only admins can send announcement messages:
161 ## Only admins can use the configuration interface:
164 ## Only accounts of the local ejabberd server can create rooms:
167 ## Only accounts on the local ejabberd server can create Pubsub nodes:
170 ## In-band registration allows registration of any possible username.
171 ## To disable in-band registration, replace 'allow' with 'deny'.
174 ## Only allow to register from localhost
182 ## This section allows you to define who and using what method
183 ## can execute commands offered by ejabberd.
185 ## By default "console commands" section allow executing all commands
186 ## issued using ejabberdctl command, and "admin access" section allows
187 ## users in admin acl that connect from 127.0.0.1 to execute all
188 ## commands except start and stop with any available access method
189 ## (ejabberdctl, http-api, xmlrpc depending what is enabled on server).
191 ## If you remove "console commands" there will be one added by
192 ## default allowing executing all commands, but if you just change
193 ## permissions in it, version from config file will be used instead
206 ## Modules enabled in all ejabberd virtual hosts.
209 mod_announce: # recommends mod_adhoc
211 mod_blocking: {} # requires mod_privacy
215 mod_configure: {} # requires mod_adhoc
216 ## mod_delegation: {} # for xep0356
220 # default_encoding: "utf-8"
222 ## mod_http_fileserver:
223 ## docroot: "/var/www"
224 ## accesslog: "/var/log/ejabberd/access.log"
226 thumbnail: false # otherwise needs the identify command from ImageMagick installed
227 put_url: "http://@HOST@:5444/upload"
228 ## # docroot: "@HOME@/upload"
229 #mod_http_upload_quota:
232 ## XEP-0313: Message Archive Management
233 ## You might want to setup a SQL backend for MAM because the mnesia database is
234 ## limited to 2GB which might be exceeded on large servers
242 access_create: muc_create
243 access_persistent: muc_create
247 access_max_user_messages: max_user_offline_messages
256 mod_shared_roster: {}
261 mod_vcard_xupdate: {}
262 ## Convert all avatars posted by Android clients from WebP to JPEG
268 ## The module for S2S dialback (XEP-0220). Please note that you cannot
269 ## rely solely on dialback if you want to federate with other servers,
270 ## because a lot of servers have dialback disabled and instead rely on
271 ## PKIX authentication. Make sure you have proper certificates installed
272 ## and check your accessibility at https://check.messaging.one/
281 networking.firewall.enable = false;
288 ejabberd_prefix = "su ejabberd -s $(which ejabberdctl) "
290 server.wait_for_unit("ejabberd.service")
292 assert "status: started" in server.succeed(ejabberd_prefix + "status")
295 ejabberd_prefix + "register azurediamond example.com hunter2",
296 ejabberd_prefix + "register cthon98 example.com nothunter2",
298 server.fail(ejabberd_prefix + "register asdf wrong.domain")
299 client.succeed("send-message")
301 ejabberd_prefix + "unregister cthon98 example.com",
302 ejabberd_prefix + "unregister azurediamond example.com",