内容简介: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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Looking For a Challenge
the University of Warsaw / the University of Warsaw / 2012-11 / 0
LOOKING FOR PROGRAMMING CHALLENGES? Then this book is for you! Whether it's the feeling of great satisfaction from solving a complex problem set, or the frustration of being unable to solve a task,......一起来看看 《Looking For a Challenge》 这本书的介绍吧!