Skip to content

Instantly share code, notes, and snippets.

@djonko
Forked from ilumos/pfSense-config-backup.sh
Created December 29, 2023 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djonko/1c37c415c95c546e1fb3445a69fa988d to your computer and use it in GitHub Desktop.
Save djonko/1c37c415c95c546e1fb3445a69fa988d to your computer and use it in GitHub Desktop.
# In Diagnostics > Command Prompt, run:
mkdir -p /root/.ssh # Create a .ssh folder for the pfSense root user
ssh-keygen -t rsa -q -b 2048 -N "" -f /root/.ssh/id_rsa # Generate a public/private key pair for pfSense
cat /root/.ssh/id_rsa.pub # Get pfSense's public key for adding to the remote server
ssh -oStrictHostKeyChecking=no user@example.com # Add the remote host's host key to pfsense's "known_hosts" file
# Run this command in Diagnostics > Command Prompt
# and if it succeeds, add it as a cron job in Services > Cron
/usr/bin/scp -i /root/.ssh/id_rsa /cf/conf/config.xml user@backup.example.com:~/config-`date +\%Y-\%m-\%d`.xml 2>&1 | /usr/bin/logger -t config-backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment