跳到正文
Skillpedia
部署与云(DevOps)35k · #8061

implementing-immutable-backup-with-restic

它能做什么

这个工具可以创建在设定期限内无法删除或更改的备份,保护你的数据免受勒索软件或误删除的影响。它还会验证备份是否完整,并测试恢复流程。

适用场景

  • ✓设置能够抵御勒索软件的备份时。
  • ✓需要一份无法修改的数据副本(WORM)时。
  • ✓需要自动验证备份并测试恢复时。

技能链接

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-immutable-backup-with-restic/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-immutable-backup-with-restic/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“为我的重要文件设置不可变备份,保留期为 90 天。”

每周 5 个新技能,1 分钟读完。

工作原理

它使用名为 Restic 的程序对数据进行加密,并将其存储在安全的位置(如 Amazon S3 或 MinIO)。这种设置确保数据一旦存入,在设定的保留期结束之前都无法被删除或修改。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Implementing Immutable Backup with Restic

When to Use

  • Establishing ransomware-resistant backup infrastructure with cryptographic integrity verification
  • Implementing 3-2-1-1-0 backup strategy where the extra 1 is an immutable copy
  • Automating backup verification workflows that test restore capability on a schedule
  • Protecting backup repositories from deletion or modification by compromised admin accounts
  • Meeting compliance requirements for data retention with tamper-proof storage

Do not use as the sole backup solution without also maintaining offline/air-gapped copies. Object lock protects against logical deletion but not physical storage failure.

Prerequisites

  • restic binary installed (https://restic.readthedocs.io/)
  • S3-compatible storage with Object Lock enabled (AWS S3, MinIO, Backblaze B2)
  • Python 3.8+ with subprocess module
  • AWS CLI or MinIO client (mc) configured for bucket access
  • Sufficient storage for backup repository (typically 2-3x source data with deduplication)

Workflow

Step 1: Initialize Restic Repository with Encryption

Create an encrypted restic repository on S3-compatible storage with object lock enabled. Restic uses AES-256-CTR for encryption with Poly1305-AES for authentication, ensuring backup data is both confidential and tamper-evident.

Step 2: Configure Object Lock Retention

Enable S3 Object Lock in Compliance mode on the backup bucket to prevent any principal (including root) from deleting or modifying objects during the retention period. Set retention to match your backup window requirements (typically 30-90 days).

Step 3: Automate Backup and Verification

Schedule backup operations with post-backup integrity verification using restic check --read-data which downloads and verifies every data blob against its stored checksum. Log results and alert on any integrity failures.

Step 4: Test Restore Procedures

Periodically restore random files from backup snapshots to a temporary location and compare checksums against the original to validate end-to-end backup integrity. Document restore times for RTO planning.

Key Concepts

Term Definition
Object Lock S3 feature that prevents object deletion or overwrite for a specified retention period
Compliance Mode Object Lock mode where even the root account cannot delete objects before retention expires
Deduplication Restic stores data in content-addressable chunks, deduplicating across all snapshots
3-2-1-1-0 3 copies, 2 media types, 1 offsite, 1 immutable, 0 errors in verification

Tools & Systems

  • restic: Fast, secure, cross-platform backup tool with built-in encryption and deduplication
  • resticpy: Python wrapper for restic CLI operations
  • AWS S3 Object Lock: WORM storage for tamper-proof backup retention
  • MinIO: Self-hosted S3-compatible storage with Object Lock support

Output Format

BACKUP VERIFICATION REPORT
===========================
Repository: s3:s3.amazonaws.com/company-backups-immutable
Snapshots: 45
Total Size: 2.3 TiB (deduplicated from 8.7 TiB)
Last Backup: 2026-03-11T02:00:00Z
Integrity Check: PASSED (all packs verified)
Object Lock: Compliance mode, 90-day retention
Restore Test: PASSED (15 files verified)
常见问题

“不可变”是什么意思?

意思是数据一旦存储,在设定的期限内就无法被删除或修改,就像刻在石头上一样。

什么是 Object Lock?

这是某些存储服务(如 Amazon S3)提供的一项功能,可用于创建这类不可变备份。

我还需要其他备份吗?

需要。这个工具是额外的一层保护。建议同时保留离线或异地的副本,即采用 3-2-1 备份策略。

详情

作者的原始描述

Implements ransomware-resistant backups using restic with S3-compatible Object Lock (AWS S3, MinIO, Backblaze B2), automating backup creation, integrity checks via restic check --read-data, retention enforcement, and restore testing. Use when building immutable backup infrastructure, adding a WORM copy to a 3-2-1-1-0 strategy, or automating scheduled backup-verification workflows. '

repo: mukul975/Anthropic-Cybersecurity-Skills

热度

GitHub 星标
35k
排名
#8061
许可证
Apache-2.0
更新时间
2026/8/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能