In development

Sard Cocoon

Protected restic backup storage. Saved backups cannot be destroyed before their protection term ends, even if the control server, the agents on the hosts, the prune account and the storage’s own network front end are compromised. From the outside it is an ordinary restic REST server, so Cocoon plugs into Sard and into any restic as it is.

A backup that outlives ransomware

Ransomware or an attacker who gets into the infrastructure deletes the backups first. The usual protections are weak:

Ordinary restic pruning, and nothing is lost

The protection sits below restic and needs no understanding of the backups’ contents. restic files are never rewritten: a file’s name is the SHA-256 of its content, only the set of files changes. Cocoon regularly commits a checkpoint, an immutable set of all the repository’s files, including those deleted since the last one. A checkpoint is hard links to the same files; no data is copied.

restic deletes and prunes in the live repository as usual, and a deleted file stays in the checkpoint until that checkpoint expires. The Linux kernel (fs-verity) keeps the files immutable, and one small trusted process keeps the terms and the checkpoints. Cocoon knows neither restic keys nor the contents of the backups.

Works with plain restic

Any unmodified restic runs init, backup, forget, prune, restore and check. The data format and the protocol are standard: Cocoon works without the rest of Sard too, and your backups stay ordinary restic repositories. The code is based on restic rest-server.

A restore reads the live repository or any checkpoint as a separate read-only repository.

Its place in Sard

In Sard, Cocoon stands next to S3, SFTP and the local disk: the agent writes to it as to any restic REST server, and restore verification proves the backup is right. The Sard control server still holds no keys, and with Cocoon it cannot delete what is saved either.

Four processes, one trusted

One cocoon binary, separate processes under separate Linux users, run by systemd:

Three accounts per repository

Who can do what when compromised

CompromisedCanCannot
Control server or agentwrite garbage, fill the quotadelete or change what is saved
The prune account with the restic keydelete everything in the live repositorytouch a checkpoint
Frontwhatever the accounts allowwrite around Guard and Sealer
Guardstop writes, lose what is not yet publishedchange what is published, skip a checkpoint
Sealerdelete checkpoints on this hostchange the contents of files
root on the hostanything on this hosta replica on another machine, Object Lock

Guarantees

Where the guarantees end

We say plainly what Cocoon does not protect from:

Retention

A checkpoint is made after a completed backup and on a schedule, if there are new files. Retention is by time, not by count: “the last N” would be pushed out by N garbage backups from a compromised agent. Every checkpoint of the last day, hourly ones for a week, then daily, weekly and monthly.

How reliability is checked

Every property of Cocoon is backed by a test with its output kept: immutability and rights at the kernel level (fs-verity on ext4 and btrfs), unmodified restic, a TLA+ model of the trusted process, attacks on every component, power loss at every flush point. The order of priorities does not change: security, then fault tolerance, then performance; guarantees are never weakened for speed.

Next in the product

Requirements and license

Linux, an ext4 filesystem with fs-verity or btrfs. One node is meant for about 100–200 repositories of small and mid-sized businesses; more means more nodes. The license is AGPL-3.0, the rest-server code is BSD-2-Clause.

When

Sard Cocoon is in development and is not part of a Sard release yet.