Skip to content

Shell Script to Backup OPNsense Config and Aliases through the API

License

Notifications You must be signed in to change notification settings

Swaegy/opnsense_api_config_backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

OPNsense API Backup

A bash script used to access the OPNsense API remotely to backup the configuration.

Requirements

OPNSense os-api-backup is not needed since Update 23.7.8.
A Remote system for running the script and saving the output.
(Iam using Debian for example, curl needs to be installed)

Setup OPNsense

Create OPNSense API Key and set permissions

Example Config Debian

Install the dependencies for debian to run the script

$ sudo apt install curl

Make the script executable

$ sudo chmod u+x /*pathtobackupscript*/opnsense-backup.sh

Execute the script through crontab, in the example at 1 in the morning

$ sudo crontab -e

0 1 * * * /*pathtobackupscript*/opnsense-backup.sh

Sources

https://docs.opnsense.org/development/how-tos/api.html

https://docs.opnsense.org/development/api/core/firewall.html

https://github.com/curl/curl

Disclaimer

This repository is for educational and informational purposes only.
The author assumes no liability for any damages that may arise from the use of the contents of this repository.

Contributions

Contributions are always welcome! If you find an error or would like to suggest an improvement, please create an issue.

About

Shell Script to Backup OPNsense Config and Aliases through the API

Topics

Resources

License

Stars

Watchers

Forks

Languages