[ previous ] [ next ] [ threads ]
 
 From:  Bill Arlofski <waa dash m0n0wall at revpol dot com>
 To:  Guy Widloecher <guy dot widloecher at gmail dot com>
 Cc:  aaronc at morad dot ab dot ca, m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] Recover config.xml from config.cache
 Date:  Thu, 15 May 2008 08:26:00 -0400
Sorry Guy.   Unlike you, I assumed that the config.xml on those pages 
might have gotten assembled from memory rather than pulled from the 
storage medium at time of the php script execution.

You obviously did much more digging and research than I had.

I'll be quiet now. :)


--
Bill


Guy Widloecher wrote:
> Bill and Aaron,
> 
> Thank you for your answers, but the pages like /status.php or
> /diag_backup.php are no longer available due to the diskette failure: the
> script hangs while accessing to the /conf/config.xml file (for instance the
> line $fd = @fopen("/conf/config.xml", "r"); in status.php).
> 
> So I only found the way to recover by using config.cache as explained
> before.
> 
> Best regards,
> Guy Widloecher
> 
> 2008/5/13 mtnbkr <waa dash m0n0wall at revpol dot com>:
> 
>>
>> GUY!  I am sorry to hear your plight and the amount of work you put into
>> this! This is precisely what excellent mailing lists like this are for.
>> We could have saved you hours and hours worth of work.
>>
>>
>> Take a look at:
>>
>> /status.php
>>
>> (at the bottom, there is a link to the full, current config.xml)
>>
>>
>> OR,
>>
>> /diag_backup.php
>>
>>
>> This will let you download the full, current config.xml which can be saved,
>> and then uploaded to a new box with a working floppy.
>>
>> --
>> Bill Arlofski
>> Reverse Polarity, LLC
>>
>>
>>
>>
>>
>>
>>
>> Guy Widloecher wrote:
>>
>>> Hello,
>>>
>>> I have been confronted with the following problem: after a diskette
>>> failure,
>>> the m0n0wall was no longer manageable and the backup of config.xml was not
>>> up to date!
>>>
>>> Fortunately I could still connect at https://m0n0wall/exec.php.  As I
>>> didn't
>>> find any information on the web, here's what I did:
>>>
>>> On the exec.php page, type the command "cat /tmp/config.cache" (of course,
>>> do not something like cat /conf/config.xml, it doesn't work because the
>>> diskette is broken)
>>>
>>> Put its content (a single line) in a file nammed config.cache (I used vi,
>>> gedit has some trouble with this very long line of text, I don't test with
>>> other editors).
>>>
>>> In the same folder, write the following php script :
>>>
>>> ----------------
>>> <?php
>>>
>>> require_once("globals.inc");
>>> require_once("util.inc");
>>> require_once("xmlparse.inc");
>>>
>>> $config = unserialize(file_get_contents("config.cache"));
>>>
>>> $xmlconfig = dump_xml_config($config, $g['xml_rootobj']);
>>>
>>> echo var_dump($xmlconfig);
>>> echo "\n";
>>>
>>> ?>
>>> --------------------
>>>
>>> Name this script prog.php
>>>
>>> Recover the files globals.inc, util.inc and xmlparse.inc from another
>>> m0n0wall running the same version or from the corresponding rootfs
>>> distribution. You should have in the folder : config.cache, prog.php,
>>> globals.inc, util.inc and xmlparse.inc.
>>>
>>> Run the php script: $ php prog.php
>>>
>>> If everything goes well, you must retrieve the file config.xml.
>>>
>>> I hope that this mini-howto may help somebody encountering the same
>>> problem.
>>>
>>> Best regards,
>>> Guy Widloecher
>>>
>>>
>