/fileshelter

FileShelter is a “one-click” file sharing web application

Primary LanguageC++GNU General Public License v3.0GPL-3.0

FileShelter

Build Status

FileShelter is a self-hosted software that allows you to easily share files over the Internet. Just upload a file and get an URL back!

The aim is to provide a very simple web application, with few package dependencies, so that anyone can install it on his own server.

A demo instance is available, with the following limitations:

  • Maximum duration is set to 3 days
  • Maximum download limit is set to 10
  • Maximum file size is set to 1 MB

A docker image is available, thanks to Paul Galow.

Features

  • Multiple file upload (a zip is created server side)
  • Period of validity (from one hour to years)
  • Optional download limit
  • Customizable interface to allow or to prevent users to set the download limit or the duration validity
  • Optional password protection (download and upload)
  • Practically unique links, using UUID
  • Private link, used to remove the file or to check the download counter
  • Terms of service support
  • Multiple language support (english, french, german, russian)
  • Low memory requirement (the demo instance runs on a Raspberry Pi3B+, using less than 2% of total memory)

Once the expiry date or the download limit is reached, the download is no longer available and the file is deleted.

Installation

From packages

Debian Buster packages

Buster packages are provided for amd64 and armhf architectures.

As root, trust the following debian package provider and add it in your list of repositories:

wget -O - https://debian.poupon.io/apt/debian/epoupon.gpg.key | apt-key add -
echo "deb https://debian.poupon.io/apt/debian buster main" > /etc/apt/sources.list.d/epoupon.list

To install or upgrade fileshelter:

apt update
apt install fileshelter

The fileshelter service is started just after the package installation, run by a dedicated fileshelter system user.
Please refer to Deployment for further configuration options.

From source

Note: this installation process and the default values of the configuration files have been written for Debian Buster. Therefore, you may have to adapt commands and/or paths in order to fit to your distribution.

Debian/Ubuntu dependencies

Note: a C++17 compiler is needed to compile fileshelter

apt-get install build-essential autoconf automake libboost-dev libconfig++-dev libzip-dev

You also need Wt4, that is not packaged yet on Debian. See installation instructions.

Build

git clone https://github.com/epoupon/fileshelter.git fileshelter
cd fileshelter
autoreconf -vfi
mkdir build
cd build
../configure --prefix=/usr

configure will complain if a mandatory library is missing.

make

Installation

Note: the commands of this section require root privileges.

make install

Create a dedicated system user:

useradd --system --group fileshelter

Copy the configuration files:

cp /usr/share/fileshelter/fileshelter.conf /etc/fileshelter.conf
cp /usr/share/fileshelter/fileshelter.service /lib/systemd/system/fileshelter.service

Create the working directory and give it access to the fileshelter user:

mkdir /var/fileshelter
chown fileshelter:fileshelter /var/fileshelter

To make Fileshelter run automatically during startup:

systemctl enable fileshelter

Upgrade

To upgrade FileShelter from source, you need to update the master branch and rebuild/install it:

cd build
git pull
make

Then using root privileges:

make install
systemctl restart fileshelter

Deployment

Configuration

Fileshelter uses a configuration file, installed by default in /etc/fileshelter.conf. It is recommended to edit this file and change relevant settings (listen address, listen port, working directory, ...).

A basic Terms of Services is provided. The configuration file contains the definition of the fields needed by the default tos. You may also specify an alternate tos file to fit your needs.

If a setting is not present in the configuration file, a hardcoded default value is used (the same as in the default.conf file)

Reverse proxy settings

Fileshelter is shipped with an embedded web server, but it is recommended to deploy behind a reverse proxy. You have to set the behind-reverse-proxy option to true in the fileshelter.conf configuration file.

Here is an example to make Fileshelter properly work on myserver.org using nginx:

server {
    listen 80;

    server_name myserver.org;

    access_log            /var/log/nginx/myserver.access.log;

    proxy_request_buffering off;
    proxy_buffering off;
    proxy_buffer_size 4k;

    location / {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      proxy_pass          http://localhost:5082;
      proxy_read_timeout  120;
    }
}

Run

systemctl start fileshelter

Log traces can be accessed using journactl:

journalctl -u fileshelter.service

To connect to Fileshelter, just open your favorite browser and go to http://localhost:5091

Reverse proxy settings

You have to set the 'behind-reverse-proxy' option to 'true' in the configuration file.

Here is an example to make FileShelter properly work on myserver.org using nginx.

server {
    listen 80;

    server_name myserver.org;

    access_log            /var/log/nginx/myserver.access.log;

    proxy_request_buffering off;
    proxy_buffering off;
    proxy_buffer_size 4k;

    location / {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      proxy_pass          http://localhost:5091;
      proxy_read_timeout  120;
    }
}

To connect to FileShelter, just open your favorite browser and go to http://localhost:5091

Credits