126 lines
3.1 KiB
Groff
126 lines
3.1 KiB
Groff
.TH IPNG-ROUTER-BACKUP 1 "July 2025" "ipng-router-backup" "User Commands"
|
|
.SH NAME
|
|
ipng-router-backup \- SSH Router Backup Tool
|
|
.SH SYNOPSIS
|
|
.B ipng-router-backup
|
|
.RI --yaml " CONFIG_FILE(S)"
|
|
.RI [ --output-dir " DIRECTORY" ]
|
|
.RI [ --password " PASSWORD" ]
|
|
.RI [ --key-file " KEYFILE" ]
|
|
.RI [ --port " PORT" ]
|
|
.RI [ --host " HOSTNAME" ]...
|
|
.SH DESCRIPTION
|
|
.B router_backup
|
|
is a tool for backing up router configurations via SSH. It connects to multiple routers defined in a
|
|
set of YAML configuration file(s) and executes commands, saving the output to files.
|
|
.PP
|
|
The tool supports multiple device types with predefined command sets, SSH agent authentication, and automatic file organization.
|
|
.SH OPTIONS
|
|
.TP
|
|
.BR --yaml " \fICONFIG_FILE\fR"
|
|
YAML configuration file(s) or glob patterns (required)
|
|
.TP
|
|
.BR --output-dir " \fIDIRECTORY\fR"
|
|
Output directory for command output files (default: /tmp)
|
|
.TP
|
|
.BR --password " \fIPASSWORD\fR"
|
|
SSH password for authentication
|
|
.TP
|
|
.BR --key-file " \fIKEYFILE\fR"
|
|
SSH private key file path
|
|
.TP
|
|
.BR --port " \fIPORT\fR"
|
|
SSH port number (default: 22)
|
|
.TP
|
|
.BR --host " \fIHOSTNAME\fR"
|
|
Specific host(s) or glob patterns to process (can be repeated, processes all if not specified)
|
|
.TP
|
|
.BR --help
|
|
Show help message
|
|
.SH CONFIGURATION
|
|
The configuration file uses YAML format with two main sections:
|
|
.SS types
|
|
Define device types with their command sets:
|
|
.PP
|
|
.EX
|
|
types:
|
|
srlinux:
|
|
commands:
|
|
- show version
|
|
- show platform linecard
|
|
routeros:
|
|
commands:
|
|
- / export terse
|
|
exclude:
|
|
- "^# ....-..-.. ..:..:.. by RouterOS"
|
|
.EE
|
|
.SS devices
|
|
Define individual devices:
|
|
.PP
|
|
.EX
|
|
devices:
|
|
router1:
|
|
user: admin
|
|
type: srlinux
|
|
.EE
|
|
.SH AUTHENTICATION
|
|
Authentication is attempted in the following order:
|
|
.IP 1.
|
|
SSH agent (if SSH_AUTH_SOCK environment variable is set)
|
|
.IP 2.
|
|
Specified key file (--key-file option)
|
|
.IP 3.
|
|
Default SSH keys (~/.ssh/id_rsa, ~/.ssh/id_ed25519, ~/.ssh/id_ecdsa)
|
|
.IP 4.
|
|
Password authentication (--password option)
|
|
.SH OUTPUT
|
|
For each device, a text file named after the hostname is created in the specified directory. Each command output is prefixed with "## COMMAND: <command_name>" for easy identification.
|
|
.PP
|
|
Output can be filtered using regex patterns defined in the device type's 'exclude' field to remove unwanted lines such as timestamps or debug messages.
|
|
.SH EXAMPLES
|
|
.TP
|
|
Basic usage with glob patterns:
|
|
.EX
|
|
ipng-router-backup --yaml "*.yaml"
|
|
.EE
|
|
.TP
|
|
Custom output directory:
|
|
.EX
|
|
ipng-router-backup --yaml config.yaml --output-dir /home/user/backups
|
|
.EE
|
|
.TP
|
|
Using password authentication:
|
|
.EX
|
|
ipng-router-backup --yaml config.yaml --password mysecretpass
|
|
.EE
|
|
.TP
|
|
Process hosts matching patterns:
|
|
.EX
|
|
ipng-router-backup --yaml config.yaml --host "asw*" --host "*switch*"
|
|
.EE
|
|
.SH FILES
|
|
.TP
|
|
.I /etc/ipng-router-backup/config.yaml.example
|
|
Example configuration file
|
|
.SH EXIT STATUS
|
|
.TP
|
|
.B 0
|
|
Success (all devices processed successfully)
|
|
.TP
|
|
.B 1
|
|
General error (configuration file not found, authentication failure, etc.)
|
|
.TP
|
|
.B 10
|
|
Some devices failed
|
|
.TP
|
|
.B 11
|
|
All devices failed
|
|
.SH AUTHOR
|
|
Written by Pim van Pelt.
|
|
.SH REPORTING BUGS
|
|
Report bugs to <pim@ipng.ch>
|
|
.SH SEE ALSO
|
|
.BR ssh (1),
|
|
.BR ssh-agent (1),
|
|
.BR dpkg (1)
|