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

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11822
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #15 on: September 26, 2006, 09:51:23 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!

You're correct about the two versions, just a change in output location.

The best reason to backup using this is if you have created custom rules and want to retain them if you have to reinstall the firewall, or if you want to have identical configurations on multiple machines. they will restore OK onto a new install because it will create any registry keys it needs if they aren't there when its imported.

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 TerDale

  • Comodo Member
  • **
  • Posts: 29
Re: Script to Backup CPF firewall settings
« Reply #16 on: September 29, 2006, 02:08:02 PM »
Hi,

Thanks to both of you for this script, nice idea.

However, it can't work as is, if you are logged in with a regular account (ie. non admin) as everyone should (and even if M$ didn't do things to make it easy). Indeed, even if you have a good FW (well, very good shall I say!  ;) ) and an equally good AV (not to say an anti-spyware), there is no exemption to run as a regular account, and that will be enforced on Vista BTW.

So, I'd suggest that the script be amended to use %ALLUSERSPROFILE%, instead of %SYSTEMROOT% or %SYSTEMDRIVE%. Indeed, in both cases, a regular user is not allowed to create a folder. OTOH, %ALLUSERSPROFILE% (usually) maps to "%SYSTEMDRIVE%\Documents and Settings\All Users" that is readable & writable by all users of your computer.
Doing so will allow any user to use the script to backup CPF settings.

OTOH, to restore settings, only an admin will have rights to restore registry settings. But backing up should be done peridocally, while restoring is only done very sporadically



Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF firewall settings
« Reply #17 on: September 29, 2006, 09:58:14 PM »
Ok, i will implement what you have said, but i will send it to panic to test it, just to make sure.

Ok, made the changes and it has been tested, the original post has been updated.

Cheers, rotty
« Last Edit: September 30, 2006, 08:39:23 PM by Rotty »
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

Offline shirike

  • Newbie
  • *
  • Posts: 4
Re: Script to Backup CPF firewall settings
« Reply #18 on: October 18, 2006, 03:28:41 PM »
Quote
Archiving current rule set - please wait ...
'REGEDIT' is not recognized as an internal or external command,
operable program or batch file.
DONE!!!
Press any key to end

Using v1.1 - what's going wrong? :(

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11822
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #19 on: October 19, 2006, 03:43:43 AM »
Using v1.1 - what's going wrong? :(

Using V1.1 of what? CPF? The script is designed for V2.2 and upwards. If you are using CPF V1.1, we are sorry, but we didn't think anyone would still be on that version.

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 Frankster

  • Comodo Member
  • **
  • Posts: 34
Re: Script to Backup CPF firewall settings
« Reply #20 on: October 19, 2006, 03:59:57 AM »
i think he means v1.1 of the scripts... well, but i am not a native english-speaker. ;)

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11822
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #21 on: October 19, 2006, 04:11:06 AM »
i think he means v1.1 of the scripts... well, but i am not a native english-speaker. ;)

DOH!

If you are using Windows 2000 or Windows XP and the OS is installed in a reasonably "normal" manner, then there's no reason why the script won't work, unless your pathing variables aren't standard.

You could try editing the script and changing "REGEDIT /E" to "C:\WINDOWS\REGEDIT /E", on the proviso that your Windows OS is installed on your C: drive.


Revised script with explicit pathing is below.

**************************************************

[ at ] echo off
cls
echo *****************************
echo The settings are backed up to %SYSTEMDRIVE%\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%\CPFBackup" goto :new
goto :archive

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

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

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

This is the Script for "CPFBackup.zip" (Version 1.2) it uses %ALLUSERSPROFILE% IE. C:\Documents and settings\Allusers\


Code:
[ at ] echo off
cls
echo *****************************
echo The settings are backed up to %ALLUSERSPROFILE%\CPFBackup\CPFRUles.REG
echo Merge the "CPFrules.reg" file back, to restore settings
echo.
echo *** THIS IS A PRIVATE REVISION FOR A SINGLE INSTANCE BUG FIX - EB ***
echo.
echo *****************************
echo To start press enter. To quit press the "x" button on this window
pause >nul:

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

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

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

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

**************************************************

If this doesn't work, do a Windows search for REGAEDIT.EXE and let us know where it is on your system.

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 shirike

  • Newbie
  • *
  • Posts: 4
Re: Script to Backup CPF firewall settings
« Reply #22 on: October 24, 2006, 03:02:07 PM »
Used v1.1 revised script in the same folder as REDEDIT.EXE and it worked :)

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11822
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #23 on: October 24, 2006, 06:56:05 PM »
Used v1.1 revised script in the same folder as REDEDIT.EXE and it worked :)

