现在有一个需求就是在发版的时候希望除公司IP外的外网访问服务的时候都是拒绝访问的

现在利用haproxy 的acl规则作出限制

errorfile       403 /etc/haproxy/errfile/403.httpacl                       url_bao                 hdr(Host)               -i      bao.doyoulicai.com
acl                       kongzhong_src           src             222.73.17.25  222.73.17.24
http-request deny if url_jr !kongzhong_src
use_backend         bao.doyoulicai.com              if url_bao
backend                 bao.doyoulicai.combalance roundrobinoption  httpchk GET /test HTTP/1.0server  10.9.6.18:6011        10.9.6.18:6011        check inter 60000 rise 2 fall 5 weight 10

按照这样设置的话就可以实现当除222.73.17.25 222.73.17.24以外的其他IP地址访问bao.doyoulicai.com的时候都直接拒绝访问403页面

然后现在自定义一下403页面

[root@test_ha_nginx errfile]# cat 403.http
HTTP/1.0 403 Forbidden
Cache-Control: no-cache
Connection: close
Content-Type: text/html<!DOCTYPE html>
<html><head><meta charset="UTF-8"><title></title><!--<link rel="stylesheet" href="/static/css/new_error.css">--><style>*{margin:0;padding:0;}body{background-color: #f3f3f3;}.content{width:380px;height:400px;position:absolute;top:50%;left:50%;transform: translate(-50%,-50%);}.content .main{z-index: 5;position:relative;}.content .main .post{position:absolute;top:100px;left:40px;width:11px;height:99px;border:3px solid #959595;border-radius: 5px;border-bottom: none;}.content .main .post2{left:112px;}.content .main .tops{position:absolute;top:108px;left:16px;width:134px;height:25px;border:3px solid #959595;border-radius: 5px;z-index: 3;background-color: #FFFFFF;}.content .main .tops i{display: block;width:37px;height:2px;position:absolute;top:11px;left:4px;background-color: #959595;transform: rotate(-43deg);}.content .main .tops i.i1{left:33px;}.content .main .tops i.i2{left:62px;}.content .main .tops i.i3{left:92px;}.content .main .foot{position:absolute;top:199px;left:33px;width:24px;height:7px;border:3px solid #959595;border-radius: 5px;background-color: #f3f3f3;}.content .main .foot2{left:105px;}/*STOP*/.content .stops{z-index: 5;position:relative;              }.content .stops .big{position:absolute;top:-30px;left:163px;width:112px;height:112px;border:3px solid #959595;border-radius: 50%;background-color:#fff;}.content .stops .big .min{position:absolute;top:8px;left:8px;width:90px;height:90px;border:3px solid #959595;border-radius: 50%;font:bold 24px/90px "微软雅黑";text-align: center;color:#666666;background-color:#fff;}.content .stops .middle{position:absolute;top:87px;left:210px;width:15px;height:111px;border:3px solid #959595;border-bottom: none;border-top: none;}.content .stops .foots{position:absolute;top:198px;left:205px;width:24px;height:7px;border:3px solid #959595;border-radius: 4px;}.content h2{z-index: 3;width:600px;position:absolute;top:230px;left:-41px;font:30px/80px "微软雅黑";color:#666;}/*帽子*/.content .cap{position:relative;}.content .cap .left{z-index: 3;position:absolute;top:181px;left:126px;width:61px;height:3px;background-color: #959595;transform: rotate(-71deg);}.content .cap .right{z-index: 3;position:absolute;top:181px;left:145px;width:61px;height:3px;background-color: #959595;transform: rotate(71deg);}.content .cap .round{z-index: 3;position:absolute;top:116px;left:135px;width:62px;height:62px;border:2px solid #959595;border-radius: 50%;border-top: none;border-right:none;border-left: none;              }.content .cap .round2{z-index: 3;width:162px;height:162px;top:31px;left:86px;}.content .cap .round3{z-index: 2;width:200px;height:200px;top:12px;left:66px;background-color:#f3f3f3;}.content .cap .just{position:absolute;top:-15px;left:150px;width:200px;height:200px;background-color: #f3f3f3;z-index: 4;transform: rotate(71deg);}.content .cap .just2{top:-15px;left:-17px;transform: rotate(-71deg);}.content .cap .foots{z-index: 1;position:absolute;top:199px;left:144px;width:37px;height:37px;border-radius: 5px;/*transform: skew(30deg,30deg);*/border:3px solid #959595;transform: rotate(38deg) skew(-34deg,-13deg);}</style></head><body><div class="content"><div class="main"><!--立柱子两个--><div class="post"></div><div class="post post2"></div><!--横柱子--><div class="tops"><i></i><i class="i1"></i><i class="i2"></i><i class="i3"></i></div><!--脚底--><div class="foot"></div><div class="foot foot2"></div></div><!--帽子--><div class="cap"><!--<div class="skews"></div>--><!--左边横线--><div class="left"></div><!--右边横线--><div class="right"></div><!--三个圆--><div class="round"></div><div class="round round2"></div><div class="round round3"></div><!--两个正方形做遮盖--><div class="just"></div><div class="just just2"></div><!--帽子的底部--><div class="foots"></div></div><!--stop--><div class="stops"><div class="big"><div class="min">STOP</div></div><div class="middle"></div><div class="foots"></div></div><!--文字--><h2>哎呀!服务器停机维护中...</h2></div></body>
</html>

转载于:https://www.cnblogs.com/smail-bao/p/6198799.html

haproxy利用ACL规则封禁自定义IP地址拒绝访问相关推荐

  1. Nginx自动封禁可疑Ip

    文章目录 一.Nginx封禁ip 1.简介 2.nignx 禁止IP访问 2.1 方法一 2.2 方法二 3.关于 deny 的使用 二.脚本自动封禁Ip 1.流程介绍 2.脚本实战 2.1 核心脚本 ...

  2. 守望先锋,工坊规则封禁源式利用表情卡原地小跳

    守望先锋,工坊规则封禁源式利用表情卡原地小跳 禁止卡小跳代码,分享代码:[31M10] 规则("禁止使用表情卡小跳") {事件{持续 - 每名玩家;双方;全部;}条件{正在使用表情 ...

  3. 关于iptables封禁国外IP方法

    0.背景说明 个人买的腾讯云或者阿里云的机器,部署了一些应用服务,"黑客"可能会恶意进行攻击,有的是使用国内IP,有的是模拟国外的IP. 本文主要针对封禁国外IP的方法. 1.安装 ...

  4. 封禁恶意IP访问在我司实践总结

    1.需求分析 随着公司业务量的增长,有些人可能就会动些小心思搞你一下,爬虫或者恶意访问你,如何限制这些用户访问呢,今天做下总结,大体有三种方案:代码层面:http服务器(以nginx为例):服务器网络 ...

  5. cs1.6服务器ip地址文件,cs1.6服务器端封禁的IP在那个文件夹里?

    CS1.6自架服务器封禁IP小弟我自己架了一个校园局域网服务器,有些玩家我不想让他进来,封IP,输入指令addip 0 ***.***.***.**以后,该IP玩家被ban,禁止进入服务器,查询lis ...

  6. 阿里云ECS后台利用“安全组”屏蔽恶意攻击ip地址

    在阿里云后台的云盾监控->威胁->攻击,会发现每天有大量的恶意攻击,存在大量GET请求,导致服务器资源浪费无用消耗. 20160220102620 最近7天攻击类型 仔细查看攻击来源的信息 ...

  7. php inet_aton(),如何通过mysql 利用inet_aton和inet_ntoa来处理ip地址数据

    本文将介绍如何在数据库中使用合适格式保存ip地址数据,并能方便的对ip地址进行比较的方法. 1.保存ip地址到数据库 数据库中保存ip地址,字段一般会定义为:`ip` char(15) NOT NUL ...

  8. 阿里云ECS服务器配置LAMP使用IP地址无法访问填坑(一)

    阿里云ECS服务器配置LAMP使用IP地址无法访问填坑(一) 闲来无事,想配置一下阿里云赠送半年的免费ECS服务器,根据阿里云的官方文档,手动搭建LAMP环境刚开始就遇到了麻烦,配置好apache之后 ...

  9. php禁止代理ip访问_php禁止某ip或ip地址段访问的方法

    推荐:PHP两种快速排序算法实例这篇文章主要介绍了PHP两种快速排序算法实例,本文直接给出实现代码,分别使用递归法.迭代法实现,需要的朋友可以参考下 虽然在PHP这样的web应用开发中,我们不是太强调 ...

  10. 通过地址访问 mysql_MySql通过ip地址进行访问的方法

    1.登录mysql: mysql -u root -h 127.0.0.1 -p 2.切换数据库 use mysql 3.授权 grant all privileges on *.* to 'root ...

最新文章

  1. linux 系统日志 查看被杀掉的进程(占用内存过大)
  2. 152. Leetcode 剑指 Offer 14- II. 剪绳子 II (贪心算法-基础题目)
  3. hdu 1115 计算多边形重心
  4. java中servletcontext_java中获取ServletContext常见方法
  5. python中的死锁
  6. vue.js 重定向 和 404 等等相关的问题?
  7. idle显示出错信息 python_Life is short,you need Python——Python入门
  8. document.body.scrollTop值为0的解决方法[转]
  9. 运行Django,Python崩溃
  10. Beyond Compare设置文本文件和Delphi源码默认的打开格式为ANSI
  11. Windows 使用 ssh 命令行 通过密钥连接到 云服务器
  12. 二十年后的回眸(3)——快乐的单身汉
  13. .Net 配置系统-数据库配置提供者
  14. 周爱民:真正的架构师是没有title的
  15. 延云YDBYA100安装部署文档
  16. Common Language Extension(CLE) 介绍
  17. C# BLE蓝牙开发之使用Windows.Devices.Bluetooth获取小米体重秤的体重
  18. 我将进化成一条狗(5)——VR和AR
  19. 量子计算基础(学习笔记)
  20. 联想拯救者y7000键盘有几个按键失灵_y7000p键盘失灵

热门文章

  1. github API 实例 分页读取
  2. spark入门(1)
  3. c语言开发kafka环境,c++(11)使用librdkafka库实现kafka的消费实例
  4. 设计模式之GOF23观察者模式
  5. emc re 整改 超标_两种常见EMC整改流程
  6. Oracle 常见错误代码处理 1
  7. Matter-JS Composites 混合材料 · 上
  8. LayaAir UI 组件 # HSlider,VSlider(水平/垂直滑动条)
  9. Java 定时器 Timer 与 定时任务 TimeTask
  10. 十九、CSS如何引入字体