zoukankan      html  css  js  c++  java
  • ACL访问控制

    /etc/squid/squid.conf

    定义语法:

    acl aclname  acltype   string

    acl  aclname  acltype   "file"

    src 定义来源地址  (即用户的客户机IP地址);

    acl  aclname src ip-address/netmask

    acl   aclname src  addr1-addr2/netmask

    dst定义目标地址 (即用户请求的网站IP地址):

    acl aclname  dst  ip-address/netmask

    port用于指定访问端口

    acl  aclname port   80  1024

    acl  aclname  port  0-1024

    url-regex 用于限制网址中的关键词:

    acl  aclname  url_regex  [-i]  pattern

    proto 用于定义要代理的协议:

    acl aclname  proto  HTTP  FTP

    method 用于制定请求的方法:

    acl  aclname  method   GET  POST

    访问控制列表有多个规则条目组成,根据指定的条件来允许或限制访问请求,匹配顺序会由上至下,一旦匹配则立即结束,通常会在控制列表的最下面写上 " deny  all "  或者 "  allow all  "  来避免安全隐患。

    实战操作:

    仅允许192.168.0.10的主机使用本笃 Squid 服务 ,拒绝其余主机

    acl  client  src 192.168.0.10

    http_access  allow  client 

    http_access   deny  all

    拒绝客户机使用代理服务器访问带有关键词 " linux " 的网站

    acl  deny_keyword url_regex  -i  linux

    http_access  deny  deny_keyword

    拒绝客户机使用代理服务器访问 "  京东  "  网站

    acl   deny_url  url_regex   https://www.jd.com

    http_access  deny  deny_url

    禁止客户机代理服务器下载  MP3 与  rar  为后缀的文件

    acl  badfile  urlpath_regex  -i  .mp3$  .rar$

    http_access   deny  badfile

  • 相关阅读:
    Java 简单算法--打印乘法口诀(只使用一次循环)
    Java简单算法--求100以内素数
    ubuntu 16.04 chrome flash player 过期
    java 网络API访问 web 站点
    java scoket (UDP通信模型)简易聊天室
    leetcode1105 Filling Bookcase Shelves
    leetcode1140 Stone Game II
    leetcode1186 Maximum Subarray Sum with One Deletion
    leetcode31 Next Permutation
    leetcode834 Sum of Distances in Tree
  • 原文地址:https://www.cnblogs.com/liu1026/p/9844300.html
Copyright © 2011-2022 走看看