Optional filesystem-enforced retention locks for native ZFS snapshots

Problem/Justification

Native ZFS snapshots preserve historical data, but a compromised Full Administrator account or API key can release snapshot holds and delete the recovery points. Scheduled snapshot lifetimes do not prevent early administrative deletion, and S3 Object Lock does not provide a retention lock for existing native ZFS snapshots.

Please consider an optional filesystem-enforced retention lock for manually created and scheduled ZFS snapshots:

  • Apply the lock atomically at snapshot creation. Allow extending the deadline, but prohibit shortening or removing an active lock, including by Full Administrators.
  • Enforce it below the middleware layer. Supported UI, API, CLI and ordinary root-level ZFS operations must not bypass it through hold release, snapshot deletion, destructive rollback, or deletion of the parent dataset or pool.
  • Preserve the lock across reboots, upgrades and pool import. System-clock changes must not cause early expiry.
  • Require explicit opt-in and irreversible-action confirmation. Show expiry dates and capacity warnings, and allow normal cleanup after expiry.

The goal is to withstand compromised administrative credentials and normal management operations. Direct block-device corruption, malicious kernel replacement, external encryption-key destruction and physical media destruction are outside the requested guarantee. This may require upstream OpenZFS work; a middleware-only restriction would not meet the requested boundary.

Impact

This would preserve a defined local recovery window when ransomware obtains administrative credentials, helping protect business file servers and on-premises backup repositories. My immediate use case is a home NAS, but the security gap is also relevant to Enterprise deployments.

Holds with restricted administrators, independently administered backup systems and immutable object-storage targets are useful workarounds. They do not provide this specific guarantee for native snapshots on the primary system. Independent backups would remain necessary.

User Story

As a TrueNAS administrator, I want to explicitly enable a 30-day retention lock on selected snapshot tasks. Once a protected snapshot is created, even my Full Administrator credentials cannot delete it or shorten its retention through supported management operations. I can restore or clone data while it is locked, and normal retention cleanup resumes after expiry. Before enabling the feature, I see clear warnings that locked snapshots can consume space that cannot be reclaimed early.

I’m not sure this exists in upstream OpenZFS. You may want to submit a feature request there instead of here.

+1 on this. One thing I’d add from what we see after incidents: a lock protects the snapshot from being deleted, it doesn’t tell you what’s inside it. If someone had admin for a couple of weeks before they started encrypting, the older locked snapshots can already have their scripts or a first batch of encrypted files in them. So the lock window is great, but you still have to open the candidates and look before picking one.

Until something like this exists upstream, the closest thing I’ve seen work is a second box that pulls replication over SSH, with its own admin accounts and its own retention. A stolen key on the primary can’t reach those copies.

Disclosure: I’m founder of CyberSnap.

I kind of get the idea here but if I have compromised your admin account how does preventing me from deleting a snapshot help you? Surely if I was that way inclined I’d just zpool destroy yourpool and then your snapshots become irrelevant. At this point zpool checkpoint yourpool becomes interesting but again nothing stopping someone doing zpool checkpoint -d yourpool (however its not as well known).

I think the comment about PULL replication with a limited privileged user and a different retention is a good one and probably the best you are going to get other than using a different technology to backup with.