Files
router-backup/docs/router_backup.1

111 lines
2.8 KiB
Groff

.TH IPNG-ROUTER-BACKUP 1 "July 2025" "ipng-router-backup 1.0.0" "User Commands"
.SH NAME
ipng-router-backup \- SSH Router Backup Tool
.SH SYNOPSIS
.B ipng-router-backup
.RI --config " CONFIG_FILE"
.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 YAML configuration file 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 --config " \fICONFIG_FILE\fR"
YAML configuration file path (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) 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
.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.
.SH EXAMPLES
.TP
Basic usage:
.EX
ipng-router-backup --config /etc/ipng-router-backup/config.yaml
.EE
.TP
Custom output directory:
.EX
ipng-router-backup --config config.yaml --output-dir /home/user/backups
.EE
.TP
Using password authentication:
.EX
ipng-router-backup --config config.yaml --password mysecretpass
.EE
.TP
Process specific hosts only:
.EX
ipng-router-backup --config config.yaml --host asw100 --host asw120
.EE
.SH FILES
.TP
.I /etc/ipng-router-backup/config.yaml.example
Example configuration file
.SH EXIT STATUS
.TP
.B 0
Success
.TP
.B 1
General error (configuration file not found, authentication failure, etc.)
.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)