Skip to main content

Mikrotik RouterOS backup tool

Installation

python3 -m pip install rosbak

What is rosbak

rosbak is a Python command line tool which allows backup Mikrotik RouterOS routers and switches.

Keeping backup files inside RouterOS is usually unsafe, as when the equipment fail, you have no access to them.

rosbak performs RouterOS backup and copies files to the specified location.

Requirements

  • Python >= 3.9 and PyYAML >= 6.0
  • OpenSSH clients with legacy SCP support (scp -O, OpenSSH >= 8.7)
  • RouterOS >= 6.45, as rosbak uses scp
  • RouterOS ssh service should be turned on
  • You should have an access to RouterOS host

Usage

rosbak [options] <host>

e.g.

rosbak -d /backups router1

Configuration

You may put configuration to /usr/local/etc/rosbak.yml

Configuration contains global variable dir which points to default backup location (you may use {host} param e.g. /backups/{host}, in this case backups are stored e.g. to /backups/router1)

Host sections in configuration file may contain router IP (addr), port, backup delay, etc.

Configuration file is optional.

Why backup delay

RouterOS performs backups in background. Backup delay param is required to ask rosbak wait the specified number of seconds before copying backup.

Export

Command line param -x or export: true in host configuration tells rosbak to perform configuration export as well (/export file=...)

Configuration exports are useful when you need to restore backup partially, manually copying settings one-by-one (e.g. when restoring it on the another model).

rosbak is provided as-is under MIT license. rosbak is a 3rd party tool and is not affiliated with SIA Mikrotīkls.

Version 0.1.0

Uses safe YAML loading (compatible with PyYAML 6), argument-list subprocesses instead of local shell commands, and legacy SCP explicitly for RouterOS when using modern OpenSSH clients. Existing configuration files and CLI options are retained. Precedence: CLI > host section > global settings > defaults; explicit false and delay 0 are respected. Empty YAML files are allowed. Backup names accept letters, digits, dots, underscores and hyphens, not paths.

SSH uses batch mode and existing host-key verification: authorize the key and verify the host interactively first. No passwords or host-check bypasses. Nested destination directories are created automatically. Downloads use private temporary files and atomic replacement; local backups are mode 0600. Remote backup/export files are removed only after all downloads succeed, unless --keep is set. Errors return exit status 1. Avoid concurrent backups with the same custom name. --delay remains available for slower devices.

Development checks:

python3 -m unittest discover -s tests -v
python3 -m pip wheel --no-deps . -w dist

Metadata

Release files for rosbak 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rosbak 0.1.0
File Size Uploaded Provenance Actions
rosbak-0.1.0.tar.gz 7.5 kB Without provenance Details for rosbak-0.1.0.tar.gz

Release files / rosbak-0.1.0.tar.gz

Download URL rosbak-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9f7279563a7e52f3005ab54acd12400d3a8d9f26c7718f0c06a8a773e3788c49
BLAKE2b-256 checksum
How to use checksums
8cfb2b8e0b9a2ae17e1a253395121c6ff153d68e55c78f8a3f22ae83d55902b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for rosbak 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page