Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zeljkobenovic/gombak
MikroTik router discovery and backup tool
https://github.com/zeljkobenovic/gombak
backup backup-tool go golang mikrotik mikrotik-router networking router
Last synced: 29 days ago
JSON representation
MikroTik router discovery and backup tool
- Host: GitHub
- URL: https://github.com/zeljkobenovic/gombak
- Owner: ZeljkoBenovic
- Created: 2024-03-07T15:00:08.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-09-08T22:39:41.000Z (4 months ago)
- Last Synced: 2024-09-09T13:35:39.532Z (4 months ago)
- Topics: backup, backup-tool, go, golang, mikrotik, mikrotik-router, networking, router
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GOMBAK (GO-Mikrotik-BAcKup)
A program used for creating MirkoTik routers backups.
There are different modes of backup:
* `single` - backup of a single router
* `multi` - backup of multiple routers
* `l2tp` - discover routers ip addresses using remote ip of the L2TP tunnels## Prerequisites
* Mikrotik router with enabled SSH access
* For `l2tp` discovery, the "concentrator" router/s must have Mikrotik API port available## Usage
Download appropriate binary for your OS from the releases page.
Run the program in desired mode.### Single
Single router backup can be run in a single line:
`gombak --single.host "" --single.user "" --single.pass "" --backup-dir "" `
This is the default mode.### Environment variables
Environment variables can be used instead of `cli` flags.
The prefix is `GOMBAK_` and the rest is the flag name.
For example, to use environment variable instead of `--single.pass` flag, set `GOMBAK_SINGLE_PASS=`.
For `--single.user`, set `GOMBAK_SINGLE_USER=` and so on...### Multi router backup
For multiple router backups, a yaml config file is more appropriate.
Here is a sample of this config file, named `config.yaml`:
```yaml config.yaml
mode: multi
backup-dir: ""
multi-router:
- host: ""
ssh-port: ""
username: ""
password: ""
- host: ""
ssh-port: ""
username: ""
password: ""
- host: ""
ssh-port: ""
username: ""
password: ""
# add as many router you like
```
Use the config file with `gombak -c config.yaml`## Discovery
When there are a lot of routers that needs backing up, some kind of discovery mechanism must exist.
### L2TP
For now only `l2tp` discovery mechanism is supported. A user should provide an API access to the router, which
all other routers connected to it via `L2TP` tunnel. This is basically a scenario where there is one or more "concentrator"
routers, which are being used to manage all others.
The "concentrator" router/s must have their API open, as we need to fetch the information about remote `l2tp` tunnel addresses.The config file example is as following:
```yamlmode: l2tp
backup-dir: ""
discovery:
hosts:
- ""
- ""
username: ""
password: ""
```This mode presumes that the username/password combination will be the same across all the routers.
It is usually done via RADIUS server or similar solution.Use the config file with `gombak -c config.yaml`
## System service
Gombak can be set to run as a system service using the provided CLI commands.
Once the `gombak` binary and its configuration YAML file is set in place, system service can be interacted with:
* `gombak install -c ` - install and run the `gombak` system service
* `gombak uninstall` - uninstall `gombak` system service## Flags
Check which flags are available with `gombak -h`
```
-b, --backup-dir string mikrotik backup export directory (default "mt-backup")
-r, --backup-retention-days days of backup file retention (default 30)
--backup-frequency-days backup frequency in days (default 5)
-c, --config string configuration yaml file
--log.file string write logs to the specified file
--log.json output logs in json format
--log.level string define log level (default "info")
-m, --mode string mode of operation (default "single")
--single.host string the ip address of the router
--single.pass string the password for the username
--single.ssh-port string the ssh port of the router (default "22")
--single.user string the username for the router
```## TODO
* Email report
* More discovery modes