设为首页 收藏本站
查看: 767|回复: 0

[经验分享] squid安全配置

[复制链接]

尚未签到

发表于 2018-12-26 09:56:26 | 显示全部楼层 |阅读模式
Network Hosts:
linuxcbtwork1 -> Primary DNS server -> 192.168.1.72
linuxcbtserv1 -> 192.168.1.10
linuxcbtserv2 -> 192.168.1.20
linuxcbtserv3 -> 192.168.1.30
cache1 -> CNAME -> linuxcbtserv2

Squid client/server logic:
client(
www.google.com) -> Squid -> server/peer cache
Steps to Squid installation
1. Setup DNS - cache1.linuxcbt.internal
2. Install Squid
3. Start Squid and attempt to use - modify ACLs
4. Access to the Internet is granted

Notes: Squid defaults to TCP:3128
Squid Logging:
Default Directory: /var/log/squid
cache.log -> system info (RAM/CPU/Virtual Memory/Networking)
squid.out -> basic system info
access.log -> main user log file
access.log Fields using Native Squid Log Format:
1. Request_Time(Unix Epoch.ms) - 2. elapsed_time(ms) of page/object delivery 3. remotehost(ip) 4. code(Squid actions)/status(http errors)
5. bytes delivered to client 6. Method(Get/Post/Connect) 7. URL 8. IDENT 9. hierarchy (DIRECT/IP) 10. Type(MIME)
Note: Squid also supports Common Log Format (CLF)

Store.log (stores objects in cache) Fields:
1. Time 2. action(Release,Create,Swapout,Swapin) 3. file number(location disk /var/spool/squid) 4. HTTP Status 5. HTTP Date 6. Last Modified
7. expiration of content 8. MIME type 9. size of content content_length/actual size read 10. method (Get/Post/Connect) 11. URL

Change Squid's default TCP Port:
1. modify /etc/squid/squid.conf
2. updated http_port 8080
3. /sbin/service squid reload
Note: https_port functions as follows:
#client -> Squid -> HTTPS Web Server

ACLs:
Safe Ports:
1. Definition of ACL:
acl Safe_ports port 999
acl unique_name type(src/dst/dstdomain/srcdomain/time_of_day/etc.) descision_string
2. Apply ACL using criteria:
http_access

linuxcbtserv1 - 192.168.1.10 - deny
linuxcbtserv2 - 192.168.1.20
linuxcbtserv3 - 192.168.1.30
linuxcbtwork1 - 192.168.1.72
192.168.1.0/24 - CIDR

Lists:
1. can be built by repeating the ACLs. i.e.:
acl linuxcbt_bad_hosts src 192.168.1.10
acl linuxcbt_bad_hosts src 192.168.1.30
http_access linuxcbt_bad_hosts deny
2.acl linuxcbt_bad_hosts src "/etc/squid/linuxcbt_bad_hosts"

ACLs based Time:
days of week (DOW) = SMTWHFA
Hours and minutes: hh:mm-hh:mm

ACLs based specific destination domains:
1. build redundant list in squid.conf
2. build list in text file

ACLs based ANDed logic. i.e. deny access to site during business hours
1. build separate rules
2. combine rules
3. apply tag to combined rules

Business Rule: No casual browsing during work hours
1. Work Hours = MTWHF 08:30 17:30
2. Source Subnet = 192.168.1.0/24
3. Permit access to research-related websites - wikipedia.org

Business Rule: No browsing of sites with keyword 'sex'
1. define url_regex ACL
acl bad_keyword url_regex -i sex
http_access deny bad_keyword

Business Rule: No download of prohibited extensions
1. define url_regex ACL
acl bad_suffixes url_regex "/etc/squid/bad_suffixes"
http_access deny bad_suffixes

Business Rule: No outbound access to certain TLDs (.cn,.jp, etc.)
acl bad_tlds dstdom_regex "/etc/squid/bad_tlds"
http_access deny bad_tlds
urlpath_regex -
http://www.china.cn/downloads
Business Rule: Setup Squid as a non-caching Proxy Server
acl noncaching_hosts src 0.0.0.0/0.0.0.0
no_cache deny noncaching_hosts

Business Rule: Disable caching for specific sites (Internet/Intranet)
acl no_cache_sites dstdomain .yale.edu
no_cache deny no_cache_sites

Business Rule: Disable caching for dynamic sites (.php/.asp/pl/cgi/jsp/)
acl no_cache_dynamic_sites "/etc/squid/dynamic_sites"
no_cache deny no_cache_dynamic_sites

Business Rule: No Cache for Executives and Admins - Cache everyone else.
acl no_cache_execs src 192.168.1.10 192.168.1.20
no_cache deny no_cache_execs

Business Rule: Ensure that non-proxy servers have direct Internet-access
1. outbound Cisco Firewall (PIX) rules

Squid in a load-balanced fashion
192.168.1.0/24 -> 192.168.1.20
    192.168.1.30

192.168.1.0/24 -> Content Switches -> 192.168.1.20
          192.168.1.30

Business Rule: Implement Bandwidth management using Delay Pools
Note: Delay Pools have 3 different classes
a. class 1 allows us to restrict the rate for large downloads
1a. acl worker_bees src 192.168.1.0/24
1b. delay_pools 1 - defines the number of delay pools
2. delay_class 1 1 - setup class based pool #1 and using class #1
3. delay_parameters 1 restore_rate/max_size
a. delay_parameters 1 20000/15000
4. delay_access 1 allow worker_bees

Business Rule: Implement Bandwidth Management with Aggregate Rate
delay_pools 1
delay_class 1 2
delay_parameters 1 62500/62500 (max/max) 6250/6250
Note: T1 - 1,544,000
Ceiling: 500k(500,000 bits/second) = 62,500 bytes/second

Business Rule: Ensure that requests are routed through parent cache
Cache Hierarchy - Parent-Child
192.168.1.0/24 -> linuxcbtserv2(child) -> linuxcbtserv3(parent) -> INTERNET
cache_peer linuxcbtserv3.linuxcbt.internal parent 8080 3130 default
Note: CARP, ICP, HTCP, Cache-Digests

Business Rule: Ensure that local Intranet requests bypass the parent
cache_peer linuxcbtserv3.linuxcbt.internal parent 8080 3130 default
cache_peer_domain linuxcbtserv3.linuxcbt.internal !.linuxcbt.internal

Business Rule: Treat 192.168.1.10 as a privileged user bypassing the parent - linuxcbtserv3.linuxcbt.internal
acl avoid_parent_cache src 192.168.1.10
cache_peer_access linuxcbtserv3.linuxcbt.internal deny avoid_parent_cache


Business Rule: Treat caches as siblings
cache_peer linuxcbtserv3.linuxcbt.internal parent 8080 3130 default

Note: Parent-Child hierarchy - constitutes a centralized deployment
Note: Sibling hierarchy - constitutes a distributed deployment

#Business Rule: Limit simultaneous cache/proxy connections per-client
#MaxConn = 10
acl conn_limit maxconn 10
http_access deny conn_limit all







运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-655955-1-1.html 上篇帖子: squid 安装测试 下篇帖子: 转:squid常用维护命令 squid清除Cache缓存命令 squid总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表