zoukankan      html  css  js  c++  java
  • haproxy白名单设置

    在使用haproxy来作为tcp代理时,需要对某些IP做限制。用iptables也可以实现的。 顺道看了看haproxy手册,看看haproxy本身有是否提供方法来限制。要熟练使用某款应用需要熟读手册,手册是最权威,最详细的。好了,不罗嗦了,来看看haproxy怎么实现的:

    Syntax

    Sections

    Defaults Frontend Listen Backend
    No Yes Yes No

    Description

    During TCP content inspection, the connection is immediately validated if the condition is true (when used with "if") or false (when used with "unless"). Most of the time during content inspection, a condition will be in an uncertain state which is neither true nor false. The evaluation immediately stops when such a condition is encountered. It is important to understand that "accept" and "reject" rules are evaluated in their exact declaration order, so that it is possible to build complex rules from them. There is no specific limit to the number of rules which may be inserted.

    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

    Sections

    Defaults Frontend Listen Backend
    No Yes Yes No

    Description

    During TCP content inspection, the connection is immediately rejected if the condition is true (when used with "if") or false (when used with "unless"). Most of the time during content inspection, a condition will be in an uncertain state which is neither true nor false. The evaluation immediately stops when such a condition is encountered. It is important to understand that "accept" and "reject" rules are evaluated in their exact declaration order, so that it is possible to build complex rules from them. There is no specific limit to the number of rules which may be inserted.

    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段。

  • 相关阅读:
    Ubuntu 16.04 安装 .NET Core[转]
    SQL Server 2012提供的OFFSET/FETCH NEXT与Row_Number()对比测试 [T]
    npm package
    RN 文件上传下载
    RN css整理
    react nginx配置
    macOS安装homebrew报错 errno 54 & port 443:Connection refused
    shopify插件开发oauth报400的解决办法
    Mac下更新Ruby版本
    Failed to connect to raw.githubusercontent.com port 443 解决方案
  • 原文地址:https://www.cnblogs.com/hyming011/p/8252727.html
Copyright © 2011-2022 走看看