haproxy-tools icon indicating copy to clipboard operation
haproxy-tools copied to clipboard

Add and remove Frontend ACL

Open chriswessells opened this issue 8 years ago • 4 comments

I need the ability to add and remove acl from the frontend configuration.

I don't see the functionality in the current code. To accomplish this following the existing model:

  • Create new rules in treetop to parse the pattern
  • Create Modules for the rules
  • Update the Config to add the acl
  • Update the parse to read the acl into the object
  • Update the render to show the object

I can work on this functionality with a little guidance. ping: @subakva Thanks,

chriswessells avatar Jan 16 '18 17:01 chriswessells

Unfortunately, there's no single PR or commit to look at that encapsulates all the changes you'd need to make. It's also been quite a while since I wrote this code, so it's not present in my head anymore either.

It looks like you might be able to handle the acl lines in the frontend sections in the same way that server lines are handled in the backend sections.

One of the test fixture files (multi-pool.haproxy.cfg) has a few acl lines in it. That could be a good starting point for writing a test to see if you can read, update and write those lines.

subakva avatar Jan 17 '18 18:01 subakva

Some (but not all) relevant lines for handling server configurations:

https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/treetop/config.treetop#L62 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/treetop/nodes.rb#L124 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/parser.rb#L145 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/parser.rb#L161 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/config.rb#L6 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/config.rb#L11 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/renderer.rb#L29 https://github.com/subakva/haproxy-tools/blob/master/lib/haproxy/renderer.rb#L82

subakva avatar Jan 17 '18 19:01 subakva

Thanks @subakva That will get me started!

chriswessells avatar Jan 17 '18 20:01 chriswessells

@chriswessells I was wondering if you already managed to add this feature? I would also need to be able to add/remove ACLs from a frontend along with the use_backend ... if acl parameter.

hostingnuggets avatar May 13 '18 10:05 hostingnuggets