Backup and restore CSF config on new server

It can be a very time consuming process repeating CSF configuration across a number servers. In order to solve this problem you have one of two options:

  1. Backup and restore config
  2. Join all CSF nodes to a cluster (check post here)

1. Backup and restore config

SSH into the machine that contains to config you’d like to backup. Create a backup of the config as follows:

cd /etc/csf
tar cvfz csfbackup.tgz csf.conf csf.allow csf.deny csf.*ignore

Copy csfbackup.tgz to the destination server on which you’d like to restore the CSF config:

scp csfbackup.tgz root@destination-ip:/etc/csf

Extract the backup on the destination server:

tar zxfv csfbackup.tgz

Restart csf and lfd:

csf -r
systemctl restart lfd