Can I define a 'network list' in globa/defaults to be used in acl

Can I define a ‘network list’ in globa/defaults to be used in acl. Something like this

localnets 192.168.10.0/24, 127.0.0.1

And then use an acl like :
acl network_allowed src localnets

No, but there is a feature request open to define multiple patterns in an environment variable:

Until then, you’d have to either use single patterns in (global) environment variables or duplicate the acl setting in all sections.

I’m doing something along these lines, but using external files.

I’ve got files set up in /etc/haproxy/ipranges along the lines of product_prod.subnets and then in each a list of the subnets for it, i.e.:

10.1.2.0/24
10.1.3.0/24

Then, in my acl I’ve defined:

acl product_prod src -f /etc/haproxy/ipranges/product_prod.subnets
1 Like