1 { pkgs, lib, config, inputs, hosts, ipv4, ... }:
3 inherit (config.services) prosody;
4 inherit (hosts.mermet.config.services) coturn;
5 domain = config.networking.domain;
11 networking.nftables.ruleset = ''
14 tcp dport { xmpp-client, xmpp-server } counter accept comment "prosody: XMPP"
15 tcp dport 5000 counter accept comment "prosody: XMPP XEP-0065 File Transfer Proxy"
16 tcp dport {${lib.concatMapStringsSep "," toString prosody.httpsPorts}} counter accept comment "prosody: HTTPS"
19 skuid ${prosody.user} counter accept comment "prosody"
24 services.upnpc.redirections =
26 { description = "XMPP";
27 externalPort = 5222; protocol = "TCP";
29 service.wantedBy = ["prosody.service"];
30 service.partOf = ["prosody.service"];
32 { description = "XMPP";
33 externalPort = 5269; protocol = "TCP";
35 service.wantedBy = ["prosody.service"];
36 service.partOf = ["prosody.service"];
38 { description = "XMPP-FTP";
39 externalPort = 5000; protocol = "TCP";
41 service.wantedBy = ["prosody.service"];
42 service.partOf = ["prosody.service"];
44 ] ++ map (externalPort: {
45 description = "XMPP-HTTPS";
46 inherit externalPort; protocol="TCP";
48 service.wantedBy = ["prosody.service"];
49 service.partOf = ["prosody.service"];
50 }) prosody.httpsPorts;
53 services.tor.relay.hiddenServices."${domain}/xmpp".map = [ 5222 5269 5000 ] ++ prosody.httpsPorts;
55 users.groups.acme.members = [ prosody.user ];
56 security.acme.certs."${domain}" = {
57 postRun = "systemctl restart prosody";
59 fileSystems."/var/lib/prosody" = {
60 device = "rpool/var/prosody";
63 services.sanoid.datasets = {
64 "rpool/var/prosody" = {
65 use_template = [ "snap" ];
69 systemd.services.prosody = {
70 wants = [ "acme-selfsigned-${domain}.service" "acme-${domain}.service"];
71 after = [ "acme-selfsigned-${domain}.service" ];
73 # sudo -u prosody prosodyctl check
76 xmppComplianceSuite = true;
80 cloud_notify = false; # not encrypted even with OMEMO
81 #cloud_notify_encrypted = true;
85 server_contact_info = true;
86 watchregistrations = true;
104 -- Listen only in IPv4 until hosting provider's IPv6 works well.
105 interfaces = { "0.0.0.0" }
106 c2s_interfaces = { "0.0.0.0" }
108 --abuse = { "mailto:abuse@${domain}", "xmpp:abuse@${domain}" };
109 --admin = { "mailto:admin@${domain}", "xmpp:admin@${domain}" };
110 --feedback = { "http://${domain}/feedback.php", "mailto:feedback@${domain}", "xmpp:feedback@${domain}" };
111 --sales = { "xmpp:bard@${domain}" };
112 --security = { "xmpp:security@${domain}" };
113 --support = { "http://${domain}/support.php", "xmpp:support@${domain}" };
115 legacy_ssl_ports = { 5222 }
117 -- turncredentials_host = "turn.${domain}"
118 -- turncredentials_port = 3478
119 -- turncredentials_secret = "${coturn.static-auth-secret}";
121 turn_external_secret = "${coturn.static-auth-secret}"
122 turn_external_host = "turn.${domain}"
123 turn_external_port = 3478
124 turn_external_ttl = 86400
126 smacks_enabled_s2s = true;
127 smacks_s2s_resend = true;
129 --http_files_dir = "/var/lib/prosody/files"
130 --http_external_url = "https://tmp.${domain}:5281"
131 --https_certificate = "/var/lib/acme/${domain}/fullchain.pem"
132 --https_key = "/var/lib/acme/${domain}/key.pem"
133 --certificates = "/var/lib/acme"
136 Component "proxy65.${domain}" "proxy65"
137 proxy65_address = "proxy65.${domain}"
138 proxy65_acl = { "${domain}" }
140 Component "biboumi.${domain}"
141 component_secret = "useless-secret-on-loopback"
144 domain = "tmp.${domain}";
145 size_limit = 100 * 1024*1024; # 100 MiB
146 daily_quota = 200 * 1024*1024; # 200 MiB per day per user
147 global_quota = 1 * 1024*1024*1024; # 1 GiB total
148 expires_after = 7 * 24*60*60; # 7 days
152 c2sRequireEncryption = true;
153 s2sRequireEncryption = true;
154 s2sSecureAuth = true;
157 domain = "salons.${domain}";
159 restrict_room_creation = "local"
160 max_history_messages = 42
161 muc_room_locking = true
162 muc_room_lock_timeout = 600
163 muc_tombstones = true
164 muc_tombstone_expiry = 31 * 24 * 60 * 60
165 muc_room_default_public = true
166 muc_room_default_members_only = false
167 muc_room_default_moderated = true
168 muc_room_default_public_jids = false
169 muc_room_default_change_subject = true
170 muc_room_default_history_length = 42
171 muc_room_default_language = "fr"
175 ssl.key = "/var/lib/acme/${domain}/key.pem";
176 ssl.cert = "/var/lib/acme/${domain}/fullchain.pem";
180 virtualHosts."${domain}" = {
182 domain = "${domain}";
183 ssl.key = "/var/lib/acme/${domain}/key.pem";
184 ssl.cert = "/var/lib/acme/${domain}/fullchain.pem";
186 allowRegistration = false;
187 authentication = "internal_hashed";
191 { url = "biboumi.${domain}";
192 description = "Passerelle vers des serveurs IRC (Internet Relay Chat)"; }
194 package = pkgs.prosody.override {
195 withCommunityModules = [