Friday, May 23, 2014

Vyatta Firewall Configuration backup

Vyatta Firewall Automated Backup 


1. Script to backup the vyatta configuration thorugh ssh. Save this file as /home/vyatta/backup_expect.sh.
Modify User name ,Password and IP address details.

#!/usr/bin/expect 
set timeout 1
spawn $env(SHELL)
send "configure\r"
expect -re  ".*# $"
sleep 5
send "save scp://vyatta:password@[ip-address]/home/vyatta/R1-config.boot.`date +%Y%m%d-%H%M`\r"
expect -re  ".*# $"
send "exit\r"
exit
expect eof

2.Enable the crontab entry for vyatta user

SHELL=/bin/vbash
0 20 * * * /home/vyatta/backup_expect.sh > /tmp/backup-out