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

Offline Kent Brockman

  • Newbie
  • *
  • Posts: 3
    • AMPM Soluciones
Re: Script to Backup CPF v2.4 firewall settings
« Reply #120 on: September 02, 2007, 04:44:30 PM »
Hi there. I'm from Argentina and used the spanish version of CFP Backup and worked fine.
BTW, I join to the wish of adding this feature to next releases.
 (R)
Technical Support for home users in Buenos Aires, Argentina.
We recommend Comodo Firewall to our clients due to its ease of use and better detection levels.
(R)

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF v2.4 firewall settings
« Reply #121 on: September 08, 2007, 08:03:12 AM »
Indeed it would be a better solution for the backup functionality to be embedded in the firewall itself. If it is not by the time I have time on my hands (If ever....) or someone else wants to give it ago.  I have some very good ideas(technical and other wise) as to how a better backup program could be implemented!!

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

Offline Little Mac

  • Forum Volunteer
  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 6303
  • The Colonel told me to.
Re: Script to Backup CPF v2.4 firewall settings
« Reply #122 on: September 10, 2007, 11:13:17 AM »
V3, my friends... Backup and Export/Import various configurations.

LM
These forums are focused on providing help and improvement for Comodo products.  Please treat other users with respect and make a positive contribution.  Thanks.
Forum Policy

Offline SuperFreak

  • Newbie
  • *
  • Posts: 1
Re: Script to Backup CPF firewall settings
« Reply #123 on: September 19, 2007, 09:19:54 AM »
G'day again.

My previous post was just a light hearted dig - please don't take offense.

There really isn't anything more I could add, as Rotty's script is designed to just be double clicked and it does everything else. It checks for the existence of the folders it needs to store the backup in, creates them if they don't exist, extracts the firewall rules from the registry and writes them to the correct folder after storing a backup copy of your previous rules backup.

To restore the rules from the backup (which is stored as a Windows .REG registry file), simply go to the folder it is stored in (after setting the firewall to "Allow all" and turning off its registry protection) and double click the REG file.

After the registry info is re-merged, set the firewall back to "Custom" and turn on registry protection.

Hope this helps,
Ewen :-)

My first post here, and I'm a noob; so sorry. :)

Thanx for the detailed explanation.

Just one question. Where should I put the "CPFBackup.bat" file to run from, if my XP is installed to D:\WINDOWS and my CFP is on E:\Program Files\Security?
Thanx for the help! Cheers,

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11826
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF v2.4 firewall settings
« Reply #124 on: September 19, 2007, 06:28:53 PM »
G'day,

It doesn't really matter where you put it as long as it's somewhere you can find it. Desktop might be a good place to consider, then, you don't have to go looking for 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 Ed_P

  • Comodo Member
  • **
  • Posts: 43
Re: Script to Backup CPF v2.4 firewall settings
« Reply #125 on: October 02, 2007, 01:28:24 PM »
I like this script.  I like being able to backup and restore specific files/apps/data in addition to hd imaging.  It allows for faster restores if only a specific file/app/data needs to be restored.

The only change I made to my copy was to the comments at the top.

Code: [Select]
[at]echo off
rem https://forums.comodo.com/help/script_to_backup_cpf_v24_firewall_settings-t2366.0.html
cls
echo COMODO Backup
echo *****************************
echo The settings will be backed up to: %SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\CPFRUles.REG
echo Merge the "CPFrules.reg" file back into the Registry to restore the settings.
echo.
echo NOTE: When restoring, you need to go to COMODO's SECURITY - ADVANCED - MISCELLANEOUS
echo and turn off "Protect own registry keys" before importing.
echo You also need to set the firewall to "allow all", and to Reboot your PC!
echo *****************************
echo.
echo To start press enter. To quit press the "x" button on this window
pause >nul:


The comments should look familiar.  ;D
Ed

Offline Ed_P

  • Comodo Member
  • **
  • Posts: 43
Re: Script to Backup CPF v2.4 firewall settings
« Reply #126 on: October 03, 2007, 12:56:22 PM »
And for those who keep our data and backups on a drive separate from the OS and apps:

CPFBackupV1.5.cmd
Code: [Select]
[at]echo off&title COMODO firewall settings backup
rem https://forums.comodo.com/help/script_to_backup_cpf_v24_firewall_settings-t2366.0.html

set BKUPfile=CPFRules.REG
set BKUPfolder=%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\
rem set BKUPfolder=D:\My Documents\CPFBackup\
rem Remove the "rem" from above line and change the assigned value to the location you desire.

cls
echo.
echo *****************************
echo The settings will be backed up to:
echo  %BKUPfolder%%BKUPfile%
echo Merge the "%BKUPfile%" file back into the Registry to restore the settings.
echo.
echo NOTE: When restoring, you need to go to COMODO's SECURITY - ADVANCED - MISCELLANEOUS
echo and turn off "Protect own registry keys" before importing.
echo You also need to set the firewall to "Allow All" and to reboot the PC!
echo *****************************
echo.
echo To start press Enter. To quit press the "x" button on this window
pause >nul

cls
if not exist "%BKUPfolder%%BKUPfile%" goto :new
goto :archive

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

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

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

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11826
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF v2.4 firewall settings
« Reply #127 on: October 03, 2007, 10:21:33 PM »
Glad to see you're enjoying rediscovering scripts. ;)

