无需二次开发,Cloud Alert 快速衔接您的IT事件和钉钉通知
996
2023-02-14
haproxy白名单设置
在使用haproxy来作为tcp代理时,需要对某些IP做限制。用iptables也可以实现的。 顺道看了看haproxy手册,看看haproxy本身有是否提供方法来限制。要熟练使用某款应用需要熟读手册,手册是最权威,最详细的。好了,不罗嗦了,来看看haproxy怎么实现的:
Syntax
1 | tcp-requestcontentaccept[{if|unless}<condition>] |
Sections
Defaults | Frontend | Listen | Backend |
No | Yes | Yes | No |
Description
Note that the "if/unless" condition is optional. If no condition is set on the action, it is simply performed unconditionally.
If no tcp-request content rules are matched, the default action already is "accept". Thus, this statement alone does not bring anything without another reject statement.
Syntax
1 | tcp-requestcontentreject[{if|unless}<condition>] |
Sections
Defaults | Frontend | Listen | Backend |
No | Yes | Yes | No |
Description
Note that the "if/unless" condition is optional. If no condition is set on the action, it is simply performed unconditionally.
If no "tcp-request content" rules are matched, the default action is set to "accept".
配置实例如下:
white_ip_list白名单文件一行一个IP或者IP段。
发表评论
评论列表