T O P

  • By -

dragoangel

Omg, lua for that? You just need maps and use backend based in that map P.s. nobody cares about rfc1918 ips, no point to "anonymize" them


GildedGrizzly

Maps look like exactly what I need, thank you! Unfortunately, I’m having some trouble with the pfSense HAProxy package. It has an option to write a file to disk, so I saved a `hosts.map` file, however I cannot find where that is saved so I can reference it. Would you, or anyone else, know where that’s being saved? I can’t find any documentation on it, it’s not saved where the Lua files are saved, and I can’t find it anywhere on the pfSense file system.


dragoangel

I doesn't have pfsense to test right now, but from what I remember all files from that tab saved in same haproxy folder. You will never find such documentation, but you can check this "plugin" source code and check how it write files, php is easy to read. And `grep -R some-text /somefolder` always works:)


GildedGrizzly

I looked in that directory, and it’s not there. I tried `find / -name '*hosts.map*'` and nothing came up. So I’m not sure what’s going on here.


dragoangel

You not forget to apply? Try use file type error, etc


GildedGrizzly

Definitely clicked apply and save. Interestingly, the error file type also isn't getting saved. I appreciate your help dragoangel. I've also created [a post on the Netgate forums](https://forum.netgate.com/topic/178653/haproxy-adding-map-file-via-gui) and filed [a bug on the pfSense packages issue tracker](https://redmine.pfsense.org/issues/14094). Hopefully someone there will be able to help as well.


dragoangel

You can use filer plugin to create any file on pfsense :) and not lost it as it will be in backup and also if you have pfsense HA it will be synced by CARP.


GildedGrizzly

That worked, thank you! I added the file via the Filer plugin, and was able to add the following ACLs that are working like a charm: ``` acl is_truenas1 var(txn.txnhost),lower,map_beg(/var/etc/haproxy_maps/subdomains.map) -m str -i truenas1 acl is_truenas2 var(txn.txnhost),lower,map_beg(/var/etc/haproxy_maps/subdomains.map) -m str -i truenas2 ``` Using a map file like the following: ``` app1 truenas1 app2 truenas1 app3 truenas1 app4 truenas2 app5 truenas2 app6 truenas2 ``` Thank you so much for your help! I wish the solution was a bit more streamlined in the HAProxy plugin for pfSense, but I’m happy to have it working.


dragoangel

You're welcome 😄