Netgate SG-1000 microFirewall

Author Topic: Restoring the config file from the console via USB?  (Read 8369 times)

0 Members and 1 Guest are viewing this topic.

Offline thinair

  • Full Member
  • ***
  • Posts: 143
  • Karma: +1/-0
    • View Profile
    • nelsonpapel.com
Restoring the config file from the console via USB?
« on: November 11, 2005, 08:16:45 pm »
Is it possible to add an easy way to update the firewall from a USB key from the console menu.  Lets say i've just finished installing the LiveCD to the harddrive, I'd like to restore my config without setting up all the vlans and LAN/WAN interfaces.

Even restoring the config from a floppy disk would be nice.

I understand I could just go into the shell and mount the disk, but an easier way would be a nice addition in my opinion.  Especially for those of us who have very little time on UNIX...like me ;D
« Last Edit: November 11, 2005, 11:46:21 pm by thinair »
Nelson Papel

Offline sullrich

  • Hero Member
  • *****
  • Posts: 5110
  • Karma: +7/-2348
    • View Profile
    • pfSense
Re: Restoring the config file from the console via USB?
« Reply #1 on: November 12, 2005, 12:21:13 am »
Whats wrong with the WebGUI backup/restore functions?

Offline thinair

  • Full Member
  • ***
  • Posts: 143
  • Karma: +1/-0
    • View Profile
    • nelsonpapel.com
Re: Restoring the config file from the console via USB?
« Reply #2 on: November 12, 2005, 06:31:31 am »
Nothing, it works for it's intended purpose, but from the console it'd be handy to restore the config from a fresh install, so none of the interfaces would need to be configured.

I'm just thinking of some of our Cisco switches and routers at work, when they fail, we just pull the PCMCIA memory card out, drop it into the replacement hardware, boot, copy from the config from PCMCIA card to the internal memory and voila, configure hardware without the need to setup the network for TFTP transfer.  The newer hardware is moving to USB as well for config restores, the feature just isn't active yet in the IOS.

It's not a big deal, just an idea.
Nelson Papel

Offline hoba

  • Hero Member
  • *****
  • Posts: 5837
  • Karma: +8/-0
  • What was the problem to this solution again?
    • View Profile
    • pfSense
Re: Restoring the config file from the console via USB?
« Reply #3 on: November 12, 2005, 06:38:38 am »
You are probably looking for something like this http://wiki.bsdinstaller.com/wikka.php?wakka=PreFlightInstaller which is a feature of pfsense. Don't know how usable it is atm, geekgod might want to give more exact information here.

Offline sullrich

  • Hero Member
  • *****
  • Posts: 5110
  • Karma: +7/-2348
    • View Profile
    • pfSense
Re: Restoring the config file from the console via USB?
« Reply #4 on: November 12, 2005, 11:37:25 am »
You are probably looking for something like this http://wiki.bsdinstaller.com/wikka.php?wakka=PreFlightInstaller which is a feature of pfsense. Don't know how usable it is atm, geekgod might want to give more exact information here.

It's quite usable and works fine.   Thats how removable media is supported.

Offline mpapec

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Restoring the config file from the console via USB?
« Reply #5 on: November 12, 2005, 01:21:43 pm »
There is a bug with pfi, it doesn't check for all devices that may have config files; this is from v0.9

/scripts/pfi <==

look_for_config_xml_config_msdos,
and
look_for_pfi_config_msdos

are looping over devices and *returning prematurely*, so
=============
                if [ ! -e /dev/${try_device} ]; then
                        return 1
                fi
=============

should be:
=============
                if [ ! -e /dev/${try_device} ]; then
                        continue
                fi
=============

Offline sullrich

  • Hero Member
  • *****
  • Posts: 5110
  • Karma: +7/-2348
    • View Profile
    • pfSense
Re: Restoring the config file from the console via USB?
« Reply #6 on: November 12, 2005, 01:37:56 pm »
There is a bug with pfi, it doesn't check for all devices that may have config files; this is from v0.9

/scripts/pfi <==

look_for_config_xml_config_msdos,
and
look_for_pfi_config_msdos

are looping over devices and *returning prematurely*, so
=============
                if [ ! -e /dev/${try_device} ]; then
                        return 1
                fi
=============

should be:
=============
                if [ ! -e /dev/${try_device} ]; then
                        continue
                fi
=============


Say what?   This is a shell script.   Are you sure there is a "continue" directive?

Offline mpapec

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Restoring the config file from the console via USB?
« Reply #7 on: November 12, 2005, 03:16:45 pm »
Yes, /scripts/pfi is a shell script.

It doesn't read config.xml from my floppy due premature function return.

In short, look_for_config_xml_config_msdos() has intention to read config file from da0 da0s1 da1 da1s1 da2 da2s1 da3 da3s1 da4 da4s1 da5 da5s1 fd0 fd1 devices, but due bug in "for" loop it tries only first device and if there isn't any, then it skips rest of devices (I've spent some time debuging boot routines).

Can you please fix that in next release?
tnx!

Offline speedylix

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Restoring the config file from the console via USB?
« Reply #8 on: November 15, 2005, 02:40:56 am »
Say what?   This is a shell script.   Are you sure there is a "continue" directive?

Of course there is, works in sh as well as in bash ;)

BTW, is it possible to make custom LiveCD (with ones own config.xml) - this way you don't even need removable media support so less devices needed in a box?

Offline sullrich

  • Hero Member
  • *****
  • Posts: 5110
  • Karma: +7/-2348
    • View Profile
    • pfSense
Re: Restoring the config file from the console via USB?
« Reply #9 on: November 15, 2005, 09:38:15 am »
Say what?   This is a shell script.   Are you sure there is a "continue" directive?

Of course there is, works in sh as well as in bash ;)

BTW, is it possible to make custom LiveCD (with ones own config.xml) - this way you don't even need removable media support so less devices needed in a box?

Use a USB Keychain drive.   A menu will come up to transfer config.xml if it is MS Dos formatted.

Offline mpapec

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Restoring the config file from the console via USB?
« Reply #10 on: November 15, 2005, 04:07:33 pm »
Say what?   This is a shell script.   Are you sure there is a "continue" directive?

Of course there is, works in sh as well as in bash ;)

BTW, is it possible to make custom LiveCD (with ones own config.xml) - this way you don't even need removable media support so less devices needed in a box?

Use a USB Keychain drive.   A menu will come up to transfer config.xml if it is MS Dos formatted.

btw, I can provide patch for /scripts/pfi if you're willing to apply it.

It would be really nice to use floppy for config.xml as I have them few lying around begging to be useful. ;)




Offline sullrich

  • Hero Member
  • *****
  • Posts: 5110
  • Karma: +7/-2348
    • View Profile
    • pfSense
Re: Restoring the config file from the console via USB?
« Reply #11 on: November 15, 2005, 04:14:28 pm »
Say what?   This is a shell script.   Are you sure there is a "continue" directive?

Of course there is, works in sh as well as in bash ;)

BTW, is it possible to make custom LiveCD (with ones own config.xml) - this way you don't even need removable media support so less devices needed in a box?

Use a USB Keychain drive.   A menu will come up to transfer config.xml if it is MS Dos formatted.

btw, I can provide patch for /scripts/pfi if you're willing to apply it.

It would be really nice to use floppy for config.xml as I have them few lying around begging to be useful. ;)






The continue patch?   It's already commited.