我用的这个 docker image,
docker run --name squid -d -p 8010:3128 Datadog/squid
在 chrome 里面,设置了 switchy omega 到该机器的地址端口,能够正常工作,打开油管啥的, etc.
如果我用 proxifier, protocol 设置 http 模式,check 都通过,但是设置成 https,就会报错。
[43:29] Testing Started. Proxy Server Address: 10.35.35.87:8010 Protocol: HTTPS Authentication: NO [43:29] Starting: Test 1: Connection to the Proxy Server [43:29] IP Address: 10.35.35.87 [43:29] Connection established [43:29] Test passed. [43:29] Starting: Test 2: Connection through the Proxy Server Error: the proxy server (Squid) is not configured to allow SSL tunnel to port 80. To fix the problem please find and comment the following line in the Squid configuration file (squid.conf): http_access deny CONNECT !SSL_ports The proxy server reply header is: HTTP/1.1 403 Forbidden Server: squid/3.5.12 Mime-Version: 1.0 Date: Mon, 27 Sep 2021 09:43:32 GMT Content-Type: text/html;charset=utf-8 Content-Length: 3441 X-Squid-Error: ERR_ACCESS_DENIED 0 Vary: Accept-Language Content-Language: en X-Cache: MISS from cf3b7970725b X-Cache-Lookup: NONE from cf3b7970725b:3128 Via: 1.1 cf3b7970725b (squid/3.5.12) Connection: keep-alive [43:29] Test failed. [43:29] Testing Finished.
提示我把这句配置注释掉
"http_access deny CONNECT !SSL_ports"
于是 ,我去 https://gist.github.com/sritchie/1357652 下载了一个样本,把“头”那部分删除掉了。 然后把这句给#注释掉了。
但是貌似没有啥用。不知道是不是这个.conf 太老了,或者有太多不需要的配置了,还是说,要走 https 的 protocol,得配置相关的 cert,等等?
不知道有没有 squid 专家,指点一下
谢谢!
]]># Squid normally listens to port 3128 always_direct allow all ssl_bump bump all sslproxy_cert_error allow all http_port 3128 ssl-bump cert=/etc/squid/squid.pem key=/etc/squid/squid.pem generate-host-certificates=on optiOns=NO_SSLv2 #http_port 3128 cache_peer 127.0.0.1 parent 10809 0 no-query never_direct allow all
我测试了一下,它并没有通过 127.0.0.1:10809 上网?但是让我改成如下时,却生效了。
http_port 3128 cache_peer 127.0.0.1 parent 10809 0 no-query never_direct allow all
这是为什么?
完整配置
# # Recommended minimum configuration: # # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing # should be allowed acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src 172.16.0.0/12 # RFC1918 possible internal network acl localnet src 192.168.0.0/16 # RFC1918 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 # # Recommended minimum Access Permission configuration: # # Deny requests to certain unsafe ports http_access deny !Safe_ports # Deny CONNECT to other than secure SSL ports http_access deny CONNECT !SSL_ports # Only allow cachemgr access from localhost http_access allow localhost manager http_access deny manager # We strongly recommend the following be uncommented to protect innocent # web applications running on the proxy server who think the only # one who can access services on "localhost" is a local user #http_access deny to_localhost # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # # Example rule allowing access from your local networks. # Adapt localnet in the ACL section to list your (internal) IP networks # from where browsing should be allowed http_access allow localnet http_access allow localhost # And finally deny all other access to this proxy http_access deny all # Squid normally listens to port 3128 always_direct allow all ssl_bump bump all sslproxy_cert_error allow all http_port 3128 ssl-bump cert=/etc/squid/squid.pem key=/etc/squid/squid.pem generate-host-certificates=on optiOns=NO_SSLv2 #http_port 3128 cache_peer 127.0.0.1 parent 10809 0 no-query never_direct allow all # Uncomment and adjust the following to add a disk cache directory. cache_dir ufs /var/cache/squid 100 16 256 # Leave coredumps in the first cache dir coredump_dir /var/cache/squid # # Add any of your own refresh_pattern entries above these. # refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320 dns_nameservers 8.8.8.8
]]>只允许指定 ip 客户端连接的正确方法是怎么设
置呢?
http_port 3128 http_port 80 # not display IP address forwarded_for off # header request_header_access Referer deny all request_header_access X-Forwarded-For deny all request_header_access Via deny all request_header_access Cache-Control deny all acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https, snews acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais 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 Safe_ports port 1025-65535 # unregistered ports acl SSL_ports port 443 563 acl CONNECT method CONNECT #acl unicomip dst "/etc/squid3/unicomip" #http_access deny !unicomip http_access deny !Safe_ports http_access deny CONNECT !SSL_ports cache_peer 127.0.0.1 parent 8123 0 no-query no-digest round-robin weight=1 name=shadowsocks # 默认走 shadowsocks, 国内 ip 走国内 acl chinaip dst "/etc/squid3/chinaip" always_direct allow chinaip never_direct allow !chinaip
前两天试着搭建成功过,但是因为机器原因,配置文件丢失,今天按照同样的步骤重新配置之后每次启动都会提示
helperOpenServers: Starting 0/5 'basic_ncsa_auth' processes
helperOpenServers: No 'basic_ncsa_auth' processes needed.
用的是 http://www.cyberciti.biz/tips/linux-unix-squid-proxy-server-authentication.html 的步骤,和之前一样的
配置文件:
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 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 deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all
https_port 9000
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/users
auth_param basic children 5
auth_param basic credentialsttl 2 hours
acl Admin proxy_auth REQUIRED
http_access allow Admin
http_access deny all
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
/etc/squid/users 这个文件是存在的,经过测试有效,内含 Admin 用户密码信息
除了开头提到的一句提示以外无任何错误信息,折腾一天,换了不同机器,不同版本,百思不得其解,到底哪里错了?...
]]>