Total Pageviews

5,445,039

Thursday, 23 January 2025

FerriShare:内置端到端加密的开源文件共享程序

Simple, self-hostable filesharing application with builtin end-to-end encryption

ferrishare-demo.tobiasm.dev

Install From Source

Don't want to use Docker? No problem.

You will need a Linux box, as all the instructions are written for a Linux machine. MacOS and Windows have not been tested, although the former might work.

  1. Make sure you have Rust and Node with npm setup on your machine.
  2. Grab a copy of the source code. You have two options:
    • Go to the releases page, download the Source code archive for the release you want to run, extract it and cd into it.
    • Clone the repository and cd into it. Important: This repository uses Git LFS to store large binary assets. Make sure Git LFS is setup and installed on your machine before cloning.
  3. Install all Node dependencies by invoking npm install
    • This installs the Tailwind CLI, which is required to build the CSS bundle of the app
  4. Build the CSS bundle by invoking npm run build:tw
    • If you prefer, you can also launch Tailwind's development server with npm run dev:tw
  5. Build the actual application with cargo build --release
  6. Configuration: Invoke cargo run --release -- --init (that -- in the middle is not a typo)
    • This will start FerriShare's interactive configuration wizard that will guide you through all options and create all necessary files in the ./data-subdirectory.
    • You can re-run this wizard later in case you wish to reconfigure the app. It does not touch the database or uploaded files. The templates in ./data/user_templates will only be created if they do not already exist.
  7. Launch: Invoke cargo run --release to launch the app in the foreground
    • Important: You're running and accessing the app directly without a reverse-proxy, which only works for local development. For this to work you must configure a proxy-depth of 0, otherwise FerriShare will refuse your HTTP requests.

Note that resources served on the /static/-endpoint are served with an infinite cache policy. During local development, you may want to disable browser caching to ensure your changes are always reflected in the browser.

Installation is fully documented in this README.

Configuration is documented in FerriShare itself through its interactive configuration wizard that can be invoked with the --init-flag.

The source code itself is properly documented, but the docs aren't hosted online. If you'd like to browse the module-level documentation you can clone the repository and invoke cargo doc --no-deps --open, assuming Rust is setup on your system.

from https://github.com/TobiasMarschner/ferrishare

---------------

FerriShare特点(摘自项目页面):

Securely share files with anyone Files and filenames are encrypted
Builtin IP-based rate limiting
Configurable limits for maximum filesize and maximum storage quota
Password-protected site-wide administration panel
Configurable Privacy Policy (with default template) and Legal Notice, if you need those.
Fast, efficient and memory-safe backend

安装Docker、NGINX、Certbot:

apt -y update
apt -y install curl wget nginx python3-certbot-nginx
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

创建目录新建compose文件:

mkdir -p /opt/ferrishare && cd /opt/ferrishare && nano docker-compose.yml

写入如下配置:

services:
  ferrishare:
    image: ghcr.io/tobiasmarschner/ferrishare:latest
    container_name: ferrishare
    restart: unless-stopped
    volumes:
      - ./data:/app/data
    ports:
      - 127.0.0.1:3000:3000

pull镜像:

docker compose pull

初始化配置:

docker compose run --rm -it ferrishare --init

如果你不使用CDN,这个Proxy Depth请设置为1,后续配置NGINX反向代理需要。

目前单个文件最大只支持2GB,Maximum filesize配置再大也没用。

启动:

docker compose up -d

配置NGINX反向代理,新建NGINX站点配置文件:

nano /etc/nginx/sites-available/ferrishare

写入如下配置:

server {
    listen 80;
    server_name ferrishare.example.com;
    client_max_body_size 2G;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

启用站点:

ln -s /etc/nginx/sites-available/ferrishare /etc/nginx/sites-enabled/ferrishare

签发SSL证书:

certbot --nginx --email imlala@example.com --agree-tos --no-eff-email


目前FerriShare的定位应该是临时文件上传,上传的文件必须设置一个到期时间,没有永久保存的选项.

No comments:

Post a Comment