From e83ccb1eb23fb7a130dc73a8ff2d26305f2ff62e Mon Sep 17 00:00:00 2001 From: el3ctr0lyte <69082962+el3ctr0lyte@users.noreply.github.com> Date: Tue, 23 Nov 2021 13:42:09 +0200 Subject: Added file sharing for xmpp --- xmpp.html | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/xmpp.html b/xmpp.html index e3f9b69..ecfce15 100644 --- a/xmpp.html +++ b/xmpp.html @@ -114,12 +114,50 @@ You can see other settings for this module uploads.example.org" "http_upload" + +

As you will notice, you need another subdomain for this. We will add an ssl certficate for this later.

+ +

You will also need to go back to modules_enabled and uncomment the http_files module. This is used to actually serve the files to users.

+ +

And the last part of the setup is to enable the built in proxy server. This helps with file transfers for devices behind a NAT, and unless you are using XMPP in a LAN, you probably need this. Enable the proxy by adding the following line to the config:

+ +
Component "proxy.example.org" "proxy65"
+ +

As you can see, another subdomain is needed. We will add ssl certificates for this later.

+ +

At this point, file sharing is now setup and ready to be used. Although there are some concerns that should be addressed.

+ +

A big concern with file sharing is large files, seeing as all files shared over XMPP will be stored on your server. This can become a problem when many (and large) files are being shared. We can put a cap on large files by adding the following line to our config:

+
http_upload_file_size_limit = 20971520
+ +

This puts a 20MB cap on all files being shared. The value is specified in bytes. You can also specify after how long files should be deleted by adding the following line:

+
http_upload_expire_after = 60 * 60 * 24 * 7
+ +

The value is specified in seconds. The above line will make prosody delete files after a week.

+ +

If it is for some reason neccessary, you can also manually invoke expiry with the following command:

+ +
prosodyctl mod_http_upload expire
+

Other things to check

Check the config file for other settings you might want to change. For example, if you want to run a general public XMPP server, you can allow anyone to create an account by changing allow_registration to true.

+

Another thing you can do is enable the csi_simple module, which will add some optimizations for mobile devices.

+ +

Another thing worth noting is the archive_expires_after = "1w" line. This specifies after how long message archives will be deleted.

+

Certificates

@@ -134,6 +172,13 @@ Include the --nginx option assuming you have an Nginx server runnin

certbot -d chat.example.org --nginx
+

+If you have file sharing enabled, be sure to get a certificate for those subdomains as well. +

+
certbot -d uploads.example.org --nginx
+certbot -d proxy.example.org --nginx
+
+

Once you have the certificates for encryption, run the following to import them into Prosody.

@@ -179,7 +224,7 @@ Once your server is set up, you just need an XMPP client to use your new and sec