2023-10-01 13:43:15 -04:00
|
|
|
# HARDFILES
|
2023-09-30 18:10:29 -05:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
No logs. No tracking. No analytics. No weird anime girls on the homepage.
|
2023-09-30 18:10:29 -05:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
Upload a file, get a link, it's shredded in 24 hours.
|
2023-09-30 18:10:29 -05:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Features
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
- Drag-and-drop, clipboard paste, file picker, and curl uploads
|
|
|
|
|
- Optional password protection on files
|
|
|
|
|
- 7-pass secure file shredding on expiry
|
|
|
|
|
- Random GIF backgrounds from a configurable directory
|
|
|
|
|
- IP-based rate limiting
|
|
|
|
|
- Streaming uploads (no memory buffering — handles files up to 5GB)
|
|
|
|
|
- Single Go binary, no database
|
2023-12-27 14:48:13 -05:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Quick Start
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
```bash
|
2023-10-01 13:43:15 -04:00
|
|
|
go build -o hardfiles main.go
|
|
|
|
|
./hardfiles
|
|
|
|
|
```
|
|
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
Or with Docker:
|
2023-10-04 01:32:49 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
```bash
|
2023-10-05 00:24:37 +00:00
|
|
|
docker compose up -d
|
2023-10-04 01:32:49 +00:00
|
|
|
```
|
|
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Configuration
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
Edit `config.toml`:
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
```toml
|
|
|
|
|
webroot = "www"
|
|
|
|
|
lport = "5000"
|
|
|
|
|
vhost = "hardfiles.org"
|
|
|
|
|
filelen = 6
|
|
|
|
|
folder = "files"
|
|
|
|
|
bgfolder = "backgrounds"
|
|
|
|
|
max_upload_mb = 5120
|
|
|
|
|
ttl_hours = 24
|
|
|
|
|
rate_limit_per_min = 30
|
|
|
|
|
```
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Usage
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
### Browser
|
|
|
|
|
Visit the site, drop a file, get a link.
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
### curl
|
|
|
|
|
```bash
|
|
|
|
|
# Upload a file
|
|
|
|
|
curl -F file=@photo.png https://hardfiles.org/
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
# Upload with password
|
|
|
|
|
curl -F file=@secret.pdf -F password=hunter2 https://hardfiles.org/
|
|
|
|
|
```
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
### Bash Alias
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
```bash
|
|
|
|
|
# Add to ~/.bashrc
|
|
|
|
|
upload() {
|
|
|
|
|
curl -F file=@$1 https://hardfiles.org/
|
2023-10-01 13:43:15 -04:00
|
|
|
}
|
2023-09-30 18:10:29 -05:00
|
|
|
```
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
Then just `upload /path/to/file.jpg`.
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Backgrounds
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
Add .gif files to the `backgrounds/` directory. Each page load picks one at random. The more chaotic, the better.
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Nginx Reverse Proxy
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
Hardfiles is designed to run behind nginx. Key configuration for large file uploads:
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
```nginx
|
|
|
|
|
server {
|
|
|
|
|
listen 443 ssl;
|
|
|
|
|
server_name hardfiles.org;
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
# CRITICAL: Must match or exceed max_upload_mb in config.toml
|
|
|
|
|
client_max_body_size 5120m;
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
# Disable request buffering — stream directly to backend
|
|
|
|
|
proxy_request_buffering off;
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
# Increase timeouts for large uploads
|
|
|
|
|
proxy_read_timeout 3600s;
|
|
|
|
|
proxy_send_timeout 3600s;
|
|
|
|
|
proxy_connect_timeout 60s;
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
# Increase header buffer for large multipart boundaries
|
|
|
|
|
proxy_buffer_size 16k;
|
|
|
|
|
proxy_buffers 4 32k;
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
location / {
|
|
|
|
|
proxy_pass http://127.0.0.1:5000;
|
|
|
|
|
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_http_version 1.1;
|
|
|
|
|
}
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
ssl_certificate /etc/letsencrypt/live/hardfiles.org/fullchain.pem;
|
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/hardfiles.org/privkey.pem;
|
2023-10-01 13:43:15 -04:00
|
|
|
}
|
|
|
|
|
```
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
**Important nginx settings:**
|
|
|
|
|
- `client_max_body_size 5120m` — must match `max_upload_mb` in config.toml, or nginx will reject uploads before they reach hardfiles
|
|
|
|
|
- `proxy_request_buffering off` — prevents nginx from buffering the upload to disk before forwarding (critical for memory-limited servers)
|
|
|
|
|
- `proxy_read_timeout 3600s` — 1 hour timeout for large uploads on slow connections
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Docker
|
2023-12-13 09:41:55 +00:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
```bash
|
|
|
|
|
# Build and run
|
|
|
|
|
docker compose up -d
|
|
|
|
|
|
|
|
|
|
# Volumes mounted:
|
|
|
|
|
# ./files:/app/files — uploaded files (auto-cleared every 24h)
|
|
|
|
|
# ./backgrounds:/app/backgrounds — GIF backgrounds
|
|
|
|
|
# ./config.toml:/app/config.toml — configuration
|
2023-10-01 13:43:15 -04:00
|
|
|
```
|
|
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
## Security
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
- Files are shredded with 7-pass random overwrite before deletion (effective on HDD; ceremonial on SSD — use dm-crypt/LUKS for SSD)
|
|
|
|
|
- Path traversal prevention on all routes
|
|
|
|
|
- Upload size limits enforced at the HTTP level
|
|
|
|
|
- Password-protected files use bcrypt hashing
|
|
|
|
|
- MIME type allowlist for inline serving (images, PDFs, text, audio, video) — HTML/SVG/JS forced to download to prevent stored XSS
|
|
|
|
|
- Content-Security-Policy headers on all HTML responses
|
|
|
|
|
- No file listing or directory browsing
|
2023-10-01 13:43:15 -04:00
|
|
|
|
|
|
|
|
## Credits
|
|
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
- **delorean** for developing hardfiles
|
|
|
|
|
- **hgw** for branding the product
|
|
|
|
|
- **acidvegas** for funding the project
|
|
|
|
|
|
|
|
|
|
## License
|
2023-10-01 13:43:15 -04:00
|
|
|
|
2026-03-28 01:34:36 -04:00
|
|
|
MIT
|