|
1 | | -<div align="center"> |
| 1 | +# OpenCoperLock |
2 | 2 |
|
3 | | -# 🔐 OpenCoperLock |
| 3 | +A self-hostable private cloud for a single dedicated machine. It combines an ordinary |
| 4 | +file Drive with three things most "drop a file" tools lack: a code-gated Quick-Upload for |
| 5 | +any device, a server-side Remote-Upload from a link, and a hybrid encryption model that |
| 6 | +lets you choose, per folder, between server-side encryption at rest (scannable) and a true |
| 7 | +client-side zero-knowledge vault. |
4 | 8 |
|
5 | | -**A self-hostable private cloud — a clean Drive plus advanced acquisition & security tooling.** |
| 9 | +Licensed under the GNU AGPLv3. If you host a modified version, your users are entitled to |
| 10 | +the source. |
6 | 11 |
|
7 | | -[](./LICENSE) |
8 | | -[](https://github.com/softpython2884/opencoperlock/actions/workflows/ci.yml) |
9 | | -[](https://www.typescriptlang.org/) |
| 12 | +## What it does |
10 | 13 |
|
11 | | -</div> |
| 14 | +- **Drive** — browse, upload (streaming), download and delete files and folders, with a |
| 15 | + per-user storage quota and a deployment-wide cap. |
| 16 | +- **Quick-Upload** — open a temporary drop zone on any device by entering an active code, |
| 17 | + no full login required. Optional password, expiry and usage limit per code. |
| 18 | +- **Remote-Upload** — paste a link and the server fetches the file directly, so a phone on |
| 19 | + a metered connection never has to relay the bytes. SSRF-guarded. |
| 20 | +- **Antivirus** — files are scanned with ClamAV on upload; an optional VirusTotal hash |
| 21 | + lookup is available on demand. Infected files are quarantined. |
| 22 | +- **Hybrid encryption** — AES-256-GCM at rest by default (so files can be scanned), plus an |
| 23 | + opt-in zero-knowledge vault whose contents are encrypted in the browser and never |
| 24 | + readable by the server. |
| 25 | +- **Administration** — create users, set per-user quotas, define the global cap, manage |
| 26 | + Quick-Upload codes and read the audit log. |
12 | 27 |
|
13 | | -OpenCoperLock is an ultra-light, secure private cloud you run on your own dedicated |
14 | | -machine or VM. It pairs a classic file **Drive** with three things most "drop a file" |
15 | | -tools lack: a **nomadic Quick-Upload by code**, a **server-side Remote-Upload from a |
16 | | -link**, and a **hybrid encryption** model that lets you choose between server-side |
17 | | -encryption-at-rest (scannable) and a true client-side **Zero-Knowledge Vault**. |
| 28 | +## Architecture |
18 | 29 |
|
19 | | -> Built to be read, audited, and forked. AGPLv3 — if you host a modified version, your |
20 | | -> users get the source. |
21 | | -
|
22 | | ---- |
23 | | - |
24 | | -## ✨ Features |
25 | | - |
26 | | -| | Feature | What it does | |
27 | | -|---|---|---| |
28 | | -| 📁 | **Drive** | Browse, upload (streaming), download and delete files & folders. Per-user quota and a global storage cap. Minimalist UI, no heavy animations. | |
29 | | -| ⚡ | **Quick-Upload by code** | Open a temporary drop zone on any device (phone, third-party PC) by entering an active code — no full login. | |
30 | | -| 🌐 | **Remote-Upload** | Paste a link; the **server** downloads the file directly so your mobile connection (4G/5G) is never saturated. SSRF-guarded. | |
31 | | -| 🛡️ | **Antivirus + VirusTotal** | Files are scanned with ClamAV on upload; optionally checked against the VirusTotal API. Infected files are quarantined. | |
32 | | -| 🔒 | **Hybrid encryption** | Server-side AES-256-GCM at rest by default (so files can be scanned), **plus** an opt-in **Zero-Knowledge Vault** where files are encrypted in your browser and the server stays blind. | |
33 | | -| 👤 | **Admin panel** | Create users, set per-user storage quotas, define the global storage cap, manage Quick-Upload codes, and read the audit log. | |
34 | | - |
35 | | ---- |
36 | | - |
37 | | -## 🏗️ Architecture |
38 | | - |
39 | | -A TypeScript monorepo (pnpm workspaces): |
| 30 | +A TypeScript monorepo managed with pnpm workspaces: |
40 | 31 |
|
41 | 32 | ``` |
42 | | -opencoperlock/ |
43 | | -├─ apps/ |
44 | | -│ ├─ web/ # Next.js (App Router) — minimalist UI |
45 | | -│ └─ api/ # Fastify API + background worker |
46 | | -├─ packages/ |
47 | | -│ └─ shared/ # zod schemas, shared types, crypto helpers |
48 | | -├─ infra/ # docker-compose, Dockerfiles, clamav config |
49 | | -└─ docs/ # ARCHITECTURE, SECURITY, THREAT_MODEL, DEPLOYMENT |
| 33 | +apps/web Next.js (App Router) front end |
| 34 | +apps/api Fastify API + the Remote-Upload worker |
| 35 | +packages/shared zod schemas, shared types, server crypto, the SSRF guard, quota math |
| 36 | +infra Dockerfiles, docker-compose, ClamAV config |
| 37 | +docs architecture, security, threat model, deployment |
50 | 38 | ``` |
51 | 39 |
|
52 | | -- **API**: Fastify + Prisma + PostgreSQL. Background jobs run on a DB-backed worker loop |
53 | | - (no Redis required — Redis/BullMQ is an optional upgrade). |
54 | | -- **Storage**: pluggable driver; ships with a local-filesystem driver, ready for S3-compatible later. |
55 | | -- **Encryption**: see [`docs/SECURITY.md`](./docs/SECURITY.md) and [`docs/THREAT_MODEL.md`](./docs/THREAT_MODEL.md). |
| 40 | +The API uses Prisma and PostgreSQL. Background work runs on a database-backed worker loop |
| 41 | +inside the API process, which keeps a deployment to a single moving part; Redis/BullMQ is a |
| 42 | +documented upgrade for horizontal scale. Storage goes through a small driver interface; a |
| 43 | +local-filesystem driver ships, and an S3-compatible one can be added without touching the |
| 44 | +routes. See `docs/ARCHITECTURE.md` for the full design. |
56 | 45 |
|
57 | | -Read the full design in [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md). |
| 46 | +## Installation |
58 | 47 |
|
59 | | ---- |
| 48 | +### Guided (dedicated Debian/Ubuntu server) |
60 | 49 |
|
61 | | -## 🚀 Quick start (Docker) |
| 50 | +The wizard installs prerequisites and configures PostgreSQL, the environment, the build, |
| 51 | +PM2, an nginx reverse proxy and a Let's Encrypt certificate: |
62 | 52 |
|
63 | 53 | ```bash |
64 | 54 | git clone https://github.com/softpython2884/opencoperlock.git |
65 | 55 | cd opencoperlock |
66 | | -cp .env.example .env |
67 | | -# Edit .env — set strong values for POSTGRES_PASSWORD, MASTER_KEY, |
68 | | -# SESSION_SECRET, ADMIN_EMAIL and ADMIN_PASSWORD. |
69 | | - |
70 | | -docker compose -f infra/docker-compose.yml up --build |
71 | | -``` |
72 | | - |
73 | | -Then open `http://localhost:3000` and sign in with the admin credentials from your `.env`. |
74 | | - |
75 | | -Generate strong secrets: |
76 | | - |
77 | | -```bash |
78 | | -# 32-byte base64 keys for MASTER_KEY and SESSION_SECRET |
79 | | -openssl rand -base64 32 |
| 56 | +bash scripts/setup-wizard.sh |
80 | 57 | ``` |
81 | 58 |
|
82 | | -See [`docs/DEPLOYMENT.md`](./docs/DEPLOYMENT.md) for production setup behind a reverse |
83 | | -proxy with TLS (e.g. `copper.forgenet.fr`). |
84 | | - |
85 | | -### One-command install (dedicated server) |
| 59 | +### Manual (PM2) |
86 | 60 |
|
87 | | -On a fresh Debian/Ubuntu box, the interactive wizard installs prerequisites and sets up |
88 | | -PostgreSQL, `.env` (with generated secrets), the build, PM2, an nginx reverse proxy and a |
89 | | -Let's Encrypt certificate: |
| 61 | +Provide your own PostgreSQL, then: |
90 | 62 |
|
91 | 63 | ```bash |
92 | | -git clone https://github.com/softpython2884/opencoperlock.git |
93 | | -cd opencoperlock |
94 | | -bash scripts/setup-wizard.sh |
| 64 | +cp .env.example .env # set secrets and paths |
| 65 | +./scripts/deploy.sh # install, build, migrate, seed |
| 66 | +pm2 start ecosystem.config.cjs |
| 67 | +pm2 save && pm2 startup |
95 | 68 | ``` |
96 | 69 |
|
97 | | -### Quick start (bare-metal / PM2, manual) |
98 | | - |
99 | | -Prefer to wire it up yourself? Provide your own PostgreSQL, then: |
| 70 | +### Docker |
100 | 71 |
|
101 | 72 | ```bash |
102 | | -cp .env.example .env # edit secrets + paths |
103 | | -./scripts/deploy.sh # build, migrate, seed |
104 | | -pm2 start ecosystem.config.cjs |
105 | | -pm2 save && pm2 startup # restart on reboot |
| 73 | +cp .env.example .env |
| 74 | +docker compose -f infra/docker-compose.yml up --build -d |
106 | 75 | ``` |
107 | 76 |
|
108 | | -Full PM2 walkthrough in [`docs/DEPLOYMENT.md`](./docs/DEPLOYMENT.md#bare-metal-with-pm2-dedicated-server). |
109 | | - |
110 | | ---- |
| 77 | +Generate strong secrets with `openssl rand -base64 32`. Full production notes, including |
| 78 | +reverse-proxy topology and backups, are in `docs/DEPLOYMENT.md`. |
111 | 79 |
|
112 | | -## 🧑💻 Local development |
| 80 | +## Development |
113 | 81 |
|
114 | 82 | ```bash |
115 | 83 | pnpm install |
116 | | -# Start Postgres (and optional ClamAV) however you prefer, then: |
117 | | -pnpm --filter @opencoperlock/api prisma:migrate |
118 | | -pnpm --filter @opencoperlock/api db:seed |
| 84 | +pnpm --filter @opencoperlock/shared build |
| 85 | +pnpm --filter @opencoperlock/api prisma:generate |
119 | 86 | pnpm dev |
120 | 87 | ``` |
121 | 88 |
|
122 | | -Useful root scripts: `pnpm typecheck`, `pnpm lint`, `pnpm test`, `pnpm format`. |
123 | | - |
124 | | ---- |
| 89 | +The API needs a local PostgreSQL. ClamAV is optional in development; when it is |
| 90 | +unreachable, uploads are accepted and marked unscanned. Project gates: `pnpm typecheck`, |
| 91 | +`pnpm lint`, `pnpm test`. |
125 | 92 |
|
126 | | -## 🔐 Security |
| 93 | +## Security |
127 | 94 |
|
128 | | -Encryption model, trust boundaries and a threat model are documented in |
129 | | -[`docs/SECURITY.md`](./docs/SECURITY.md) and [`docs/THREAT_MODEL.md`](./docs/THREAT_MODEL.md). |
130 | | -To report a vulnerability, see [`SECURITY.md`](./SECURITY.md). |
| 95 | +The encryption model, trust boundaries and a candid threat model are documented in |
| 96 | +`docs/SECURITY.md` and `docs/THREAT_MODEL.md`. To report a vulnerability, see `SECURITY.md`. |
131 | 97 |
|
132 | | -## 🤝 Contributing |
| 98 | +## Contributing |
133 | 99 |
|
134 | | -Contributions are welcome — see [`CONTRIBUTING.md`](./CONTRIBUTING.md) and our |
135 | | -[`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md). |
| 100 | +See `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`. |
136 | 101 |
|
137 | | -## 📄 License |
| 102 | +## License |
138 | 103 |
|
139 | | -[GNU AGPL v3.0 or later](./LICENSE). © OpenCoperLock contributors. |
| 104 | +GNU AGPL v3.0 or later. See `LICENSE`. |
0 commit comments