配置 squid 使其支援 訪問https網站

來源:互聯網
上載者:User

標籤:squid https

需求:讓使用者通過squid訪問https網站

注意和配置squid使其支援https不同

網上的資料基本都是給squid配置一個認證,但直覺告訴我這並不能解決我們的問題

 

進入正題,通過之前配置好的squid訪問http網站可以正常訪問,

但無法訪問https開頭的網站

 

尋找問題最好的方法就是分析日誌

access.log中發現如下資訊

NONE/400 4280CONNECT error:method-not-allowed - NONE/- text/html

 

查看 squid.conf ,預設配置是允許CONNECT 目標443連接埠的

acl SSL_ports port443# Deny CONNECT toother than secure SSL ports#always_directdeny  !ssl_portshttp_access denyCONNECT !SSL_ports

繼續

 

後台在squid.conf中把squid的debug日誌開啟

debug_options ALL,133,2

查看/var/log/squid/cache.log日誌發現

2016/12/11 12:10:19|IpIntercept.cc(137) NetfilterInterception: NF getsockopt(SO_ORIGINAL_DST) failed on FD 10: (92) Protocol notavailable2016/12/11 12:10:19|WARNING: CONNECT method received on http Accelerator port 31282016/12/11 12:10:19|WARNING: for request: CONNECT mail.qq.com:443 HTTP/1.1User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0Proxy-Connection:keep-aliveConnection:keep-aliveHost:mail.qq.com:443Proxy-Authorization:Basic a2VubnkuemhhbzoxMjM0NTY= 2016/12/1112:10:19.494| clientProcessRequest: Invalid Request

 

好了,好像看到了點不對勁的地方

第一個問題,

IpIntercept.cc(137)NetfilterInterception:  NFgetsockopt(SO_ORIGINAL_DST) failed on FD 10: (92) Protocol not available

經過查詢,是因為一個module開機的時候沒有載入

執行modprobeip_conntrack

再次訪問,查看日子,此錯誤提示消失了,但這個錯誤並不是主要問題

 

繼續查詢第二行報錯

WARNING: CONNECTmethod received on http Accelerator port

設定檔中有這麼一行

http_port 3128 transparent accel

經過一番搜尋,去掉配置中的accel參數

即把

http_port 3128 transparent accel

改為

http_port 3128 transparent

 

重新載入設定檔,

squid -k reconfigure

 

重新訪問https網站,發現已經可以正常通過squid訪問,

至此,問題已經得到解決. 不要忘了關掉debug日誌

 

但是配置了https,本身就是為了傳輸過程的安全

而現在的架構是

Browser <--->Squid <---> Https Site

僅僅是squid和https網站之間的通訊是https的

Browser和suqid之間的通訊仍是通過http的,

可以考慮在squid 上配置https連接埠和認證來加密 Browser和squid之間的通訊,

https_port 443cert=/path/to/your.crt key=/path/to/your.key


本文出自 “virtual_space” 部落格,請務必保留此出處http://itest.blog.51cto.com/3511959/1881631

配置 squid 使其支援 訪問https網站

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.