Repository navigation
feat(backup): nightly encrypted export of neo's RouterOS config - #1710
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues allow incomplete backups to pass verification and make recovery steps fail, while exposing decrypted configuration and leaving the default administrator enabled.
6 open issues
Create the switch backup directory before copying the export · New Restrict permissions on the decrypted configuration file · New Restore the missing certificate before importing the switch configuration · New Import the SSH public key using RouterOS's supported command · New Disable the recreated default admin account after verifying access · New Reject RouterOS export-error markers during verification · New
What changed in this PR
Adds nightly encrypted backups of neo’s RouterOS configuration by reusing the existing firewall backup pipeline, with separate switch settings and recovery instructions.
Changes:
- Adds a switch profile that exports, encrypts, verifies, copies to oracle, and retains configuration backups.
- Schedules the backup at 09:45 with job monitoring and a three-day staleness threshold.
- Extends encryption-policy checks and documents backup coverage and restoration.
| File | Description |
|---|---|
systemd/README.md |
Lists the switch backup schedule. |
systemd/homelab-backup-switch.timer |
Schedules the daily 09:45 backup. |
systemd/homelab-backup-switch.service |
Runs the monitored switch backup job. |
scripts/README.md |
Documents the shared device-backup script. |
scripts/install-timers.sh |
Registers the switch job and staleness threshold. |
scripts/check_sops_rules.py |
Checks encryption-policy coverage for switch exports. |
scripts/backup-firewall.sh |
Adds switch-specific export settings and verification. |
Makefile |
Adds the backup-switch target. |
docs/runbooks/swap-the-switch.md |
Adds export recovery and restoration instructions. |
docs/runbooks/schedule-maintenance.md |
Documents scheduling and backup monitoring. |
docs/network.md |
Records the backup account and export destinations. |
docs/changelog.md |
Records the new switch backup capability. |
.sops.yaml |
Extends the shared encryption rule to switch backups. |
Review effort: Balanced
Gerrrt
enabled auto-merge (squash)
November 24, 2026 04:55
neo's configuration lived only on the switch. backup-firewall.sh gains a BACKUP_DEVICE=switch profile (make backup-switch): it logs in as a read-only `backup` user through morpheus, takes /export, and reuses the firewall export's encrypt, verify, copy-to-oracle and retention unchanged. The switch's knobs are SW_*, so a firewall override in the shared environment file cannot move its exports. homelab-backup-switch.timer runs it at 09:45; swap-the-switch.md gains the restore and what the export leaves out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The export check now refuses an export with RouterOS's #error lines. The restore makes the destination directory, decrypts with umask 077, imports the certificate before the config, and disables the admin user a reset brings back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gerrrt
force-pushed
the
gerrrt/neo-config-backup
branch
from
November 24, 2026 05:47
dc1bd6d to
0eaa611
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed
neo's configuration is now backed up every night.scripts/backup-firewall.shgains aBACKUP_DEVICE=switchprofile, run bymake backup-switch. It:backupon neo, through morpheus;/export;oracle, and keep thirty on each side.homelab-backup-switch.timerruns it daily at 09:45.SW_*prefix (SW_KEEP,SW_OFFHOST,SW_HOST,SW_USER,SW_JUMP). They never readFW_*, so an override meant for the firewall in/etc/default/homelab-timerscan't move the switch's exports..sops.yamlcatch-all rule now also coversbackups/switch/, andcheck_sops_rules.pychecks that path.install-timers.shgets abackup-switchrow with a 3-day staleness threshold, the same asbackup-firewall.swap-the-switch.mdgets a restore section. It lists the four things the export leaves out: users, the certificate, the SNMPv3 passphrases and device-mode.network.md,schedule-maintenance.md, both READMEs and the changelog are updated.Why
A re-check after the switch audit found that neo's configuration existed only on the switch. If neo died, it would have to be rebuilt by hand from
network.mdand the wiki's port map.Blast radius
neo: has one new user,
backup. Its group hasreadandsshonly, its address is limited to10.7.7.1/32, and it logs in withprometheus's key only, because RouterOS refuses a password for a user that has a key. A test write asbackupwas refused withnot enough permissions.The firewall export: its path is unchanged. Both self-tests pass, and the recipient lookup still reads the same rule.
Not offsite:
backup-offsite.shdoesn't carry the switch export. A fire that destroys bothprometheusandoraclealso destroys the switch, and its rebuild is documented.No change to network segmentation or firewall rules
No new port published to a VLAN that could not already reach the service
No credential added outside
secrets/*.sops.yaml(a public key on the switch, no secret)Verification
A test run,
BACKUP_DEVICE=switch ./scripts/backup-firewall.sh --local-onlyfrom a worktree, printedverified config-…sops.yaml — RouterOS 7.24.6, 7 input filter rules. The file was encrypted to both recipients. I then deleted it.The plaintext export contains no
password=, passphrase or private-key line.--self-testpasses for both devices.shellcheck,check_sops_rules.py,check_docs.py,lint.shandinstall-timers.sh --checkpass.The full run with the copy to oracle and the timer install happen from the deployed checkout after merge.
make validatepasses (running; result in a comment)Deployed to the lab and confirmed working (after merge)
Docs updated (
docs/, service README, ordocs/roadmap.md)🤖 Generated with Claude Code