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

[经验分享] 配置 squid 使其支持 访问https站点

[复制链接]

尚未签到

发表于 2018-12-26 11:49:16 | 显示全部楼层 |阅读模式
需求:让用户通过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_ports
http_access denyCONNECT !SSL_ports继续

后台在squid.conf中把squiddebug日志打开
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 notavailable
2016/12/11 12:10:19|WARNING: CONNECT method received on http Accelerator port 3128
2016/12/11 12:10:19|WARNING: for request: CONNECT mail.qq.com:443 HTTP/1.1
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0
Proxy-Connection:keep-alive
Connection:keep-alive
Host:mail.qq.com:443
Proxy-Authorization:Basic a2VubnkuemhhbzoxMjM0NTY=
2016/12/1112:10:19.494| clientProce***equest: 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
仅仅是squidhttps网站之间的通信是https
Browsersuqid之间的通信仍是通过http

此处原先理解有误,实际上https传输过程中从浏览器到对方服务器之间的通信都是加密的
可以考虑在squid 上配置https端口和证书来加密 Browsersquid之间的通信,
https_port 443cert=/path/to/your.crt key=/path/to/your.key


参考 http://wiki.squid-cache.org/Features/HTTPS
Encrypted browser-Squid connection
  
WhileHTTPS design efforts were focused on end-to-end communication, it wouldalso be nice to be able to encrypt the browser-to-proxy connection
(without creating a CONNECT tunnel that blocks Squid from accessing and
caching content). This would allow, for example, a secure use of remote
proxies located across a possibly hostile network.
Squid can accept regular proxy traffic using https_port in the same way Squid does it using an http_portdirective. Unfortunately, popular modern browsers do not permit
configuration of TLS/SSL encrypted proxy connections. There are open bugreports against most of those browsers now, waiting for support to
appear. If you have any interest, please assist browser teams with
getting that to happen.
Meanwhile,tricks using stunnel or SSH tunnels are required to encrypt the
browser-to-proxy connection before it leaves the client machine. These
are somewhat heavy on the network and can be slow as a result.


Chrome
  
TheChrome browser is able to connect to proxies over SSL connections if
configured to use one in a PAC file or command line switch. GUI
configuration appears not to be possible (yet).
More details at http://dev.chromium.org/developers/design-documents/secure-web-proxy


Firefox
  
TheFirefox 33.0 browser is able to connect to proxies over SSL connectionsif configured to use one in a PAC file. GUI configuration appears not
to be possible (yet).
There is still an important bug open:
  Using a client certificate authentication to a proxy: https://bugzilla.mozilla.org/show_bug.cgi?id=209312

  大意就是目前主流的浏览器都无法直接通过GUI界面直接配置https代理,
  但可以通过pac文件指定https代理服务器,
  chrome也可以通过命令行的方式启动浏览器并指定代理服务器




运维网声明 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-656048-1-1.html 上篇帖子: squid 认证配置 下篇帖子: squid 安装简单说明
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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