[ previous ] [ next ] [ threads ]
 From:  "Guy Widloecher" <guy dot widloecher at gmail dot com>
 To:  m0n0wall at lists dot m0n0 dot ch
 Subject:  Recover config.xml from config.cache
 Date:  Tue, 13 May 2008 12:08:04 +0200

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 :



$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