I would like to be able to restore an XML config from a HTTP(S) URL at
the console prompt. Is this possible?
The use case is for a rapid rebuild of a node entirely at the console:
* Run through the installer in express mode
* Configure just vtnet0 as WAN (no additional config needed if DHCP is
available)
* Fetch XML config from URL
* Reboot
That's it. The new node is now fully prepared, with no need to configure
the LAN interface or connect to the GUI.
The most convenient would be as a new option at the console menu:
similar to "15) Restore recent configuration" but using a remote URL.
However I'm happy to drop down either to the Linux shell or the PHP shell.
I can see that option 15 (/etc/rc.restore_config_backup) simply calls
PHP function config_restore(file). And the main thing that function does
is overwrite <cf_conf_path>/config.xml
However, looking in diag_backup.php it looks like other things might be
needed too, e.g.
mark_subsystem_dirty("restore");
touch("/conf/needs_package_sync_after_reboot");
unlink config.cache
stuff in /boot/loader.conf
various stuff to do with m0n0wall config migration
... etc etc.
Maybe this code could be factored out into a helper function which could
be invoked from the command line? Or is it safe simply to call
config_restore() from the PHP shell, and then reboot?
Regards,
Brian.
_______________________________________________
pfSense mailing list
https://lists.pfsense.org/mailman/listinfo/list
Support the project with Gold! https://pfsense.org/gold