2017-06-13 243 views
0

我正在嘗試設置一個Squid代理實例,以便它可以與Test Kitchen一起用於廚師食譜開發。Squid如何配置爲緩存所有下載的文件?

當Test Kitchen加入虛擬機時,通過下載它來安裝chef-client。我配置了它,以便通過代理服務器進行下載,但Squid不緩存下載的文件,例如

enter image description here

認爲這也許到它通過SSL被訪問,但我不是100%肯定。這是因爲apt在Ubuntu虛擬機配置爲使用相同的代理實例,我得到的緩存命中這些文件:

enter image description here

這裏是我的squid.conf文件:

http_port 3128 

acl manager url_regex -i ^cache_object:// +i ^https?://[^/]+/squid-internal-mgr/ 

acl localhost src 127.0.0.1/32 ::1 
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 

acl localnet src 10.0.0.0/8  # RFC 1918 possible internal network 
acl localnet src 172.16.0.0/12 # RFC 1918 possible internal network 
acl localnet src 192.168.0.0/16 # RFC 1918 possible internal network 
acl localnet src fc00::/7  # RFC 4193 local private network range 
acl localnet src fe80::/10  # RFC 4291 link-local (directly plugged) machines 

acl SSL_ports port 443 
acl Safe_ports port 80   # http 
acl Safe_ports port 21   # ftp 
acl Safe_ports port 443   # https 
acl Safe_ports port 70   # gopher 
acl Safe_ports port 210   # wais 
acl Safe_ports port 1025-65535 # unregistered ports 
acl Safe_ports port 280   # http-mgmt 
acl Safe_ports port 488   # gss-http 
acl Safe_ports port 591   # filemaker 
acl Safe_ports port 777   # multiling http 
acl CONNECT method CONNECT 

http_access allow manager localhost 
http_access deny manager 
http_access deny !Safe_ports 
http_access deny CONNECT !SSL_ports 
http_access allow localhost 
http_access allow localnet 
http_access deny all 

maximum_object_size 1024 MB 
cache_replacement_policy heap LFUDA 
cache_dir aufs /var/spool/squid3 5000 24 256 
coredump_dir /var/spool/squid3 

refresh_pattern ^ftp:   1440 20%  10080 
refresh_pattern ^gopher:  1440 0%  1440 
refresh_pattern Packages\.bz2$ 0  20%  4320 refresh-ims 
refresh_pattern Sources\.bz2$ 0  20%  4320 refresh-ims 
refresh_pattern Release\.gpg$ 0  20%  4320 refresh-ims 
refresh_pattern Release$  0  20%  4320 refresh-ims 
refresh_pattern -i .(deb|rpm|exe|zip|tar|tgz|bz2|ram|rar|bin)$ 129600 100% 129600 override-expire ignore-no-cache ignore-no-store 
refresh_pattern .    0  20%  4320 

不任何人都知道我需要添加到配置中,以便它可以緩存chef-client的下載?它是一個SSL鏈接嗎?

回答

0

可能出現這種情況,我已經確定這確實與SSL有關。

原因是SSL是爲了給予隱私的期望,所以默認情況下,squid不緩存受保護的頁面,因爲它看不到它們。

由於我只打算使用這個軟件包的緩存我有兩個選擇:

  1. 下載chef-client使用普通的HTTP URL
  2. 創建一個自簽名證書魷魚是在一個男人中間,所以它可以解密傳入的數據並緩存它。

數字1目前較爲容易,而數字2在長期內可能更爲穩健。