The Swiss FileServer
Find a file
Cordy b2b657277d
All checks were successful
ci / test-and-build (push) Successful in 26s
release / image (push) Successful in 33s
v0.6.413: #742 batch B part 2b: shared sign-in, editor locks, link passwords, rotation progress; several instances supported (#1195)
2026-11-22 01:04:58 +00:00
.forgejo Merge remote-tracking branch 'origin/main' into ci-rc-publish-main 2026-11-18 21:20:39 +01:00
cmd/cairnd cairnd: no coordination start step waits silently: a WARN every 15 s names the step, and the sign-in readiness wait logs while it lasts and at its bound (CI run 4078) 2026-11-22 01:29:09 +01:00
deploy #742 r15: v0.6.413 docs: several instances supported, editor locks, strict sign-in switch, link passwords, rotation progress 2026-11-21 19:13:49 +01:00
docs docs: external NATS per-server room refusal (10005) and the start-step WARN (#742 fx8) 2026-11-22 01:31:27 +01:00
internal natscoord: a placement refusal for lack of server storage (10005) is logged and refused after a 15 s grace in external mode, not retried silently until startWait; natstest servers default to 1 GiB, room for an external member's 384 MiB (CI run 4078) 2026-11-22 01:29:08 +01:00
proto/cairn/peer/v1 #244 Ship 2: space-recipient wire + delivery into space inbox (v0.6.27) (#246) 2026-08-15 17:29:08 +00:00
web #742 fx6: end answers carry the reason's code; End all answers 401 on every member 2026-11-21 22:23:14 +01:00
.gitignore repo: untrack the a11y node_modules symlink; ignore node_modules as file or folder 2026-11-10 01:41:46 +01:00
.ko.yaml ko base static-debian13 with a guard test (#993); chart serviceAccount values for the Agent injector, chart 0.6.0 (#994) 2026-10-25 12:47:01 +01:00
ARCHITECTURE.md #742 r15: v0.6.413 docs: several instances supported, editor locks, strict sign-in switch, link passwords, rotation progress 2026-11-21 19:13:49 +01:00
CHANGELOG.md docs: external NATS per-server room refusal (10005) and the start-step WARN (#742 fx8) 2026-11-22 01:31:27 +01:00
Dockerfile fix(docker): builder golang:1.26-alpine to match go.mod (GOTOOLCHAIN=local); test compares the builder with go.mod (#740) 2026-10-24 14:23:09 +02:00
ENCRYPTION-COMPARISON.md docs: reframe ENCRYPTION-COMPARISON as an open fork — correct PQ (age IS PQ-capable), split custody(A) vs access(B), OpenBao/credential-derived/PQ/Datentresor, per Manuel 2026-07-24 2026-07-25 17:45:28 +00:00
EULA.md Update check on by default with pagination and boot-armed timer (#793); changelog v0.6.313 2026-10-01 11:05:49 +02:00
example.config.json config, settings: Deleted files on by default; seed a new instance's settings with 30 days (#1100) 2026-11-04 06:40:09 +01:00
example.config.oidc-s3.json config, settings: Deleted files on by default; seed a new instance's settings with 30 days (#1100) 2026-11-04 06:40:09 +01:00
go.mod #742 u1: nats.go 1.56.0 (TLS security release), embedded and external connections tested 2026-11-20 08:19:57 +01:00
go.sum #742 u1: nats.go 1.56.0 (TLS security release), embedded and external connections tested 2026-11-20 08:19:57 +01:00
IMPLEMENTED-PEERING.md docs(peering): A+C recipient authorization, correct the 10 build-order row, homes default (#123, #102) 2026-08-05 18:18:39 +00:00
LICENSE.md docs: branding and legal links (#1109 b11) 2026-11-09 00:30:13 +01:00
Makefile make test: -timeout 30m like CI (cmd/cairnd runs past go test's 10-minute default) 2026-11-18 20:36:50 +01:00
OCM.md ocm (#1070 final review): bound folder tag walks (4 at once, 503 when the request ends waiting; cache by 50,000 tags), minute tag hashes pid + path inside the share, invalid names 404 on PROPFIND, Basic note on GrantOptions.Now; docs S2, N4-N6 2026-11-03 06:31:17 +01:00
OIDC-COMPARISON.md docs: record the OIDC build decision — library route chosen 2026-07-20 17:21:35 +00:00
PEERING.md docs: record the peering decisions (#100) 2026-08-04 22:59:58 +00:00
README.md docs: name search index (#1102) 2026-11-04 20:04:29 +01:00
VERSIONING.md docs: v0.6.408 state that cannot be read, #742 Wave A, #944/#945 follow-ups (#1011 w14) 2026-11-13 07:13:31 +01:00

Cairn

Self-hosted file storage. Files, and nothing else.

Cairn is a single-binary file server: a clean web interface, WebDAV for every sync client, resumable uploads, share links, pluggable storage (POSIX/NFS or any S3-compatible object store), and pluggable identity (local, OIDC, or LDAP). It is what remains of a "Nextcloud" after you remove everything that is not file storage.

  • One container is the whole stack. No PHP, no Redis, no required database, no cron sidecar. One Go binary, one config file.
  • Your storage backend is the source of truth. On the POSIX driver the directory tree on disk is the data model — browse it with ls, back it up with rsync, snapshot it with ZFS. On the S3 driver your bucket is the data model. No opaque blobs, no schema lock-in, no database index to corrupt. Name search uses an index held in memory and rebuilt from the storage at every start; nothing of it is stored, so there is nothing to migrate or corrupt, and the storage stays the source of truth. Since v0.6, instance state — settings, license, share links, legal holds, peering trust, spaces and their limits, tags, favourites, profile pictures — lives with the backend too, encrypted under a reserved prefix: a fresh container against the same bucket is the same instance, and updates cannot lose it.
  • Identity is consumed, not implemented. Bring your own OIDC provider (Keycloak, Authentik, Authelia, Zitadel, ...) or LDAP directory (Active Directory, OpenLDAP, FreeIPA). Groups flow through both — shared spaces and even admin can be managed entirely in your directory. Local argon2id users work out of the box.
  • Small trust surface. The core file server carries five Go dependencies: x/crypto (argon2id), go-oidc + x/oauth2 (OIDC), go-ldap (LDAP), and filippo.io/age (at-rest encryption) — plus exactly one vendored browser asset, a pinned build of typage (the same author's TypeScript age) used by the share viewer, embedded in the binary rather than loaded from a CDN. Instance peering adds two more, google.golang.org/grpc and google.golang.org/protobuf, and is the one place that discipline was deliberately broken: it is opt-in, off unless a peering is configured, and carries only small control messages — the file bytes still move over stdlib HTTP. The reasoning is recorded in IMPLEMENTED-PEERING.md §7.

Status: v0.6, dogfooded daily on a k3s cluster (S3(Garage) + OIDC via Keycloak + at-rest encryption; client interop verified with Finder, rclone, and Cyberduck; the delete-the-volume recovery drill rehearsed on the live instance). Pre-1.0: minor versions may break config. See ARCHITECTURE.md for the full design, docs/handbook/ for operator and user guides, and CHANGELOG.md for what shipped when. Product site: www.swisscairn.ch.

Features

  • Web UI — sidebar views (Personal, Spaces, Recents, Favourites, Shares, Transfers, Federated, Deleted files); List, Condensed and Tiles views with server-generated image thumbnails; Owner, Tags and lock-Status columns, all sortable; search across your tree or just this folder, with type and date filter pills and tag search; multi-select with bulk download / copy / move / favourites / delete; per-row actions (open, edit, download, share, copy link, send to peer, copy to, move, rename, create a space from the selection, lock, details); a details panel with file versions (download, restore), activity, shares and collaborative tags; a New menu that creates folders and documents; a Spaces overview with per-space images, subtitles, descriptions and storage meters; a notification bell (transfers, federated shares, expired locks, licence and space-storage alerts for admins, each mutable per person); Account settings with profile pictures, display names, preferences and Connected devices (per-device app passwords for WebDAV and sync apps, in every auth mode); dark mode + accent themes; full UI in English, German, French, and Italian. Embedded in the binary; no separate frontend to deploy.
  • WebDAV at /dav/ — mount as a network drive from Finder, Windows Explorer, rclone, Cyberduck, each with its own device password if you like (an administrator can require that). RFC 4331 quota properties so clients show the free space of your own personal space or space, and real class-2 LOCK/UNLOCK so Office and Finder hold genuine locks while editing. Two-way desktop sync via rclone bisync: see docs/SYNC.md.
  • Resumable uploads (TUS 1.0.0) at /api/v1/tus/ — interrupted uploads survive dropped connections and server restarts; the web UI uses this automatically for files ≥16 MiB, resuming across page reloads. Abandoned uploads expire after 24 h without progress (tusExpiry), so half-finished files never pile up on the volume.
  • Share links — optional public /s/ surface with expiry, password, and upload-drop support; admins can list and revoke all links.
  • Sharing with people and groups — address a file or folder to another account or a group on this instance: recipients sign in as themselves and find it under Shares › Shared with me, reading the owner's file in place. Roles are view or edit; only the owner manages the grant list (recipients cannot re-share), and internal sharing has its own admin switch, separate from public links.
  • In-browser document editing (WOPI) — point office.url at a separately deployed Collabora Online (or any WOPI-compatible editor) and office documents open in a full-page editor: editable formats come from the editor's own discovery, Microsoft and ODF files are edited natively, the New menu creates documents from templates embedded in the binary, and locked / held / read-only files open honestly read-only with the reason named. Cairn ships none of the editor's code. See docs/handbook/document-editing.md.
  • Instance peering (federation v1) — two Cairn instances whose admins explicitly paired them can send files to each other's users: per-peer Ed25519 keys exchanged out of band (shown once; only a verifier is stored), separate send/receive allow-lists of users and IdP groups per peer, and delivery into the recipient's Personal/Inbox/<peer>/. Files are age-encrypted end to end for the receiving instance before they leave the sender, so a TLS-terminating proxy at either end sees ciphertext only. No discovery, no central broker, no identity federation — an explicit admin handshake or nothing. Runtime on/off switch, per-peer connection test, transfer notifications in the UI. Requires auth.perUserHomes (the default). See docs/handbook/peering.md.
  • Open Cloud Mesh (OCM) — federate with Nextcloud, ownCloud, OpenCloud, Seafile and CERNBox: standards-track OCM speaking both deployed dialects (modern 1.1 and the legacy Nextcloud/ownCloud form), RFC 9421 and draft-cavage request signatures, and live access grants instead of copies. Off by default, behind a server allow-list that actually gates both directions, per-server strictness ("invited contacts only" by default) and user-owned invites. Received shares live in a dedicated Federated view — never mounted into sync trees, never copied silently. See docs/handbook/federation-ocm.md.
  • Storage drivers — posix (any mounted filesystem) or s3 (hand-rolled SigV4 client, works against Garage/MinIO/AWS). An instance can also be deployed with storage.driver: "setup" and connected to its storage from the browser: a token-gated wizard probes the target with a real write, persists a local bootstrap pointer, and restarts into the normal boot path.
  • Auth modes — local (config-file users with argon2id hashes, up to 50 runtime accounts managed from the dashboard, and a first-run wizard that mints the initial admin behind a one-time token from the logs), oidc (Authorization Code + PKCE against any OIDC IdP — local accounts and app passwords work alongside), or ldap (search-then-bind against AD / OpenLDAP / FreeIPA). See docs/handbook/local-accounts.md.
  • Authorization (auth.perUserHomes, on by default) — each user gets a private /home, plus shared /spaces/<group> mapped from OIDC group claims or LDAP memberOf. Admins are scoped like everyone else: their own /home and the spaces they belong to, never another user's home or a non-member space. Admin rights come only from a browser/SSO session (Basic credentials and app passwords act as ordinary users), and only a session admin gets the Administration > Spaces inventory. Set it to false only if you deliberately want a single shared namespace: the Personal/Spaces split users expect is not truthful without it, because "Personal" would be the shared backend root. Spaces are self-service: users create a space from the UI and the owner manages members (read or read+write) — app-owned by default (membership lives with the encrypted instance state; no IdP write access needed), with an opt-in power mode that brokers spaces to the directory instead (ADR 0001). With the IdP read client configured, directory-group membership changes apply live (~1 minute, revocations included) instead of at next login. Spaces have a full lifecycle: deactivate (reversible, hidden from members) and then delete — contents go to trash for the retention window and the name stays reserved until final purge. People learn about only the spaces they belong to (with per-user homes on; other spaces answer as if they did not exist), and creating or renaming a space never takes over an existing folder or a directory space Cairn already knows (its folder exists, or a member has opened it). A directory group with neither is not detected yet (#919): create new directory groups' folders before announcing the group, or check Administration > Spaces for an app-owned space of that name. Admin itself can be granted by directory group (auth.adminGroups) — with auth.admins as the break-glass username list.
  • Accounts & groups — the Users & access page manages local accounts and app-owned groups that work everywhere directory groups do (peering allow-lists, the admin group) — one namespace with the directory, collisions refused. Directory accounts and groups stay read-only: identity is consumed, not implemented. See docs/handbook/groups.md.
  • Deleted files (on by default, storage.trash.enabled): deletes move to a per-user trash with restore/purge in the UI and API; deletions inside a shared space land in the space's own trash, visible to all members, restorable by members who can edit; they delete for good only what they deleted; the owner of a Cairn space and administrators can delete anything. A delete in a folder shared with someone goes to the owner's trash and names the person who deleted it. A deleted space is one entry that Restore space brings back whole (deactivated, with its members and settings), and its name stays reserved while the entry exists. Admins govern the whole lifecycle from the Deleted files admin topic: the retention window, a deliberate never-delete-automatically mode (the default), instance-wide manual purge, and a purge log of every final deletion while access logging is on.
  • File versions — every overwrite (web, WebDAV, resumable uploads, the document editor, a move or copy onto a file) keeps the previous content as an encrypted version beside the file, also when several saves of one file land at once: 10 per file / 90 days by default, office autosaves keep at most one version per person per merge window besides the first, identical saves leave the file as it is, never billed to anyone's quota. When the previous content cannot be kept, the overwrite is refused and the file stays as it is. Anyone who can change a file can restore a version; restore is itself undoable. No database: the version list is a storage listing. See VERSIONING.md.
  • Data governance — append-only audit log (GET /api/v1/admin/audit; on S3 sealed into the bucket as encrypted, hash-chained segments that cairnd audit-verify checks, optionally mirrored to stdout for log shippers), legal holds that block delete/overwrite/rename for everyone (admins included), path retention windows, a trash lifecycle (retention sweep and admin manual purge, both behind retention + hold guard rails, with a purge log), read-only spaces (a -ro directory group is mounted view-only), and per-file locks — user- or Office-held, folder locks for space owners, an optional instance-wide expiry cap, and a live admin Locks inventory with audited break-lock — plus optional download marking for leak tracing: authenticated downloads of PDF/Office/image files carry an invisible pseudonymous mark, so a leaked copy can be traced to the exact download it came from (evidence, not a verdict — and off by default, with the per-country legal homework shipped in the handbook). Admin-driven, with UI.
  • Virus scanning of uploads (optional): every upload, on every surface (web, WebDAV, resumable uploads, public upload links, editor saves, version restores, peering, OCM), is checked by clamd or an ICAP server while it streams, before it is encrypted; an infected file is never stored and the uploader sees what was found. Administrators choose what happens while the scanner is down and over the scan limit, see outages, stale signatures and every file stored without a check, and every finding is audited. Optional clamd sidecar in the Helm chart and the compose example. See docs/handbook/virus-scanning.md.
  • Quota — reporting (GET /api/v1/quota, WebDAV RFC 4331) plus enforced maxFileBytes / maxTotalBytes / reserveBytes (POSIX only) / per-user perUserBytes limits → 507 on breach, and per-space limits set by administrators (1 GB default for new spaces, adjustable). Uploads that would not fit are refused before any byte moves, all or nothing; a warning level shows people a banner and notifies admins about full spaces. See docs/handbook/spaces-quota.md.
  • At-rest encryption — optional age-based content encryption with per-user and per-space keys held in the Keycloak profile, an OpenBao KV mount (uniform custody for AD deployments), or a single deployment key with per-instance domain separation. Always encrypts to a recovery recipient so key-loss ≠ data-loss (age -d works offline) — and the same offline drill opens the encrypted instance-state objects, so your instance's identity is as recoverable as its files. Optional post-quantum mode: hybrid ML-KEM-768+X25519 identities with automatic upgrade-on-touch migration. See docs/handbook/encryption.md and ENCRYPTION-COMPARISON.md.
  • Fair-code licensing, built to never hurt you — free for up to 50 users with no license key — and no key installed means no phone-home, ever. With a licence, above or below 50 users: Ed25519-signed keys verified fully offline, a monthly check-in carrying the licence id and nothing else, a 30-day grace window, and enforcement that only ever blocks new sign-ins over the cap — existing users and file access are never touched. Admin panel: paste-to-install, and one-click Remove licence for an instant, harmless return to the free tier.
  • Ops — Prometheus /metrics, /healthz, graceful shutdown, admin API (/api/v1/admin/*), structured logs. Multi-arch images (amd64/arm64) built by CI via ko; Helm chart at deploy/chart.

Quick start

make build
cp example.config.json config.json   # starts as it is: local accounts, files under /data
./bin/cairnd -config config.json

example.config.json stores files under /data. To run the binary as an ordinary user, create /data writable for it, or add storage.root, tusSpoolDir and peering.stagingDir pointing at writable paths. The first start prints a one-time setup token to the log: open http://localhost:7420/setup, paste it and create the first administrator. Then use the web UI at http://localhost:7420, or mount http://localhost:7420/dav/ as a network drive with any WebDAV client. To declare the administrator instead, set CAIRN_ADMIN_USERNAME and CAIRN_ADMIN_PASSWORD_HASH (a hash from ./bin/cairnd hash-password).

Docker (first cp example.config.json deploy/config.json, set CAIRN_IMAGE to the released image and replace the placeholder line in deploy/secrets/admin_hash with a break-glass hash; the image runs as uid 65532, so the data directory must be writable by it; the compose file's header says how):

docker compose -f deploy/docker-compose.example.yml up -d

Kubernetes (Helm): see docs/handbook/deploy-kubernetes.md.

helm install cairn deploy/chart -n cairn --set image.repository=<your registry>/cairn -f your-values.yaml

Configuration

Minimal (local auth, POSIX storage):

{
  "listen": ":7420",
  "storage": { "driver": "posix", "root": "/data" },
  "auth": {
    "mode": "local",
    "users": [{ "username": "admin", "passwordHash": "<cairnd hash-password output>" }]
  },
  "enableWebdav": true
}

Everything else is opt-in blocks on top of this: auth.mode: "oidc" or "ldap" with their settings, storage.driver: "s3" (or "setup"), shares, storage.quota, storage.trash, storage.encryption, log.level, auth.admins, auth.adminGroups, auth.perUserHomes, auth.oidcLogoutUrl, license, peering, preview, office, tls. Every key and every CAIRN_* variable, with its default, whether it is a secret and when it applies, is in docs/handbook/configuration-reference.md. Two example files ship: example.config.json (local accounts, POSIX) starts as it is; example.config.oidc-s3.json (OIDC, S3, encryption) needs its S3 credentials, a deployment identity and a reachable identity provider first. A misspelled key stops the start with a message naming it. Operator guides live in docs/handbook/.

Secrets come from env instead of the file: CAIRN_S3_SECRET_KEY, CAIRN_OIDC_CLIENT_SECRET, CAIRN_LDAP_BIND_PASSWORD, CAIRN_ENC_RECOVERY_IDENTITY, CAIRN_LICENSE_KEY, and friends (env wins). Each also accepts CAIRN_X_FILE, the path of a file holding it (Vault or OpenBao Agent, CSI, Compose and Kubernetes secrets).

Non-goals

Deliberately out of scope, so Cairn stays one auditable binary: calendars, contacts, office suites (in-browser editing plugs in via WOPI from a separately deployed editor — Cairn ships none of its code), app stores and plugins, per-file ACLs, a metadata database, and a full-text search index. File versions are not on this list: they are plain objects beside the data, no database (VERSIONING.md). See ARCHITECTURE.md §2.

Contributing

UI wording follows the language guide (EN, DE, DE-CH, FR, IT).

License

Fair-code / source-available: free for personal use and organizations up to 50 users; commercial license required above that or to offer Cairn as a hosted service — purchased at www.swisscairn.ch. See LICENSE.md. Cairn is not OSI open source and does not claim to be. Use of the software — both tiers — is additionally governed by the EULA: what data reaches the vendor (nothing without a licence key; the licence id only, with one), warranty, liability, and the operator's responsibility for lawful use of the optional monitoring features.