it would seem that your issue is caused by the system environment variables not being set, or at least not containing the path info for c:\windows. this is worth looking into.

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 maniac2003

  • Comodo Family Member
  • ***
  • Posts: 77
Re: Script to Backup CPF firewall settings
« Reply #24 on: October 29, 2006, 09:43:04 AM »
The 1.1 backup method worked for me so far.
Want to try out some other security software, don't I'll be back  (R)

Trend Micro IS 2007 sucks ! My notebook sure was sloooow.
So back to NOD32 and CPF  (B)

But when restoring the rules (importing the .reg file). It says that it couldn't import it all because some of the registry keys are in use  ???
For Firefox I had to choose allow again, so importing didn't work for me.
Or am I doing something wrong.
« Last Edit: October 29, 2006, 12:27:02 PM by maniac2003 »
Quote from Panic "The only truly secure computer is one that has no power connected to it, no means of human interaction, no input devices, no output devices and is encased in concrete, stuffed into a locked chest and sunk at sea."

Offline panic

  • Global Moderator
  • Comodo's Hero
  • *****
  • Posts: 11822
  • Linux is free only if your time is worthless.;-)
Re: Script to Backup CPF firewall settings
« Reply #25 on: October 29, 2006, 11:21:16 PM »
The 1.1 backup method worked for me so far.
Want to try out some other security software, don't I'll be back  (R)

Trend Micro IS 2007 sucks ! My notebook sure was sloooow.
So back to NOD32 and CPF  (B)

But when restoring the rules (importing the .reg file). It says that it couldn't import it all because some of the registry keys are in use  ???
For Firefox I had to choose allow again, so importing didn't work for me.
Or am I doing something wrong.

When restoring, you need to got to SECURITY - ADVANCED - MISCELLANEOUS and turn off "Protect own registry keys" before importing.

Rotty, can you add this as a note to the stickey topic. Thanks in advance.

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 twl845

  • Comodo's Hero
  • *****
  • Posts: 203
Re: Script to Backup CPF firewall settings
« Reply #26 on: October 31, 2006, 09:32:08 AM »
When I used ZA I could back up my settings in My Documents each time I made some changes. This was accomplished by naming the backup and  clicking a button on the overview page if I remember right.  ;D  A nice simple method would be best.
 (B)
« Last Edit: October 31, 2006, 09:40:07 AM by twl845 »

Offline Rotty

  • Comodo's Hero
  • *****
  • Posts: 903
  • http://www.venganza.org/ - Noodly Appendage
Re: Script to Backup CPF firewall settings
« Reply #27 on: October 31, 2006, 05:43:41 PM »
Yes, using a programming language such as C# or VB6 (Easier to program LOL), Delphi then a user interface would be possible.   I would have to consult Panic on this as we'd have to find a language that we both have access to.

I have considered doing that i will do that if COMODO do not add it in the next version.

Also the need to close COMODO to write the settings back will be a problem that HAS to exist, otherwise if i found a way around it then i would have to tell them(I'm nice  (:TNG)) and they would have to patch it  (:TNG) (-: .

This is all effected by how much time we have on our hands of course.

cheers, rotty
« Last Edit: October 31, 2006, 05:47:33 PM by Rotty »
The opinions expressed in my posts are my own. 
They do NOT necessarily represent or reflect the views of my employer.

Offline maniac2003

  • Comodo Family Member
  • ***
  • Posts: 77
Re: Script to Backup CPF firewall settings
« Reply #28 on: November 04, 2006, 04:41:33 AM »
When restoring, you need to got to SECURITY - ADVANCED - MISCELLANEOUS and turn off "Protect own registry keys" before importing.

Rotty, can you add this as a note to the stickey topic. Thanks in advance.

Hope this helps,
Ewen :-)


Thanks for the help, everything imported ok now.  :BNC
Quote from Panic "The only truly secure computer is one that has no power connected to it, no means of human interaction, no input devices, no output devices and is encased in concrete, stuffed into a locked chest and sunk at sea."

Offline chamberk

  • Newbie
  • *
  • Posts: 4
Re: Script to Backup CPF firewall settings
« Reply #29 on: November 04, 2006, 07:04:03 AM »
Ran across this tonight (err -this morning!). Worked like a charm though I did have to hard-code the environment variables, which was no problem because I wanted the backup on an external drive anyway.

Keep up the great work ya'll! I am truely impressed at the quality of CPF! My "learning curve" merely required the flash tutorial to get moving. Well done.

Rgds.

 

Free Endpoint Protection
Seo4Smf 2.0 © SmfMod.Com Smf Destek