haproxy设置白名单

栏目: 服务器 · 发布时间: 6年前

内容简介:haproxy:上述代码监听宿主机80端口,转发给docker容器8080端口,方便做balance。仅且允许white_ip_list白名单访问

Haproxy 在做负载均衡的解决方案时,如何仅且允许前端访问后端服务器,从而最大限度的保证后端服务器的安全?谷歌查到, haproxy 自带软防火墙(白名单)的方案。 haproxy 自身其实是支持白名单机制的。不用在去 iptables 另行配置可信客户端。记录下。

haproxy:

frontend tcp-front
        bind *:80
        mode tcp
        default_backend         tcp-back
 
backend tcp-back
        mode tcp
        balance leastconn
        tcp-request content accept if { src -f /etc/haproxy/white_ip_list }
        tcp-request content reject
        server tcp-one 172.17.0.2:8080

上述代码监听宿主机80端口,转发给 docker 容器8080端口,方便做balance。仅且允许white_ip_list白名单访问

white_ip_list(ip or ip段):

114.247.0.0/16
223.64.0.0/11

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Natural Language Processing with Python

Natural Language Processing with Python

Steven Bird、Ewan Klein、Edward Loper / O'Reilly Media / 2009-7-10 / USD 44.99

This book offers a highly accessible introduction to Natural Language Processing, the field that underpins a variety of language technologies, ranging from predictive text and email filtering to autom......一起来看看 《Natural Language Processing with Python》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

随机密码生成器
随机密码生成器

多种字符组合密码

html转js在线工具
html转js在线工具

html转js在线工具