3-2-1 Backup Rule for a Crypto Exchange: Nightly Script
3-2-1 backups for a crypto exchange office: what to back up, a nightly restic script with encryption, router and Omada configs, a removable drive, a drill.
On this page
Ransomware goes after backups first, and in a theft or fire a backup on a drive next to the computer leaves with it — so the transaction log, KYC and network settings end up being rebuilt from memory. After these steps, every night the transaction log, accounting, KYC and network configurations are copied to storage in the office and to an encrypted cloud repository; once a week they go to a drive the owner takes home; every morning the owner gets a "backup done" message in Telegram; and a restore has been tested and timed.
Plan
| Step | What we do | Time |
|---|---|---|
| 1 | List what to back up and how long to keep it | 20 min |
| 2 | Set up storage in the office with a separate account | 30 min |
| 3 | Set up an encrypted cloud copy (restic) | 30 min |
| 4 | Write the nightly backup script | 30 min |
| 5 | Automate exporting router, Omada and NVR configurations | 30 min |
| 6 | Set up two removable drives in rotation | 20 min |
| 7 | Set the schedule and notifications | 15 min |
| 8 | Test a restore | 1 hour every six months |
What real incidents have shown
- Ransomware goes after backups first: CISA's Known Exploited Vulnerabilities catalog includes vulnerabilities in backup systems (for example, Veeam CVE-2023-27532 and CVE-2024-40711) that ransomware groups used to delete or encrypt backups before the main attack.
- Maersk, NotPetya (2017): recovery hinged on a single domain controller that happened to be offline during the attack — in other words, a copy that could not be reached over the network.
- Robberies and fires: a backup on a drive next to the computer leaves with it.
What follows from this:
- A backup reachable from a work computer gets encrypted along with it → the cashier has no access to the backup storage (step 2).
- An attacker can delete backups if they know the storage password → only the backup account has the password, and the password files are locked down with permissions (steps 2, 4).
- The office copy is lost in a theft or fire → a cloud copy every night (step 3).
- Outsiders could read the cloud copy → encrypt on your side before upload (step 3).
- You need a copy that can't be reached over the network → a removable drive that goes home with the owner once a week (step 6).
- After a router is replaced, the network gets configured from memory → a nightly configuration export (step 5).
- The backup job silently stops working → a daily message to the owner; no message means investigate (step 7).
- A backup you have never restored from may be empty → a drill every six months (step 8).
Step 1. List what to back up and how long to keep it
| What | Where it usually is | How often | How long to keep |
|---|---|---|---|
| Transaction log | C:\journal or accounting software (AML log) |
every night | at least the period required by AML law (in Georgia, according to Andersen's overview, 5 years after the end of the client relationship or the one-off transaction; confirm with a lawyer) |
| AML reports | C:\journal\aml |
every night | together with the log |
| Accounting | accounting software | every night | per tax law |
| KYC forms and scans | encrypted storage (KYC article) | every night | per AML law, no longer than needed |
| Router and switch configuration | MikroTik / Omada | every night | last 30 |
| NVR configuration | NVR | after every change | last 5 |
| Important video footage | export from the NVR | on event | case by case |
Not backed up: wallet seed phrases — paper or metal in a safe only (where to store USDT). Databases of running programs are backed up with the program's own tools (an export), not by copying open files.
Done when: the table is filled in and every row has a known path on disk.
Step 2. Set up storage in the office with a separate account
Why: if the cashier (and therefore any malware running under the cashier's account) can open the backup folder, the backups get encrypted along with the data.
How.
- A network storage device (NAS) or a second computer on the staff network. On it — a shared folder
backupand a userbackupwith its own long password. Permissions on the folder — only forbackup. - On the computer that runs the backups — a local user
backup(standard, not an administrator) and a locked-down folder for secrets:
# PowerShell as administrator
$pw = Read-Host "Password for user backup" -AsSecureString
New-LocalUser -Name "backup" -Password $pw -PasswordNeverExpires
New-Item -ItemType Directory C:\backup\secrets | Out-Null
icacls C:\backup\secrets /inheritance:r /grant:r "backup:(OI)(CI)R" "*S-1-5-32-544:(OI)(CI)F"
- Passwords for the NAS and the cloud — one per file in
C:\backup\secrets(nas.txt,restic.txt,s3.txt). Onlybackupand administrators can read them. - Check that the cashier can't see the storage: sign in as
kassirand open\\NAS\backup— access is denied.
Done when: the storage opens only as backup; the cashier gets "Access is denied".
Step 3. Set up an encrypted cloud copy (restic)
Why: an off-site copy the cloud provider can't read, with version history.
How.
- Create a bucket in S3-compatible storage (Backblaze B2, Wasabi, Cloudflare R2, etc.) and an access key limited to that bucket. Put the key in
C:\backup\secrets\s3.txt(two lines: ID and secret). - Install restic:
winget install restic.restic. - Choose a repository password (20+ characters) and store it in two places: in
C:\backup\secrets\restic.txtand on paper in the safe together with the business continuity plan. Without this password nobody can open the backup — including you. - Create the repository (as the
backupuser):
$s3 = Get-Content C:\backup\secrets\s3.txt
$env:AWS_ACCESS_KEY_ID = $s3[0]; $env:AWS_SECRET_ACCESS_KEY = $s3[1]
$env:RESTIC_REPOSITORY = "s3:https://<endpoint>/<bucket>/obmen"
$env:RESTIC_PASSWORD_FILE = "C:\backup\secrets\restic.txt"
restic init
restic encrypts everything on your computer before upload, keeps versions and doesn't duplicate unchanged data.
Check: restic snapshots — an empty list with no errors.
Done when: the repository is created and the password is written on paper in the safe.
Step 4. Write the nightly backup script
How. C:\backup\backup.ps1:
$ErrorActionPreference = "Stop"
$day = Get-Date -Format "yyyy-MM-dd"
$src = @("C:\journal", "C:\Obmen\Uchet\export", "C:\backup\configs")
$nas = "\\NAS\backup"
$bot = Get-Content C:\backup\secrets\bot.txt # line 1 — token, line 2 — chat_id
function Send($t) { Invoke-RestMethod -Method Post "https://api.telegram.org/bot$($bot[0])/sendMessage" -Body @{ chat_id = $bot[1]; text = $t } | Out-Null }
try {
# 1. office storage
net use $nas (Get-Content C:\backup\secrets\nas.txt) /user:backup | Out-Null
foreach ($s in $src) {
$name = Split-Path $s -Leaf
robocopy $s "$nas\$day\$name" /E /R:2 /W:5 /NP /LOG+:"C:\backup\logs\$day.log" | Out-Null
if ($LASTEXITCODE -ge 8) { throw "robocopy ${s}: exit code $LASTEXITCODE" }
}
Get-ChildItem "$nas\$day" -Recurse -File | Get-FileHash -Algorithm SHA256 |
Export-Csv "$nas\$day.sha256.csv" -NoTypeInformation
net use $nas /delete | Out-Null
# 2. cloud (restic)
$s3 = Get-Content C:\backup\secrets\s3.txt
$env:AWS_ACCESS_KEY_ID = $s3[0]; $env:AWS_SECRET_ACCESS_KEY = $s3[1]
$env:RESTIC_REPOSITORY = "s3:https://<endpoint>/<bucket>/obmen"
$env:RESTIC_PASSWORD_FILE = "C:\backup\secrets\restic.txt"
restic backup @src --tag nightly -q
if ($LASTEXITCODE -ne 0) { throw "restic backup: exit code $LASTEXITCODE" }
restic forget --keep-daily 30 --keep-monthly 24 --prune -q
$last = (restic snapshots --latest 1 --json | ConvertFrom-Json)[0]
Send "Backup $day done: office + cloud, snapshot $($last.short_id)"
} catch {
Send "BACKUP FAILED $day : $($_.Exception.Message)"
}
robocopyexit code 8 or higher means an error; anything lower is normal.--keep-daily 30 --keep-monthly 24keeps 30 daily and 24 monthly versions; set your own period from the step 1 table.- The AML log already backs up its own database; here the whole
C:\journalfolder is copied — with exports and AML reports. bot.txtholds the bot token and the owner'schat_id, the same as in the article Where to store USDT, step 8.
Done when: a manual run as backup produces a "Backup … done" message.
Step 5. Automate exporting configurations
MikroTik
- On the router — a nightly export and a user that can only fetch files:
/system script add name=nightly-export source="/export show-sensitive file=router-auto\r\n/system backup save name=router-auto encryption=aes-sha256 password=\"<backup_password>\""
/system scheduler add name=nightly-export interval=1d start-time=01:30:00 on-event=nightly-export
/user group add name=backup policy=ssh,ftp,read
/user add name=backup group=backup password="<long_password>"
/user ssh-keys import public-key-file=backup.pub user=backup
Create the backup.pub key on the backup computer: ssh-keygen -t ed25519 -f C:\backup\secrets\mikrotik, and upload the .pub file to the router via Winbox → Files.
- In
backup.ps1, right after thetry {line — fetch the files:
scp -i C:\backup\secrets\mikrotik -o StrictHostKeyChecking=yes backup@10.10.30.1:/router-auto.rsc "C:\backup\configs\router-$day.rsc"
scp -i C:\backup\secrets\mikrotik backup@10.10.30.1:/router-auto.backup "C:\backup\configs\router-$day.backup"
.rsc is plain text: readable and portable to another device, and it contains secrets. .backup restores on the same device and is encrypted with the backup password (the password is on paper in the safe).
TP-Link Omada
Controller 5.8 and later: Global View → Settings → Maintenance → Auto Backup: enable, daily, keep 30 copies (the maximum number of files). Make a manual backup before any change — in the same Maintenance section, Backup.
Where to put the automatic backups: according to TP-Link's documentation, the software controller stores them on its own computer or on a file server, and the OC200 on a USB drive or a file server. The documentation doesn't name the local folder path on Windows, so the simplest option is to set the office storage from step 2 as the file server — the automatic backups land there right away and go to the cloud with everything else. If you keep the backups on the controller's computer, find the folder by the latest .cfg file and add it to $src in the script.
Hikvision NVR
NVRs usually have no automatic export. After every settings change: Configuration → System → Maintenance → Upgrade & Maintenance → Export the configuration → save the file to C:\backup\configs with the date in its name. The file is protected with the device password — write down which one.
What the screen looks like. The Auto Backup section of the Omada controller has an enable toggle, the frequency (daily, weekly, monthly), the backup time, how much data goes into the backup (you can choose settings only) and the maximum number of files: when it's exceeded, the oldest is deleted. Below is a list of existing backups with name, time and size, and buttons to restore, download and delete.
Done when: every morning a fresh router-DATE.rsc appears in C:\backup\configs, and a fresh automatic backup appears in the Omada folder.
Step 6. Set up two removable drives in rotation
Why: a copy that physically can't be reached over the network survives ransomware, a compromised cloud account and the loss of the office.
How.
- Two external drives — "A" and "B". Turn on BitLocker on each: File Explorer → right-click the drive → Turn on BitLocker → password; write the recovery key on paper and put it in the safe.
- Once a week (say, on Friday) the owner connects a drive and copies the latest backup from the storage:
robocopy \\NAS\backup E:\obmen /MIR /R:2 /W:5
then disconnects the drive and takes it home, bringing the other drive back. That way the copy at home is never more than a week old.
Done when: both drives are encrypted and the owner has a drive at home with a backup no older than 7 days.
Step 7. Set the schedule and notifications
How (PowerShell as administrator):
schtasks /create /tn "obmen-backup" /sc daily /st 02:00 /ru backup /rp * `
/tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\backup\backup.ps1"
/rp * prompts for the backup user's password. The computer must be on at 02:00: Settings → System → Power — no sleep on a timer, or pick the time the shift ends instead.
The owner's rule: no "Backup done" message in the morning means there is no backup. Investigate the same day: the log in C:\backup\logs.
Done when: the message has arrived every morning for a week straight.
Step 8. Test a restore
How. Every six months, on a spare laptop (or in a separate folder) and from an off-site copy:
# restic variables — as in step 3
restic check # repository integrity
restic snapshots
restic restore latest --target C:\restore-test
py C:\restore-test\C\journal\journal.py verify # path depends on how restic laid out the files
| Check | Done when |
|---|---|
restic check |
no errors |
| Log from the cloud | verify reports the chain is intact; three random transactions are found |
| Log from the removable drive | opens, and the checksum (.sha256.csv) matches |
| Router configuration | /import file-name=router-DATE.rsc on MikroTik CHR or a spare router — the rules are in place |
| Omada configuration | restore on a test controller — networks and SSIDs are in place |
| Time | everything fits within the acceptable downtime in the business continuity plan |
Write down a record: date, what was restored, how long it took, what didn't work. If you didn't make it in time, change the process.
Done when: every row of the table matches and the record is written.
Checklist
| # | What to check | How to confirm | ☐ |
|---|---|---|---|
| 1.1 | Every row of the table has a path | for every row of the step 1 table, the folder at that path opens and contains fresh files | ☐ |
| 1.2 | Every row has a retention period | the "How long to keep" column has a period, not a dash; for the log and KYC — confirmed with a lawyer | ☐ |
| 1.3 | Program databases are backed up via exports | $src in the script lists export folders, not folders with open program databases |
☐ |
| 1.4 | No seed phrases in the backed-up folders | the owner confirms seed phrases are only on paper or metal; the folders in $src contain no photos or text of them |
☐ |
| 2.1 | The cashier can't see the storage | under the cashier's account, \\NAS\backup gives "Access is denied" |
☐ |
| 2.2 | Only backup has permissions on the backup folder |
in the properties of the backup folder on the NAS — only the backup user and administrators |
☐ |
| 2.3 | Passwords are hidden from the cashier | as the cashier, type C:\backup\secrets\nas.txt gives "Access is denied" |
☐ |
| 3.1 | The cloud repository works | as backup, with the variables from step 3, restic snapshots prints a list with no errors |
☐ |
| 3.2 | The cloud key gives access to one bucket only | in the storage dashboard, the access key is limited to the backup bucket | ☐ |
| 3.3 | The repository password on paper in the safe is correct | restic snapshots with the password typed from the paper opens the repository |
☐ |
| 4.1 | A manual run succeeds | running backup.ps1 as backup produces a "Backup … done" message |
☐ |
| 4.2 | The office copy has checksums | \\NAS\backup has a folder for today and a <date>.sha256.csv file |
☐ |
| 4.3 | The backup log has no errors | C:\backup\logs\<date>.log has no ERROR lines |
☐ |
| 5.1 | The router export is fresh | C:\backup\configs has router-<today>.rsc and router-<today>.backup |
☐ |
| 5.2 | Omada auto backup is enabled | Settings → Maintenance → Auto Backup — enabled, daily; today's backup is in the list | ☐ |
| 5.3 | The NVR configuration isn't outdated | the date of the NVR file in C:\backup\configs is later than the last NVR settings change |
☐ |
| 6.1 | Both removable drives are encrypted | manage-bde -status E: for drive "A" and "B" shows "Protection On" |
☐ |
| 6.2 | The drives' recovery keys are in the safe | the 48-digit recovery password on paper in the safe matches the output of manage-bde -protectors -get E: for each drive |
☐ |
| 6.3 | The copy at home is no older than a week | on the drive at home, the latest backup folder is no older than 7 days | ☐ |
| 7.1 | The task runs as backup |
schtasks /query /tn obmen-backup /v /fo list — the task runs as user backup, time 02:00, last result 0 |
☐ |
| 7.2 | The message arrives every morning | the owner's Telegram has "Backup … done" for each of the last 7 days | ☐ |
| 7.3 | The computer doesn't sleep at night | Settings → System → Power — sleep set to "Never" when plugged in | ☐ |
| 8.1 | The cloud repository is intact | restic check — no errors |
☐ |
| 8.2 | The log from the cloud works | after restic restore, verify reports the chain is intact; three random transactions are found |
☐ |
| 8.3 | The router configuration restores | importing the .rsc on CHR or a spare router — the firewall rules are in place |
☐ |
| 8.4 | The restore record is recent | the record is no older than six months; the time fits within the acceptable downtime in the business continuity plan | ☐ |
Questions
Which cloud should I choose?
Any S3-compatible one with a clear price per gigabyte. restic encrypts on your side, so the cloud sees only encrypted blocks. The backups contain clients' personal data — account for this in your documents under the personal data protection law.
Do I need to back up the whole video archive?
No: it's large and gets overwritten every 30 days. Back up important footage on event; protecting the archive from theft of the NVR is a separate task (video surveillance article).
What is the 3-2-1 rule and how is it met here?
Three copies of the data, on two different types of media, one of them off-site. Here that's the working data, the office storage, the cloud and the removable drive — and there are two off-site copies: the cloud and the drive at the owner's home.
Can I just sync a folder to Google Drive or OneDrive?
Not as the main backup: syncing carries both encrypted and deleted files to the cloud. Such a cloud can be an extra location, but the main off-site copy should have versions and encryption on your side (step 3).
How do I back up 1C?
With 1C's own tools: a scheduled export of the infobase to a file in a folder the script picks up — for example C:\Obmen\Uchet\export from step 4. Don't copy the files of an open database: such a copy may not open.
Is a MikroTik .backup file enough to restore onto a new router?
Don't count on it: .backup restores on the same device. On a different router, import the text .rsc (step 5) and check the interface names — they may differ on another model.
Ransomware encrypted the computer. Where do I restore from?
First reinstall or replace the computer, and only then connect the backups; connect the removable drive to a clean computer, not to the infected network. Take a version from before the infection began: restic keeps daily snapshots (restic snapshots), and the copies in the office storage are in dated folders.
What happens if I lose the restic password?
Nobody can open the cloud backup, including you: according to the restic documentation, losing the password means irrecoverably losing the data. That's why the password is stored in two places, one of them on paper in the safe (step 3), and the step 8 drill checks that it works.
The log must be kept for five years — why are backup versions kept only 30 days and 24 months?
The log is append-only, so every fresh backup contains all of it, from the first entry. Old versions are there to roll back to the state before a failure, not as an archive; adjust forget to your own periods, but don't keep backups longer than the retention period for KYC documents.
Can I use ready-made backup software instead of a script?
Yes, if it gives you the same: a separate account, an encrypted off-site copy, a disconnected copy, a notification on every run and a tested restore. Update it right away: ransomware groups have used backup system vulnerabilities from the CISA catalog to destroy backups.
No "Backup done" message arrived this morning. What do I check first?
Whether the computer was on at 02:00, then the task's last result (schtasks /query /tn obmen-backup /v /fo list) and the log in C:\backup\logs. Until you find the cause, assume there is no fresh backup (step 7).
Note: Check retention periods against current legislation.
Sources
- restic — Documentation (backup, forget, check, restore)
- MikroTik — Backup / Configuration Management
- Microsoft — Robocopy
- CISA KEV — Veeam Backup & Replication CVE-2023-27532, CVE-2024-40711
- TP-Link Omada — How to Back Up and Restore Software Controller Configuration and Data (or OC200)
- TP-Link Omada — How to Get a Backup File on Omada Hardware, Software, and Cloud-Based Controllers above v5.8
- Andersen in Georgia — Georgia's Legal Framework for Virtual Asset Services (AML data retention period)
- restic — Preparing a new repository (losing the password means irrecoverable data loss)