haproxy acl应用

 

仅允许内网段访问虚拟目录路径/powershell

方法一:

http-request deny if { path_beg -i /powershell } !{ src 10.0.0.0/8 192.168.120.0/24 172.16.0.0/12}

方法二:

acl allow_ip src 192.168.0.0/16 10.0.0.0/8 172.16.0.0/12
acl path_ps path_beg -i /powershell
block if path_ps !allow_ip

 方法三:

acl ip_whitelist src -f /usr/local/haproxy/config/whitelist.acl
http-request deny if { path_beg -i /powershell } !ip_whitelist

cat /usr/local/haproxy/config/whitelist.acl
192.168.0.0/16
172.16.0.0/12
10.0.0.0/8

 

定义白名单列表:

cl ip_whitelist src -f /usr/local/haproxy/config/whitelist.acl
http-request allow if ip_whitelist

 

posted on 2024-01-11 21:26  momingliu11  阅读(12)  评论(0编辑  收藏  举报