OPNsense Forum

Archive => 23.1 Legacy Series => Topic started by: BoodahsFever on April 24, 2023, 10:34:02 AM

Title: Factory Reset HAProxy
Post by: BoodahsFever on April 24, 2023, 10:34:02 AM
Hello all,

Does anyone know a way to factory reset only HAProxy? There is an old configuration in there and i stopped using it for a while. Now i cannot remove the old config and rules and such. It's giving me errors. Starting over with HAProxy seems like the easiest way to solve it.

Thanks,
Misja
Title: Re: Factory Reset HAProxy
Post by: Bunch on April 24, 2023, 11:41:53 AM
Quote from: BoodahsFever on April 24, 2023, 10:34:02 AM
Hello all,

Does anyone know a way to factory reset only HAProxy? There is an old configuration in there and i stopped using it for a while. Now i cannot remove the old config and rules and such. It's giving me errors. Starting over with HAProxy seems like the easiest way to solve it.

Thanks,
Misja

If you want to remove all rules, frontends and backends
You need to remove them with correct order (as you cannot remove one item when other is still using it):
Frontends->Rules->Conditions->Map Files->Backends->Real Servers

(I don't know any other way to reset the configuration)
Title: Re: Factory Reset HAProxy
Post by: BoodahsFever on April 24, 2023, 12:58:22 PM
Thanks a Bunch.. I already tried that but the config file is is old and the new HAProxy version has trouble with the old config. So that gives a lot of errors.
Title: Re: Factory Reset HAProxy
Post by: Patrick M. Hausen on April 24, 2023, 01:04:04 PM
Download the entire configuration. Open XML file in an editor. Remove the HAproxy bits (possibly keeping the opening and closing line to create an empty section). Restore configuration.
Title: Re: Factory Reset HAProxy
Post by: cookiemonster on April 24, 2023, 01:14:37 PM
Or, Does removing the plugin and re-installing not remove the config, allowing to start again?
Title: Re: Factory Reset HAProxy
Post by: BoodahsFever on April 25, 2023, 10:35:07 AM
Quote from: pmhausen on April 24, 2023, 01:04:04 PM
Download the entire configuration. Open XML file in an editor. Remove the HAproxy bits (possibly keeping the opening and closing line to create an empty section). Restore configuration.

Thanks i will try that.
Title: Re: Factory Reset HAProxy
Post by: BoodahsFever on April 25, 2023, 10:38:26 AM
Quote from: cookiemonster on April 24, 2023, 01:14:37 PM
Or, Does removing the plugin and re-installing not remove the config, allowing to start again?

No removing the plugin does not remove the configuration. I think that's also why the config does not work anymore. I removed the plugin about a year ago. In the mean time OPNSense gets updated but the plugin does not so the configuration does not migrate to a newer version of the plugin. If you then reinstall the plugin months later the config does not match the plugin version anymore. And.. Well factory reset becomes handy :)
Title: Re: Factory Reset HAProxy
Post by: BoodahsFever on April 25, 2023, 12:36:10 PM
Quote from: cookiemonster on April 24, 2023, 01:14:37 PM
Or, Does removing the plugin and re-installing not remove the config, allowing to start again?

Perfect that worked like a charm:

    <HAProxy version="4.0.0">
     remove all bits inbetween this
    </HAProxy>

Thanks!