All Projects → tenhishadow → mbkp

tenhishadow / mbkp

Licence: MIT license
Mikrotik backup script | simple bash script for doing encrypted backups of mikrotik devices(Routeros) via ssh. Script will do password-protected binary and encrypted with openssl export on regular basis

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to mbkp

perfectrestore
MikroTik config restore helper script
Stars: ✭ 53 (+152.38%)
Mutual labels:  mikrotik, mikrotik-backup-script, mikrotik-router
npk-tools
Mikrotik's NPK files managing tools
Stars: ✭ 63 (+200%)
Mutual labels:  mikrotik, routeros
RouterOS Useful Scripts
MikroTik RouterOS Useful Scripts for various use
Stars: ✭ 66 (+214.29%)
Mutual labels:  mikrotik, routeros
docker-routeros
Mikrotik RouterOS inside Docker container
Stars: ✭ 225 (+971.43%)
Mutual labels:  mikrotik, routeros
Chimay-Red-tiny
This is a minified exploit for mikrotik routers. It does not require any aditional modules to run.
Stars: ✭ 25 (+19.05%)
Mutual labels:  mikrotik, mikrotik-router
routeros-client
Abstraction layer over the node-routeros API
Stars: ✭ 63 (+200%)
Mutual labels:  mikrotik, routeros
Easy-HotSpot
Easy HotSpot is a super easy WiFi hotspot user management utility for Mikrotik RouterOS based Router devices. Voucher printing in 6 ready made templates are available. Can be installed in any PHP/MySql enabled servers locally or in Internet web servers. Uses the PHP PEAR2 API Client by boenrobot.
Stars: ✭ 45 (+114.29%)
Mutual labels:  mikrotik, routeros
Mikrotik API
Mikrotik Dashboard
Stars: ✭ 46 (+119.05%)
Mutual labels:  mikrotik, mikrotik-router
node-routeros
Mikrotik Routerboard RouterOS API for NodeJS
Stars: ✭ 87 (+314.29%)
Mutual labels:  mikrotik, routeros
chr-eve-ng
Repository contain LAB's for Mikrotik trainings and helpers for installing CHR into eve-ng.
Stars: ✭ 28 (+33.33%)
Mutual labels:  mikrotik, routeros
ROS Scripts
Scripts for RouterOS (MikroTik devices)
Stars: ✭ 81 (+285.71%)
Mutual labels:  mikrotik, routeros
wo-nginx-setup
Bash script to setup optimized WordOps
Stars: ✭ 16 (-23.81%)
Mutual labels:  bash-script
mysql-user-db-creator-bash-script
Script to create a mysql database, user and password with just a command
Stars: ✭ 24 (+14.29%)
Mutual labels:  bash-script
radeon-scripts
Scripts to manage various aspects of the AMD line of cards in Linux
Stars: ✭ 39 (+85.71%)
Mutual labels:  bash-script
Auto-Besside-Capturer
Capture WPA handshakes, using besside-ng. Auto upload to http://wpa-sec.stanev.org for cracking the password.
Stars: ✭ 28 (+33.33%)
Mutual labels:  bash-script
docker-dude
The Dude (MikroTik) server in a container
Stars: ✭ 48 (+128.57%)
Mutual labels:  mikrotik
phisherprice
All In One Pentesting Tool For Recon & Auditing , Phone Number Lookup , Header , SSH Scan , SSL/TLS Scan & Much More.
Stars: ✭ 38 (+80.95%)
Mutual labels:  bash-script
Fastnetmon
FastNetMon - very fast DDoS sensor with sFlow/Netflow/IPFIX/SPAN support
Stars: ✭ 2,860 (+13519.05%)
Mutual labels:  mikrotik
magento2-installer-bash-script
Simplistic Magento 2 Installer Bash Script
Stars: ✭ 38 (+80.95%)
Mutual labels:  bash-script
pnp-starterkit-setup
x-platform setup script for the SharePoint Starter Kit
Stars: ✭ 14 (-33.33%)
Mutual labels:  bash-script

mbkp

Mikrotik backup script

GitHub shellcheck

This script can be used to centralize the backup configurations of Mikrotik devices. Each device has its own configuration file in which it can override the standard options.

А теперь по-русски:

https://habr.com/post/342060/

Configuration

  1. Read example.cfg
  2. Configure your devices using ssh_config files ( read man ssh_config )

example config for host( for those who don't want to read documentation )

# file ~/.ssh/config
host *
  ControlMaster          auto # use just one connection for script
  ControlPath            ~/.ssh/control-%h-%p-%r
  ControlPersist         5m
  ForwardX11             no # disable useless
  IdentityFile           ~/.ssh/id_rsa # define default key if needed
  PasswordAuthentication no # disable useless
  Port                   22 # default port
  StrictHostKeyChecking  no # dont check hostkey
  User                   backupusr # default backup user

# gw jump
host mikrotik1
  Hostname 1.1.1.1

# ap
host mikrotik-ap1
  Hostname 192.168.88.2
  ProxyJump mikrotik1 # use gw as an entrypoint
  IdentityFile ~/.ssh/mykey # override if needed
  User xxx # override if needed

To make ProxyJump work you need to allow ssh forwarding on your mikrotik device via

> /ip ssh set forwarding-enabled=both

Scheduling

Here is crontab example:

# VARS:
MCFG="/etc/mikrotik_backup"
MBKP="/usr/local/bin/mbkp"
MLOG="/var/log/mikrotik_backup/log"
# TASKS:
00 03 * * *     $MBKP $MCFG"/somehost.cfg" >>$MLOG 2>>$MLOG             # Comment

Recommended paths:

  • /etc/mikrotik_backup directory where configuration files located

  • /usr/local/bin/mbkp executable bash script with default variables

  • /var/log/mikrotik_backup/log logfile to trace script execution results

This script does two backups (binary and export). Binary backup is protected with password default password is included in executable script and it can be overrieded via custom config file. Export is also password-protected but via openssl. Script export config to the temp file as a plain text via ssh, then it encrypt this file and move it to the destination. Encrypted exported config can be easly decrypted with openssl command:

 # NOTE: decrypt the file
 # openssl des3 -d -salt -in encryptedfile.txt -out normalfile.txt
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].