igniterealtime / openfire-httpFileUpload-plugin

Adds XEP-0363 functionality to Openfire that allows compliant clients to exchange files
Apache License 2.0
9 stars 10 forks source link

Security Access to uploaded files & choice of folder to keep & manage files after OF restart #10

Open ClaudeStabile opened 5 years ago

ClaudeStabile commented 5 years ago

Hello,

httpupload is uploading file in a public area. If link to file is found, anyone can access it. Ideally we should have an option to restrict file access to signed OF users only to provide a better security with uploaded files. This option could be activated or not as we need a public access in some cases. For storage location if a specific folder could be specify it would be helpfull. No erase on restart and ideally possible file management : no erase ; erase when max is reached, erase daily, weekly...

I understand that it is not an issue but rather enhancement suggestions. If it could be added it would be Great :)

Claude-

wrooot commented 5 years ago

This is ok to post feature requests here. Although it is preferable one per ticket 😊 i suggest keeping this ticket for the secure url and move stuff about file and folder management to a new one.

For secure link to work users would have to somehow login to the server on the web besides the regular login in a client. Maybe http bind can be used for it. Not sure if this can be automated or at least do only one login first time.

Btw, that would go against the standard's requirement:

Do not provide any kind of access control or security for file retrieval beyond Transport Layer Security in form of HTTPS and long random paths that are impossible to guess. That means everyone who knows the URL SHOULD be able to access it.

https://xmpp.org/extensions/xep-0363.html

ClaudeStabile commented 5 years ago

@wrooot Thanks a lot for yr detailed & precise answer. I fully understand limits of security suggestion as it goes against xep-0363. Any improvement for uploaded file enhanced security would be an asset. thanks a lot for considering the point. Thanks also for considering a better storage management improvement for uploaded files, purge & specific no tmp folder.

guusdk commented 4 years ago

Although I've not tested this myself yet, it should be possible to use another folder than a tmp folder by setting the property plugin.httpfileupload.fileRepo to a location on disk (since version 1.1.1)

ClaudeStabile commented 4 years ago

@guusdk : Thanks a lot this change/enhancement, it will be very helpful. I will investigate ASAP and test but probably a very nice way to fix attachement files that get purged into /tmp when docker instances are restarted :+1: COOL !!! :)

ClaudeStabile commented 4 years ago

@guusdk : Just to confirm that i manage to configure the plugin to keep my files on a docker volume for each openfire instances using variable plugin.httpfileupload.fileRepo. Attachement files are now manageables and it cope with docker technology. Files are located in a safer place outside each docker instances. Such a solution is much more safer and better than usual sqllite database on each client phone as whatsapp telegram does. Local sqllite storage for sensitive attachement and files is a stupidity that bring many possible security exploits and overflows Thanks for your efforts and changes made !

fais3000 commented 4 years ago

@ClaudeStabile Can you please share your configuration for plugin.httpfileupload.fileRepo for docker setup? When I add a value of "/var/lib/openfire/files" I got 403 on PUT.

Note /var/lib/openfire is already shared with the docker host.

Here is my docker-compose

version: '2'
services:
  openfire:
    container_name: openfire
    image: kaneymhf/openfire
    ports:
      - "9090:9090/tcp"
      - "9091:9091/tcp"
      - "5223:5222/tcp"
      - "7777:7777/tcp"
      - "7070:7070/tcp"
      - "7443:7443/tcp"
    volumes:
      - /srv/docker/openfire/data:/var/lib/openfire
      - /srv/docker/openfire/logs:/var/log/openfire
ClaudeStabile commented 4 years ago

@fais3000 Hello, to awswer your questions : What i am doing is -Create an openfire with a "docker run" instruction with -v to specifify an outside volume/mount to store attachements so something like : docker run --name www -v /data/ATTACHEMENTS/WWW:/attachements/WWW In this case data are stores into /data/ATTACHEMENTS/WWW on the main host Then configure Openfire variables of your docker instance to target /attachements/WWW Configure at least plugin.httpfileupload.fileRepo and plugin.httpfileupload.maxFileSize to modify max file size See also attachement screenshot5 You need to create a dedicated volume for it

Many thanks @guusdk for this hack, we can now manage & keep attachement for all openfire instances, it helps a lot.

Hope this helps your quest

Claude-