免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4421 | 回复: 5
打印 上一主题 下一主题

[proxy] squid ACL 限制上班时间访问某些网站为什么这样写啊 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-07-26 09:41 |只看该作者 |倒序浏览
acl NotWorkRelated dstdomain  
"/usr/local/squid/etc/not-work-related-sites"  
      
acl WorkingHours time D 08:00-17:30  
      
http_access deny !WorkingHours NotWorkRelated  
刚学squid最后这句不是很明白,特别是这个!,有明白的给解释一下吧

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
2 [报告]
发表于 2012-07-26 10:18 |只看该作者

  1. 小弟以前的笔记 希望对兄弟有所帮助 ^_^

  2. > more ~/squid/squid.txt
  3. # Squid Web Proxy Cache (3128port)
  4. yum install squid -y
  5. /etc/init.d/squid restart

  6. acl love src 192.168.0.0/255.255.255.0
  7. http_access allow love

  8. #1. Whitelist Control
  9. acl whitelist src 192.168.0.12 192.168.0.1
  10. http_access allow whitelist
  11. http_access deny ! whitelist

  12. acl myclients src 192.168.0.0/24
  13. acl myclients src example.com
  14. acl all src 0.0.0.0/0.0.0.0
  15. acl myfriends src "/etc/squid/myfriends.lst"
  16. http_access allow myfriends
  17. http_access allow myclients
  18. http_access deny all

  19. #1.2 vim /etc/squid/myfriends.lst
  20. 192.168.0.39
  21. 192.168.0.49
  22. 192.168.0.59

  23. #1.3 Domain Control
  24. acl all src 0.0.0.0/0.0.0.0
  25. http_access allow myclients
  26. http_access deny all



  27. #1.4 Contents Control
  28. acl ICQ_domain dst "/etc/squid/acl/ICQ_domain"
  29. acl sex_domain dst "/etc/squid/acl/sex_domain
  30. acl violence_domain dst "/etc/squid/acl/violence_domain
  31. http_access deny ICQ_domain
  32. http_access deny sex_domain
  33. http_access deny violence_domain

  34. #   acl aclname src      ip-address/netmask ... (clients IP address)
  35. #   acl aclname src      addr1-addr2/netmask ... (range of addresses)
  36. #   acl aclname dst      ip-address/netmask ... (URL host's IP address)
  37. #   acl aclname myip     ip-address/netmask ... (local socket IP address)
  38. #   acl aclname arp      mac-address ... (xx:xx:xx:xx:xx:xx notation)
  39. #   acl aclname urllogin [-i] [^a-zA-Z0-9] ...      # regex matching on URL login field

  40. #1.5 Regular Expression
  41. acl movie_site1 url_regex ^http://www.youku.com
  42. acl movie_site2 url_regex ^http://www.tudou.com
  43. acl movie_site3 url_regex ^http://www.ku6.com
  44. acl games_site url_regex -i 3721
  45. acl download_file urlpath_regex -i \.swf$ \.gif$ \.jpg$ \.png$ \.wmv$ \.exe$ \.rmvb$ \.flv$
  46. http_access deny movie_site1
  47. http_access deny movie_site2
  48. http_access deny movie_site3
  49. http_access deny games_site
  50. http_access deny download_file

  51. # 1.6 Boss Control
  52. acl special_user src 192.168.0.8
  53. http_access allow special_user

  54. # 1.7 Time Control
  55. # acl aclname time     [day-abbrevs]  [h1:m1-h2:m2]
  56. # day-abbrevs:
  57. #      S - Sunday
  58. #      M - Monday
  59. #      T - Tuesday
  60. #      W - Wednesday
  61. #      H - Thursday
  62. #      F - Friday
  63. #      A - Saturday
  64. #      h1:m1 must be less than h2:m2

  65. acl admin src 192.168.0.254
  66. acl allowed_clients src 192.168.0.0/24
  67. acl all src 0.0.0.0/0.0.0.0
  68. acl maintain_time time S 0:00-3:00
  69. acl working_time time MTWHF 8:30-20:30
  70. http_access allow admin maintain_time
  71. http_access allow allowed_clients working_time
  72. http_access deny all

  73. #    acl aclname port     80 70 21 ...
  74. #    acl aclname port     0-1024 ...         # ranges allowed
  75. #    acl aclname myport   3128 ...           # (local socket TCP port)
  76. #    acl aclname proto    HTTP FTP ...
  77. #    acl aclname method   GET POST ...


  78. # 1.8 Security Control
  79. acl Safe_ports port 80 21 443 1025-65535
  80. acl ftp proto FTP
  81. acl allowed_clients src 192.168.0.0/24
  82. acl all src 0.0.0.0/0.0.0.0
  83. http_access allow allowed_clients
  84. http_access deny ! Safe_ports
  85. http_access deny ftp
  86. http_access deny all

  87. # 2. Transparence Proxy
  88. # 2.1 Enable ip_forward
  89. echo "1" > /proc/sys/net/ipv4/ip_forward

  90. # 2.2 vim /etc/squid/squid.conf
  91. httpd_accel_host virtual
  92. httpd_accel_port 80
  93. httpd_accel_with_proxy on
  94. httpd_accel_user_host_header on

  95. # 2.3 Firewall Configure
  96. iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
  97. iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
复制代码

论坛徽章:
0
3 [报告]
发表于 2012-07-26 13:39 |只看该作者
你把你笔记给我,我还是不明白啊,给我解释一下最后一句就行了,为什么加!啊

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
4 [报告]
发表于 2012-07-26 15:05 |只看该作者
回复 3# lcx9035


    就是取反的意思! O_o

论坛徽章:
0
5 [报告]
发表于 2012-07-26 16:56 |只看该作者
我知道是取反,我是问为什么取反

论坛徽章:
0
6 [报告]
发表于 2012-07-30 10:52 |只看该作者
我终于知道为什么加!了,因为那资料上写错了,我说我怎么想不明白呢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP