Author Topic: Script to Backup CPF v2.4 firewall settings  (Read 195788 times)

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Script to Backup CPF v2.4 firewall settings
« on: September 13, 2006, 04:14:25 AM »
NOTE: This script is provided as-is without any warranty. The makers accept no liability in  the event something should go wrong or the event of data loss or any other problems.

Comodo firewall version 2.4 seems to be a little bit "dubious" with the script, we are waiting for response about what is causing the problem of the settings not being backed up properly when the firewall is NOT set to "Allow all" and are waiting for a reply.  The desired backup system will be one integrated into the firewall itself which they are working on.

 


Panic and I have created a script that backup's up the CPF rules to a .reg file so that people do not have to go through their registry to backup the settings.

What does everyone think about this idea.

I have 3 versions, each is explained, each works just as well, choose the one that suites what you prefer.

NOTE:   When restoring, you need to go to SECURITY - ADVANCED - MISCELLANEOUS and turn off "Protect own registry keys" before importing.
You also need to set the firewall to "allow all".
Reboot your PC!


This is the Script for "CPFBackup.zip" (Version 1.0):

Code: [Select]

 [ at ] echo off
cls
echo *****************************
echo The settings are backed up to %SYSTEMROOT%\CPFBackup\CPFRUles.REG
echo Merge the "CPFrules.reg" file back, to restore settings
echo *****************************
echo To start press enter. To quit press the "x" button on this window
pause >nul:

cls
if not exist "%SYSTEMROOT%\CPFBackup" goto :new
goto :archive

:archive
echo Clearing oldest backup - please wait
del %SYSTEMROOT%\CPFBackup\Prior\CPFRUles.REG >nul:
echo Storing previous backup - please wait ...
copy %SYSTEMROOT%\CPFBackup\CPFRUles.REG %SYSTEMROOT%\CPFBackup\Prior\CPFRUles.REG
echo Archiving current rule set - please wait ...
REGEDIT /E %SYSTEMROOT%\CPFBackup\CPFRUles.REG "HKEY_LOCAL_MACHINE\SYSTEM\Software\Comodo\Personal Firewall"
goto :end

:new
cls
echo.
echo Creating folders - please wait ...
echo.
md %SYSTEMROOT%\CPFBackup
md %SYSTEMROOT%\CPFBackup\Prior
echo Archiving registry keys - please wait ...
REGEDIT /E %SYSTEMROOT%\CPFBackup\CPFRUles.REG "HKEY_LOCAL_MACHINE\SYSTEM\Software\Comodo\Personal Firewall"
copy %SYSTEMROOT%\CPFBackup\CPFRUles.REG %SYSTEMROOT%\CPFBackup\Prior\CPFRUles.REG >nul:
goto :end

:end
echo DONE!!!
echo Press any key to end
pause >nul:


VERSION 1.5:  The best of all, environment variables fixed.

Code: [Select]

 [ at ] echo off
cls
echo *****************************
echo The settings are backed up to %SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\CPFRUles.REG
echo Merge the "CPFrules.reg" file back, to restore settings
echo *****************************
echo To start press enter. To quit press the "x" button on this window
pause >nul:

cls
if not exist "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup" goto :new
goto :archive

:archive
echo Clearing oldest backup - please wait
del "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\Prior\CPFRUles.REG" >nul:
echo Storing previous backup - please wait ...
copy "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\CPFRUles.REG" "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\Prior\CPFRUles.REG"
echo Archiving current rule set - please wait ...
REGEDIT /E "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\CPFRUles.REG" "HKEY_LOCAL_MACHINE\SYSTEM\Software\Comodo\Personal Firewall"
goto :end

:new
cls
echo.
echo Creating folders - please wait ...
echo.
md "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup"
md "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\Prior"
echo Archiving registry keys - please wait ...
REGEDIT /E "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\CPFRUles.REG" "HKEY_LOCAL_MACHINE\SYSTEM\Software\Comodo\Personal Firewall"
copy "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\CPFRUles.REG" "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\Prior\CPFRUles.REG" >nul:
goto :end

:end
echo DONE!!!
echo Press any key to end
pause >nul:


cheers, rotty

I'm adding a Swedish version of the script. / AOwL

There is now a Spanish version, courtesy of ferarg

There is now a Italian version, courtesy of pandlouk

There is now a French version, courtesy of rip_pit

[attachment deleted by admin]
« Last Edit: January 21, 2008, 03:42:23 AM by Rotty »
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

Offline Bluesman

  • Comodo's Hero
  • *****
  • Posts: 568
  • Only Amiga Makes It Possible
Re: Script to Backup CPF firewall settings
« Reply #1 on: September 13, 2006, 09:17:34 AM »

What does everyone think about this idea.

Sounds great! I will test it later tonight!
"The blues are the roots, everything else is the fruits" -Willie Dixon

Offline pudelein

  • Comodo Loves me
  • ****
  • Posts: 128
Re: Script to Backup CPF firewall settings
« Reply #2 on: September 13, 2006, 09:17:57 AM »
Rotty and Panic,

The script looks useful for those not caring to mess directly in the Registry.  It is a bit inflexible, but could be edited by anyone wanting to change the location of the archive.  On the other hand, if the next version of CPF (2.4?) provides an internal mechanism for saving the settings, the script could be unnecessary, but that's life!   (:KWL)

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11823
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #3 on: September 13, 2006, 09:41:42 AM »
Rotty and Panic,

The script looks useful for those not caring to mess directly in the Registry.  It is a bit inflexible, but could be edited by anyone wanting to change the location of the archive.  On the other hand, if the next version of CPF (2.4?) provides an internal mechanism for saving the settings, the script could be unnecessary, but that's life!   (:KWL)

If enough people want it, it is easy enough to vary the destination through a %X parameter that can be passed to the script at runtime. e.g. "backup g:". If we wanted to get messy enough, the destination folder could be specified through a second parameter. Bear in mind, though, that any recovery procedure would need to use the exact parameters used to create the backup.

Also, people who don't/can't mess with the registry may not appreciate the inflexibility, but your point is taken.

cheers,
ewen :-0
As your mums would say, "If you can't play nice with all the other kiddies, go home".
All users are asked to please read and abide by the  Comodo Forum Policy.
If you can't conform, don't use the forum.

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF firewall settings
« Reply #4 on: September 13, 2006, 08:56:36 PM »
Yes, with the update taking care of this, it may not be necessary.  But who knows.

(One of the considerations in making it were that we would not use a  language that requires the user to have the program installed, and cannot be edited in it's compiled format IE. VB6, C# etc. So that the user can edit the program if they need/want to.

cheers, rotty
« Last Edit: September 13, 2006, 09:59:34 PM by Rotty »
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

marc57

  • Guest
Re: Script to Backup CPF firewall settings
« Reply #5 on: September 14, 2006, 01:22:30 AM »
Rotty and Panic,

 Thanks for all the work you put into this, I'll give it a try.

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF firewall settings
« Reply #6 on: September 15, 2006, 04:36:15 AM »
marc57, did you try it, how did it go?

Trying to gauge whether people are using this, so maybe this thread can be pinned, and i can boost my ego, by having a thread in my name pinned LOL  (:TNG)  (:TNG) (:NRD)

cheers, rotty
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

marc57

  • Guest
Re: Script to Backup CPF firewall settings
« Reply #7 on: September 15, 2006, 04:51:37 AM »
marc57, did you try it, how did it go?

Trying to gauge whether people are using this, so maybe this thread can be pinned, and i can boost my ego, by having a thread in my name pinned LOL  (:TNG)  (:TNG) (:NRD)

cheers, rotty


Hey rotty, It worked fine for me.

Offline Bluesman

  • Comodo's Hero
  • *****
  • Posts: 568
  • Only Amiga Makes It Possible
Re: Script to Backup CPF firewall settings
« Reply #8 on: September 15, 2006, 04:57:30 AM »
Hey rotty, It worked fine for me.

The script work just fine here also!
"The blues are the roots, everything else is the fruits" -Willie Dixon

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF firewall settings
« Reply #9 on: September 15, 2006, 05:21:23 AM »
Cool, thanks for responding.

cheers, rotty
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

Offline munckman

  • Comodo Family Member
  • ***
  • Posts: 89
Re: Script to Backup CPF firewall settings
« Reply #10 on: September 25, 2006, 01:35:55 AM »
marc57, did you try it, how did it go?

Trying to gauge whether people are using this, so maybe this thread can be pinned, and i can boost my ego, by having a thread in my name pinned LOL  (:TNG)  (:TNG) (:NRD)

cheers, rotty
Looks like you got a Sticky. (:KWL) It backs up fine. Just a quick question though. When restoring will the backup reg file completely overwrite the existing reg entries? I would think it completely overwrites but just want to be sure.

Thanks for this little gem! (:CLP)

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11823
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #11 on: September 25, 2006, 01:48:09 AM »
Looks like you got a Sticky. (:KWL) It backs up fine. Just a quick question though. When restoring will the backup reg file completely overwrite the existing reg entries? I would think it completely overwrites but just want to be sure.

Thanks for this little gem! (:CLP)

Yep. Overwrites existing values in the identically named key.

Glad you like it.

cheers,
ewen :-)
As your mums would say, "If you can't play nice with all the other kiddies, go home".
All users are asked to please read and abide by the  Comodo Forum Policy.
If you can't conform, don't use the forum.

Offline whodee

  • Newbie
  • *
  • Posts: 15
Re: Script to Backup CPF firewall settings
« Reply #12 on: September 26, 2006, 08:37:06 AM »
OK take a deep breath... don't know if I should admit to not knowing this but someone's got to do it for me types who don't know a lot.

When, why and how should we use either of these?  Would it make more sense to store the file on an external drive? 

All answers greatfully received. Thanks

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11823
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #13 on: September 26, 2006, 08:48:41 AM »
OK take a deep breath... don't know if I should admit to not knowing this but someone's got to do it for me types who don't know a lot.

When, why and how should we use either of these?  Would it make more sense to store the file on an external drive? 

All answers greatfully received. Thanks

Hey whodee,

This is used IF you want to take a backup of your firewall rules and settings. There's no real reason to run this, but then there's no real reason to have house insurance, is there? LOL

Definitely store the REG files on an external source as well as the default output folder. No sense having your data backup on the same drive that's about to crash, is there?

Don't worry about asking what you think are silly questions. The only really dumb question is the one that never gets asked.

Hope this helps,
Ewen :-)
As your mums would say, "If you can't play nice with all the other kiddies, go home".
All users are asked to please read and abide by the  Comodo Forum Policy.
If you can't conform, don't use the forum.

Offline whodee

  • Newbie
  • *
  • Posts: 15
Re: Script to Backup CPF firewall settings
« Reply #14 on: September 26, 2006, 09:39:11 AM »
Ewen you could regret the 'don't worry about silly questions' bit.
As I see it the two two files here do the same thing, they just store the backup in different places?

What I'm not sure about (haven't a clue about actually!) is when I'd use it.  If I'm running XP and have the option to use System Restore in event of a melt down would this not restore the CPF settings as well- assuming anything was able to be rescued?  I don't have total faith in Sys Restore but it has saved me from a problems mainly with dodgy software, and the last time I had any PC problems was a few years ago now- oh no what's that noise...

If I'd be saving the data in case of a drive failure would I not have to re-install all my software on a new drive which would have a new registery with completely different entries, etc.  I'm not trying to say there is no use for it I'm just trying to find out when I would use it.

You're right about the house insurance tho', but damn we've still got it!

 

Free Endpoint Protection
Seo4Smf 2.0 © SmfMod.Com Smf Destek