format, check and test / cargo fmt (push) Has been cancelled Details
format, check and test / cargo test (push) Has been cancelled Details
This is the repository for a ephemeral file hosting server. It receives files and serves them on request. After a while it decides to delete them. That's it!
This project is a re-write of QuadFile, a project I found years ago, being a old python project, It already wasn't the fastest it could be. I extended on it's features into my own fork, and now that I want to learn rust, I've decided to stop work on it, and start work on the 2nd generation of the server; Ephemeral.
What Exactly does it do?
- Receives files from users
- Sends files to users.
- Allows the admin to configure what files are allowed.
- Allows the admin to configure how long files are stored for. (See here)
- Allows the admin to configure if the files should be renamed automatically.
- Has a cool 'API' and is nicely configured for ShareX to upload files! (also see: SUpload)
- Generates cool statistics about what files are being uploaded/downloaded in a way that it can be shown on grafana.
Okay, how do I install it?
That's a little more complicated. Eventually we'll have 2 different environments, development and production, each with different logging and such.
- Make sure you have a /supported/ database installed and working, either sqlite, or Postgres.
- Initialise the database with the following command
sqlite3 ephemeral.db < schema.sql
- Compile and run ephemeral with
cargo runfor the debug build.
cargo run -rwill run the release build.
Production (nginx proxy)
This is the exact setup I'm using to run the test instance https://cz0.au
- git clone this repo. preferably as
- Create the DB
sqlite3 ephemeral.db < schema.sql
- Copy the systemd service
sudo cp ephemeral.service /etc/systemd/system/, editing if necessary
- Compile the release version.
cargo build --release
/docs/nginx.confas a base for your nginx config. You're on your own for this.
sudo systemctl daemon-reloadthen
sudo systemctl enable ephemeraland
sudo systemctl start ephemeralto reload systemd, get ephemeral to run at startup, and run it.
To see the logs (even in colour!) use
sudo journalctl -xefu ephemeral --output cat
Configuration options are available in the `config.toml' file. They're all fairly self explanatory with nice comments. Just make sure to restart your server to see the changes. I definitely have wasted a few hours bug-fixing in vain.
Wierd Security things you should probably be aware of
If you're running outside of a reverse proxy, it's possible to access any file on the file system that is readable by the user.
Since we use the HTTP Host header to find the theme, you could set your host to something like
../../../../etc/passwd and it may or may not work.
Chucking it behind a proxy (that uses the config in the documentation) means a invalid Host header /should/ break.
TODO: Test this please before I start using it publically, it rEALLY isn't a smart idea. :)
- exhail - seriously, without your babying me on IRC, I woudln't have been able to do this.
- audron - who told me to use rust in the first place, and showed me a bunch of cool stuff.
- Areganno - improved upon the StableDiffusion logo. (and by that I mean completely remade it)
- Shadowhand & hailey - I had a moment of weakness while writing nginx configs, and they were there when I needed them the most.
- rdqsr - For the brilliant work with the progress bar uploading thingy, it looks and works wonderfully!