XMPP server configs examples¶
Note
These examples are not meant to be complete, but rather show the relevant parts for slidge.
prosody/upload¶
1modules_enabled = {
2 -- [...]
3 "http_file_share"; -- for attachments with the "upload" option
4 "privilege"; -- for roster sync and 'legacy carbons'
5}
6
7local _privileges = {
8 roster = "both";
9 message = "outgoing";
10 iq = {
11 ["http://jabber.org/protocol/pubsub"] = "both";
12 ["http://jabber.org/protocol/pubsub#owner"] = "set";
13 ["urn:xmpp:http:upload:0"] = "get";
14 };
15}
16
17VirtualHost "example.org"
18 -- for roster sync and 'legacy carbons'
19 privileged_entities = {
20 ["whatsapp.example.org"] =_privileges,
21 ["other-walled-garden.example.org"] = _privileges,
22 -- repeat for other slidge plugins…
23 }
24
25Component "whatsapp.example.org"
26 component_secret = "secret"
27 modules_enabled = {"privilege"}
28
29Component "other-walled-garden.example.org"
30 component_secret = "some-other-secret"
31 modules_enabled = {"privilege"}
32
33-- for attachments with the "upload" option
34-- in whatsapp's config: upload-service=upload.example.org
35Component "upload.example.org" "http_file_share"
36 server_user_role = "prosody:registered"
37 -- alternatively, you can be more specific with:
38 -- http_file_share_access = { "whatsapp.example.org", "other-walled-garden.example.org" }
prosody/no-upload¶
1modules_enabled = {
2 -- [...]
3 "http_files"; -- to serve "no upload" attachments
4 "privilege"; -- for roster sync and 'legacy carbons'
5}
6
7-- in slidge's config: no-upload-path=/var/lib/slidge/attachments
8http_files_dir = "/var/lib/slidge/attachments"
9
10local _privileges = {
11 roster = "both";
12 message = "outgoing";
13 iq = {
14 ["http://jabber.org/protocol/pubsub"] = "both";
15 ["http://jabber.org/protocol/pubsub#owner"] = "set";
16 };
17}
18
19VirtualHost "example.org"
20 -- for roster sync and 'legacy carbons'
21 privileged_entities = {
22 ["whatsapp.example.org"] =_privileges,
23 ["other-walled-garden.example.org"] = _privileges,
24 -- repeat for other slidge plugins…
25 }
26
27Component "whatsapp.example.org"
28 component_secret = "secret"
29 modules_enabled = {"privilege"}
30
31Component "other-walled-garden.example.org"
32 component_secret = "some-other-secret"
33 modules_enabled = {"privilege"}
ejabberd/upload¶
Note
See additional notes in Example 2: ejabberd mod_http_upload
to get Attachments working.
Note
This example does not cover the No upload option for attachments. For ‘no upload’ with ejabberd, you need an external HTTP server, eg Example 2: nginx.
1listen:
2 -
3 ip: 127.0.0.1
4 port: 5347
5 module: ejabberd_service
6 # The next line is required if you're settings up multiple bridges
7 global_routes: false
8 hosts:
9 - "superduper.example.org":
10 password: secret
11 - "other-walled-garden.example.org":
12 password: some-other-secret
13 # repeat for other slidge plugins…
14
15 # HTTP upload service (XEP-0363)
16 -
17 port: 5443
18 module: ejabberd_http
19 tls: true
20 request_handlers:
21 /upload: mod_http_upload
22
23acl:
24 slidge_acl:
25 server:
26 - "superduper.example.org"
27 - "other-walled-garden.example.org"
28 # repeat for other slidge plugins you added in the listen section above
29
30access_rules:
31 slidge_rule:
32 - allow: slidge_acl
33
34modules:
35 mod_http_upload:
36 # A path that ejabberd has Read and Write access to
37 docroot: /ejabberd/upload
38 put_url: "https://@HOST@:5443/upload"
39 access:
40 - allow: local
41 - allow: slidge_acl
42
43 # for roster auto-fill and "carbons from legacy apps"
44 # (broken in ejabberd when this was written, hopefully fixed since)
45 mod_privilege:
46 roster:
47 both: slidge_rule
48 message:
49 outgoing: slidge_rule
50 iq:
51 "http://jabber.org/protocol/pubsub":
52 both: slidge_rule
53 "http://jabber.org/protocol/pubsub#owner":
54 set: slidge_rule
55 "urn:xmpp:http:upload:0":
56 get: slidge_rule
57 mod_roster:
58 versioning: true