1 { pkgs, lib, config, machines, ipv4, ... }:
3 inherit (config) networking;
4 inherit (config.services) prosody;
5 inherit (machines.mermet.config.services) coturn;
10 #../../sec/machines/losurdo/prosody.nix
12 networking.nftables.ruleset = ''
13 add rule inet filter net2fw tcp dport {5222,5269} counter accept comment "XMPP"
14 add rule inet filter net2fw tcp dport 5000 counter accept comment "XMPP XEP-0065 File Transfer Proxy"
15 add rule inet filter net2fw tcp dport {${lib.concatMapStringsSep "," toString prosody.httpsPorts}} counter accept comment "XMPP HTTPS"
16 add rule inet filter fw2net meta skuid ${prosody.user} counter accept comment "Prosody"
18 services.tor.hiddenServices."${networking.domain}/xmpp".map = [
22 ] ++ map (port: {inherit port;}) prosody.httpsPorts;
23 users.groups.acme.members = [ prosody.user ];
24 security.acme.certs."${networking.domain}" = {
25 postRun = "systemctl reload prosody";
27 systemd.services.prosody = {
28 wants = [ "acme-selfsigned-${networking.domain}.service" "acme-${networking.domain}.service"];
29 after = [ "acme-selfsigned-${networking.domain}.service" ];
31 # sudo -u prosody prosodyctl check
34 xmppComplianceSuite = true;
42 server_contact_info = true;
43 watchregistrations = true;
54 -- Listen only in IPv4 until hosting provider's IPv6 works well.
55 interfaces = { "0.0.0.0" }
56 c2s_interfaces = { "0.0.0.0" }
58 --abuse = { "mailto:abuse@${networking.domain}", "xmpp:abuse@${networking.domain}" };
59 --admin = { "mailto:admin@${networking.domain}", "xmpp:admin@${networking.domain}" };
60 --feedback = { "http://${networking.domain}/feedback.php", "mailto:feedback@${networking.domain}", "xmpp:feedback@${networking.domain}" };
61 --sales = { "xmpp:bard@${networking.domain}" };
62 --security = { "xmpp:security@${networking.domain}" };
63 --support = { "http://${networking.domain}/support.php", "xmpp:support@${networking.domain}" };
65 legacy_ssl_ports = { 5222 }
67 turncredentials_host = "turn.${networking.domain}"
68 turncredentials_port = 3478
70 --http_files_dir = "/var/lib/prosody/files"
71 --http_external_url = "https://tmp.${networking.domain}:5281"
72 --https_certificate = "/var/lib/acme/${networking.domain}/fullchain.pem"
73 --https_key = "/var/lib/acme/${networking.domain}/key.pem"
74 --certificates = "/var/lib/acme"
77 Component "proxy65.${networking.domain}" "proxy65"
78 proxy65_address = "proxy65.${networking.domain}"
79 proxy65_acl = { "${networking.domain}" }
81 Component "biboumi.${networking.domain}"
82 component_secret = "useless-secret-on-loopback"
86 c2sRequireEncryption = true;
87 s2sRequireEncryption = true;
90 domain = "tmp.${networking.domain}";
91 # Prosody's HTTP parser limit on body size
92 uploadFileSizeLimit = "10485760";
93 userQuota = 100 * 1024 * 1024;
94 uploadExpireAfter = "60 * 60 * 24 * 7";
95 httpUploadPath = "/var/lib/prosody/upload";
98 { domain = "salons.${networking.domain}";
100 restrict_room_creation = "local"
101 max_history_messages = 42
102 muc_room_locking = true
103 muc_room_lock_timeout = 600
104 muc_tombstones = true
105 muc_tombstone_expiry = 31 * 24 * 60 * 60
106 muc_room_default_public = true
107 muc_room_default_members_only = false
108 muc_room_default_moderated = true
109 muc_room_default_public_jids = false
110 muc_room_default_change_subject = true
111 muc_room_default_history_length = 42
112 muc_room_default_language = "fr"
116 ssl.key = "/var/lib/acme/${networking.domain}/key.pem";
117 ssl.cert = "/var/lib/acme/${networking.domain}/fullchain.pem";
119 "julm@${networking.domain}"
121 virtualHosts."${networking.domain}" = {
123 domain = "${networking.domain}";
124 ssl.key = "/var/lib/acme/${networking.domain}/key.pem";
125 ssl.cert = "/var/lib/acme/${networking.domain}/fullchain.pem";
127 allowRegistration = false;
128 authentication = "internal_hashed";
132 { url = "biboumi.${networking.domain}";
133 description = "Passerelle vers des serveurs IRC (Internet Relay Chat)"; }
135 package = pkgs.prosody.override {
136 withCommunityModules = [