You can also use comand line variables to determine the destination at run time.

For example, if our script is called "my_script.cmd" and it contains the line "md %1:\new_folder", if we invoke the script by typing "my_script e" our script would create a folder called "new_folder" on drive e:.

enjoy!
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 Ed_P

  • Comodo Member
  • **
  • Posts: 43
Re: Script to Backup CPF v2.4 firewall settings
« Reply #128 on: October 04, 2007, 12:34:12 PM »
Glad to see you're enjoying rediscovering scripts. ;)
They're like potato chips.   :D

A default location, a custom location, a command line argument...  hmmm sounds like a menu is needed  88)

Or not.

CPFBackupV2.4.cmd
Code: [Select]
[ at ] echo off&title COMODO 2.4 firewall settings backup
rem https://forums.comodo.com/help/script_to_backup_cpf_v24_firewall_settings-t2366.0.html

set BKUPfile=CPFRules.REG
set BKUPfolder=%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\DESKTOP\CPFBackup\

rem set BKUPfolder=D:\My Documents\CPFBackup\
rem To change the default backup location remove the "rem" from above line
rem   and change the assigned value to the location you desire.

rem Code to support panic's command line destination suggestion.
rem   Example:  CPFbackup2.4    D:\My Backups\CPFBackup\
if not "%1" == "" set BKUPfolder=%1
if not "%2" == "" set BKUPfolder=%1 %2
if not "%3" == "" set BKUPfolder=%1 %2 %3

cls
echo.
echo *****************************
echo The COMODO settings will be backed up to:
echo  "%BKUPfolder%%BKUPfile%"
if exist "%BKUPfolder%%BKUPfile%" for %%i in ("%BKUPfolder%%BKUPfile%") do  echo  Date/time of last backup: %%~ti
echo.
echo  To Restore the "%BKUPfile%" file's settings back into the
echo   Registry:
echo   1. Shutdown Comodo
echo   2. Open RegEdit and delete the key
echo      HKEY_LOCAL_MACHINE\SYSTEM\Software\Comodo\Personal Firewall
echo   3. Close RegEdit
echo   4. Finally dbl click on the backup .reg file.
echo *****************************
echo.
echo To start press Enter. To quit press the "x" button on this window
pause >nul

cls
if not exist "%BKUPfolder%%BKUPfile%" goto :new
goto :archive

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

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

:end
echo.
echo DONE!!!
echo.
echo Press any key to end
pause >nul
« Last Edit: April 29, 2008, 02:01:27 PM by Ed_P »
Ed

Offline Ed_P

  • Comodo Member
  • **
  • Posts: 43
Re: Script to Backup CPF v2.4 firewall settings
« Reply #129 on: October 06, 2007, 04:39:47 PM »
I'm unclear as to the verbage for the restore after reading more of this thread.  Is it necessary to go to COMODO's SECURITY - ADVANCED - MISCELLANEOUS windows and turn off "Protect own registry keys" before importing?  Or is setting the firewall to "Allow All" sufficient?  Both needed or one or the other?

 ???
Ed

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF v2.4 firewall settings
« Reply #130 on: October 06, 2007, 07:26:46 PM »
Both needed unfortunately, the need for "Allow all" is something I would get rid of.  Since Comodo is working on a settings backup addition in future versions, and my own lack of time.

It may have to stay that way until the new version of the firewall is released.  Not sure which version.
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

Offline Ed_P

  • Comodo Member
  • **
  • Posts: 43
Re: Script to Backup CPF v2.4 firewall settings
« Reply #131 on: October 06, 2007, 07:46:57 PM »
Both needed unfortunately,
the need for "Allow all" is something I would get rid of.
 
 ???  So which is it?  Both or get rid of the "Allow all" part?  :-\


This is what I posted originally but it got changed!!
« Last Edit: October 07, 2007, 10:46:30 AM by Ed_P »
Ed

Offline Little Mac

  • Forum Volunteer
  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 6303
  • The Colonel told me to.
Re: Script to Backup CPF v2.4 firewall settings
« Reply #132 on: October 08, 2007, 04:57:58 PM »
Both are needed w/v2.4, in order to either Import or Export.  After performing the task, change both protections back to the normal settings.

(I think Rotty's referring to how he would prefer to have it work; not how it works now.)

LM
These forums are focused on providing help and improvement for Comodo products.  Please treat other users with respect and make a positive contribution.  Thanks.
Forum Policy

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF v2.4 firewall settings
« Reply #133 on: October 09, 2007, 12:10:06 AM »
Answer the question, answer the question I tell myself.  Sorry for the confusion.  :-[
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

Offline Ed_P

  • Comodo Member
  • **
  • Posts: 43
Re: Script to Backup CPF v2.4 firewall settings
« Reply #134 on: October 09, 2007, 12:35:27 PM »
Both are needed w/v2.4, in order to either Import or Export.  ....
(I think Rotty's referring to how he would prefer to have it work; not how it works now.)
Ok, that makes sense.  Thanks Little Mac.

For the sake of clarity for others that may follow, I've had no problem backing up/exporting the config without changing either of the COMODO settings.

Answer the question, answer the question I tell myself.  Sorry for the confusion.  :-[
Not a problem.  Thanks for responding.
Ed

 

Free Endpoint Protection
Seo4Smf 2.0 © SmfMod.Com Smf Destek