Oefenweb/ansible-haproxy

listen block missing tcp_request

quulah opened this issue · 8 comments

It's supported there, and also in backend, but this role seems to be missing a parameter for it.

I also noticed, that there's some differences between the template and the README.

The README says:

haproxy_frontend.{n}.tcp_request: [optional]: Perform an action on a new session depending on a layer 4-7 condition. (e.g. content captureparam req.ssl_sni len 50)

But the template has action, param and cond like in http_request:

  tcp-request {{ tcp_request.action }}{% if tcp_request.param is defined %} {{ tcp_request.param }}{% endif %}{% if tcp_request.cond is defined %} {{ tcp_request.cond }}{% endif %}

I made a fork and was in the process of making some changes and a pull request, but I'm not sure how to handle the action, param and cond stuff.

If you look at the configuration for HAProxy, http-request and tcp-request differ a bit.

tcp-request has things like content and connection in the keyword, and then the action and condition.

Currently, the action would be content for example, which I think is a bit wrong.

If you follow the README, then it would just be a list of things and the template needs changing.

If you want to separate the actions, conditions and other parameters then both the README and template need some fixing.

:)

I agree that the README is a bit cripple (and the implementation might be too :-)). Can you add a link of the tcp-request documentation. I'll try to have a look at it soon.

I guess there should be 4 separate options:

  • tcp-request connection
  • tcp-request content
  • tcp-request inspect-delay
  • tcp-request session

With corresponding arguments (e.g. action, condition, timeout).

Can you add them where they're supported.

screenshot from 2018-05-15 22-19-38

And remove the general tcp_request?

Finally got around to doing the changes. I added new variables tcp_request_content, tcp_request_connection, tcp_request_session and tcp_request_inspect_delay to the templates for listen, backend and frontend.

The variable names are a bit long, might also be a tcp_request dict, but tell me what you think. :)