How to Backup and Restore a Sensor
Beginning with Pwnix Release 1.9.19 when a sensor is updated either by running the px-system-update
script/command or by running a scheduled task in Pulse, a backup file of the sensor's configuration is automatically created and stored to the /root/backup
directory on the sensor.
Alternatively, the process to backup the sensor's configuration can be performed manually as follows:
- Use SSH and login to the sensor with the pwnie user account.
- Type
sudo su
and press Enter, then re-type the password to become superuser. - Next, type
cd /opt/pwnix/pwnix-scripts
and press Enter to change directories. Next, type
backup.sh
and press Enter to backup the sensor's configuration. This will create and store a backup file to the working directoryNote
The name of the backup file will reflect "pwnix-" followed with the MAC address of the sensor's eth0 Interface and the date stamp when the backup file was created. For example: "pwnix-000c292a9942-20180427.tar.xz" or "pwnix-7085c2162458-20191108.tar.xz"
Regardless of whether the backup was performed automatically or manually, it is essential to copy the backup file created to a safe location (not on the sensor). This can be accomplished using SCP or WinSCP, etc.
To restore the configuration of the sensor from the backup file, perform the following steps:
- Use SSH and login to the sensor with the pwnie user account.
- Type
sudo su
and press Enter, then re-type the password to become superuser. - Next, using SCP or WinSCP (or some other met) copy the backup file created to the
/tmp
directory on the sensor. Next, type
/opt/pwnix/pwnix-scripts/restore.sh /tmp/pwnix-000c292a9942-20180427.tar.xz
and press Enter.Note
The backup file name reflected above is provided as an example. Please replace this example with what is necessary.
- Afterward, reboot the sensor
At this time, the configuration of the sensor has been fully restored.
Optional
If desired to create a backup file across multiple sensors and copy the resultant backup file to an FTP server, the following Script may be created within Pulse and run as a weekly Task to accomplish this goal.
Of course the success of copying the backup file to the FTP server is entirely dependent on the sensor(s having connectivity to the FTP server specified. If the sensor does not have connectivity or if connectivity to the FTP server should fail, then the backup file remains on the sensor itself and is not copied to the FTP server.
#!/bin/bash # run backup.sh script cd /opt/pwnix/pwnix-scripts/ rm pwnix-*.tar.xz ./backup.sh sleep 3 # copying backup file using FTP HOST='{{host}}' USER='{{user}}' PASSWD='{{password}}' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD passive binary put pwnix*.tar.xz quit END_SCRIPT exit 0
Copyright
© 2024 Outpost24® All rights reserved. This document may only be redistributed unedited and unaltered. This document may be cited and referenced only if clearly crediting Outpost24® and this document as the source. Any other reproduction and redistribution in print or electronically is strictly prohibited without explicit permission.
Trademark
Outpost24® and OUTSCAN™ are trademarks of Outpost24® and its affiliated companies. All other brand names, product names or trademarks belong to their respective owners.