HAProxy package overwrite
-
Now I undestood.
A way to do it is installing filter package to be able to create and edit config files on pfsense.
With this package you have also the option to execute a command after file saving.The problem is That package gui will always try to override config file.
To workaround this, disable package gui and only use filer package to edit config.Can you share with us the config you use on haproxy and options That are not on gui?
How do I disable the package gui?
I will put up an example config once I sanitize it.
-
The package name is filer, not filter :)
-
I agree with marcello, and would have recommended filer. I am not sure how you would disable the gui of haproxy though. If you want to start editing the package files yourself you could just comment out the lines that write over the config file based on the xml config. It's in haproxy.inc, line 99 I believe:
function haproxy_configure() { global $config, $g; $a_global = &$config['installedpackages']['haproxy']; $a_backends = &$config['installedpackages']['haproxy']['ha_backends']['item']; $a_frontends = &$config['installedpackages']['haproxy']['ha_frontends']['item']; $a_servers = &$config['installedpackages']['haproxy']['ha_servers']['item']; $fd = fopen("{$g['varetc_path']}/haproxy.cfg", "w"); if(is_array($a_global)) { fwrite ($fd, "global\n"); if($a_global['advanced']) fwrite ($fd, "\t" . base64_decode($a_global['advanced']) . "\n"); fwrite ($fd, "\tmaxconn\t\t\t".$a_global['maxconn']."\n"); if($a_global['remotesyslog']) fwrite ($fd, "\tlog\t\t\t{$a_global['remotesyslog']}\tlocal0\n"); fwrite ($fd, "\tuid\t\t\t80\n"); fwrite ($fd, "\tgid\t\t\t80\n"); // Set numprocs if defined or use system default (#cores) if($a_global['nbproc']) $numprocs = $a_global['nbproc']; else $numprocs = trim(`/sbin/sysctl kern.smp.cpus | cut -d" " -f2`); fwrite ($fd, "\tnbproc\t\t\t$numprocs\n"); fwrite ($fd, "\tchroot\t\t\t/var/empty\n"); fwrite ($fd, "\tdaemon\n"); fwrite ($fd, "\n"); }
I think that at the beginning of that function, if you just stick a "return;" in there it would probably do what you want. Then you just have to be sure that the package doesn't get overwritten. That shouldn't happen automatically except on pfSense upgrades or configuration restores.
-
Actually, you could use filer to overwrite haproxy.inc. Just copy and paste the whole file and make your modifications, and have filer save it back over the original. There is no guarantee that on a package reinstall, the file would get overwritten again before the "bad" code is run (in fact, I'm almost sure that it won't), but the nice thing about using filer is that if your files do get overwritten on the filesystem you need only save the filer config again to have it rewrite your versions, since your versions are stored in the XML config too.
-
I'm seeing now That I just changed i386 version.
I'm still seeing an old name on 64 bit. The 32 bit .xml on github is using the name haproxy-full it seems, but while still storing all the files in a directory called haproxy-legacy. Just a bit confused by the name, and I'd like the clear the whole thing up all at once.
Also it still seems to be downloading from your site (e-sac.siteseguro.ws). Previously, I thought this would change to point back to the pfsense servers.
Let me know if I can make any of these changes myself without putting the burden on you?
-
I'm still seeing an old name on 64 bit. The 32 bit .xml on github is using the name haproxy-full it seems, but while still storing all the files in a directory called haproxy-legacy. Just a bit confused by the name, and I'd like the clear the whole thing up all at once.
I'll do on next update.
Also it still seems to be downloading from your site (e-sac.siteseguro.ws). Previously, I thought this would change to point back to the pfsense servers.
Again files.pfsense has not the latest version(1.4.19) of haproxy.
jwelter99,
to disable haproxy gui package, go on services -> haproxy and uncheck Enable HAProxy
-
I'm still seeing an old name on 64 bit. The 32 bit .xml on github is using the name haproxy-full it seems, but while still storing all the files in a directory called haproxy-legacy. Just a bit confused by the name, and I'd like the clear the whole thing up all at once.
I'll do on next update.
Also it still seems to be downloading from your site (e-sac.siteseguro.ws). Previously, I thought this would change to point back to the pfsense servers.
Again files.pfsense has not the latest version(1.4.19) of haproxy.
jwelter99,
to disable haproxy gui package, go on services -> haproxy and uncheck Enable HAProxy
Thanks, what I did was remove the haproxy package from pfsense, and then just did a pkg add to add it back to freebsd and used filter to do the rest. Seems to be a reasonable approach as the config doesnt change often and pfsense updates don't happen often either(thats a good thing!)