XEP-0363 (file upload) not activated in default ejabberd configuration

Conversation says XEP-0363 (file upload) is not supported. I searched on https://docs.ejabberd.im, it seems it is implemented as mod_http_upload but in ejabberd.yml, it seems to be commented out:

- port: 5443
  ip: "::"
  module: ejabberd_http
  request_handlers:
    "/api": mod_http_api
    "/bosh": mod_bosh
      ## "/upload": mod_http_upload
    "/ws": ejabberd_http_ws
    ## captcha: true
    ## register: true
  tls: false
  protocol_options: 'TLS_OPTIONS'
  web_admin: true

Why is it so?

In general, is there any interface for some basic configuration of ejabberd or is the only solution to check the whole ejabberd documentation and edit ejabberd.yml?

Related issue: ejabberd: Enable XEPs (#703) · Issues · FreedomBox / FreedomBox · GitLab

Thanks for the quick feedback.

In that issue, the last info on support of XEP-0363 is 4 years old. The only other place I found anything about support of XEP-0363 in ejabberd in Freedombox is Xep-363 and xep-359 support which says it works with conversations.

Was it activated at some time in the past with non-configurable settings and later disabled? Or is the author of the forum post confused?

Could https://wiki.debian.org/FreedomBox/Manual indicate the XEPs supposed to be activated with ejabberd?

Can I help for documentation and testing? I can also contribute with money, I love Freedombox and that feature is essential to me, none of my contacts will use XMPP without it.

1 Like

Hello.

I agree with OP. There have been 4 different discussions / posts on this subject in the last 5 years but none of them have been closed.
Without XEP-0363, its not possible to share anything but text messages in XMPP MUC (groups).
This makes group communication through XMPP with FBX almost obsolete.

Any kind assistance on this subject would be greatly appreciated.

Thanks.

Ged.

2 Likes

Hello.

Here’s how I enabled http_upload (XEP-0363). Please note that I believe this may have harmed bosh, as I am receiving errors on the diagnostic report. Though, this has not impacted any of my use of XMPP via clients and I am able to transfer files both to and from MUC as well as contacts.

  1. Access Cockpit > Networking > Firewall > Edit Rules and Zones and add TCP port 5443 to your list of services.

  2. If you have a router, forward TCP port 5443 to your FBX.

  3. ssh into your FBX and sudo mkdir /var/www/upload

  4. Give ownership of the newly created folder to ejabberd with sudo chown -R ejabberd:ejabberd /var/www/upload

  5. Change mod of your new folder with sudo chmod -R 775 /var/www/upload

  6. ssh to your FBX and sudo nano /etc/ejabberd/ejabberd.yml to edit the ejabberd configuration file as follows (parts of file provided - correct indentations are not provided here, please make sure to follow the files indentation rules):

port: 5443
ip: “::”
module: ejabberd_http
tls: true
protocol_options: ‘TLS_OPTIONS’
request_handlers:
/api: mod_http_api
/bosh: mod_bosh
## /captcha: ejabberd_captcha
/upload: mod_http_upload
/ws: ejabberd_http_ws`

---- and

mod_http_api: {}
mod_http_upload:
put_url: https://@HOST@:5443/upload
docroot: /var/www/upload
custom_headers:
“Access-Control-Allow-Origin”: “https://@HOST@”
“Access-Control-Allow-Methods”: “GET,HEAD,PUT,OPTIONS”
“Access-Control-Allow-Headers”: “Content-Type”
mod_last: {}

Save and exit with CTRL+X > Y > Enter.

  1. ssh to your FBX and restart your ejabberd service with sudo systemctl restart ejabberd

  2. As a precaution, I also created a CNAME for subdomain “conference” pointing to my main domain. However, this may not be mandatory.

Good Luck.

Ged.

2 Likes

Thanks for sharing your configuration.

You can see my attempt to get it working here:

This one is intended to work together with the existing bosh port. However, it was failing with the apache error “AH01097: pass request body failed”. I assumed that there was an issue with the apache proxy config.

BTW, which client are you using to test it?

2 Likes

Thanks @jvalleroy. I will try your configuration and see how it works. To be honest, now that I have my configuration working and in order, I’m not sure if my life with change with bosh or not : )

Right now I have 3 clients: Dino, Monal and Conversations. They all work decently with no interop problems.
I am having trouble with notifications though. Any client that goes offline stops receiving notifications. I’m trying to figure out if its a client or server issue, but will also report if I have any findings.

Hello again.

Did try your configuration but could not get http_upload to work?

The steps I took:

nano /etc/ejabberd/ejabberd.yml

  • defined put_url: https://@HOST@:5443/bosh/upload
  • defined docroot: /var/www/bosh/upload
  • revised “Access-Control-Allow-Origin”: “https://@HOST@” to “Access-Control-Allow-Origin”: “*”

nano /etc/apache2/conf-available/jwchat-plinth.conf
added;

    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "OPTIONS, HEAD, GET, PUT"
    Header set Access-Control-Allow-Headers "Content-Type"

systemctl restart ejabberd

Could I have missed something?

Thanks in advance.

How do you get notifications back when that happens?

Due to the limitation for file upload, I only use ejabberd on my Freedombox to send/receive SMS from my PC via two mobile phones, using the MAXS application. The client is MAXS on one side, and it is Gajim on PC on the other side. It happens that one of the two phones appears offline, but since it is always the same phone, I suspect it is a problem specific to that phone.

In any case, I use accounts hosted by conversations.im with a domain I registered as the main communication with 2 family members and I propose using XMPP to other contacts everytime I can, hoping to eventually move accounts to a server on a Freedombox once the file upload will work.

I can certainly try things as I just got 2 spare Pioneer boxes at home, but that will be from mid-December when I will be back home.

Hi @Avron

Just run the client app; the account gets back online and notifications work (for some time - until the client goes offline again). I believe the problem is push related, possibly because apple / android have some clumsy scheme behind it all. I’m not having any notification problems on Dino.

I’ve got http_upload working with the above configuration. If you leave ejabberd at its default (like I did), it’ll give you a 100MB quota for upload.

I have been on conversations.im for two years now. They provide excellent service. With Freedombox, I just wanted to see if I can spread my own wings and run my own server. If you aren’t going to use a web client for XMPP, then you don’t need bosh. In this case, the configuration I shared above should work for you too.

Best.

The original version was not working. I have updated it and it should work now. I was mistaken about /upload using BOSH, it is actually separate but on the same port.

2 Likes

hi @jvalleroy

thanks for the update :+1:
for practical reasons, will the next update ‘repair’ my existing configuration or would I have to do it manually?