Tuesday, March 01, 2022

Restore a PFSense Backup using the CLI (Command Line Interface)

This tutorial will go though how to restore a PFSense Configuration though the Command Line Interface (CLI).  You will need a few things before we begin.

  1. A usb drive formatted as FAT32
  2. A backup of your PFSense Config File on the thumb drive.




Once that is done, and you have your fresh version of PFSense installed and ready to go.



plug your USB device into the system.



We see the device is da0, but we will run camcontrol with devlist to verify the USB Drive to do that we will need to enter shell mode by selecting option 8



Then we will run the command 
camcontrol devlist


We can see that da0 is our usb drive, so to see all available partitions we will run 

ls /dev/da0*

So we can see a single partition /dev/da0s1 so we need to mount it.  To mount it we will need to make a folder to mount to.  In this case I'm going to make a folder called bak

mkdir /media/bak


then using the following command to mount the usb drive to /media/bak

mount_msdosfs /dev/da0s1 /media/bak


Then we are going to cd into /media/bak and run a ls to see what files we have on the drive

cd /media/bak

LS 



We find our pfsense backup file now we will copy it to /cf/conf/config.xml overwriting the default config file.  If you so choose you can make a backup of the default config by first doing
 cp /cf/conf/config.xml /cf/conf/config.bak

I am just going to overwrite the file. To do that I am going to run

cp /media/bak/mypfsensebackup-20220228051431.xml /cf/conf/config.xml

This will copy/paste the backup file into the /cf/conf directory and rename the file to config.xml overwriting the file that is currently there.


Now we will remove the temp file and reboot the system.

rm /tmp/config.cache


exit shell 

exit

then select option 5 and reboot


Once you have rebooted your configuration should be applied if there were no issues or compatibility issues.








How to fix CURL call imporitng an RSS feed on a site blocking CURL calls

There is a 3rd party service provider that my organization uses called bibliocommons.  They have these nice book carousels.  However the car...