Squid:转发到另一个代理(带有父代理的身份验证详细信息) [英] Squid: forward to another proxy (with authentication details for the parent proxy)
问题描述
简而言之,我正在寻找一种简单的方法来执行以下操作(如果可能,请提供代码示例):
In short, I am looking for a simple way to do the following (please give code samples if possible):
- 在我的电脑上设置并启动一个代理服务器(比如地址是 10.10.200.200:6767),它可以捕获我手机上的所有网络请求
- 一旦来自电话的请求到达此代理,它将添加自定义身份验证详细信息(my_username/my_password)并将其转发给研究所代理(例如地址为 10.1.2.3:80)
- 我的本地代理 (10.10.200.200) 不需要任何缓存/加速.它只需要捕获请求并转发它.
现在,详细说明我的情况:
在我的研究所,需要通过代理进行身份验证,以便我们可以连接到互联网.当弹出窗口出现时,我通常输入我的 ldap 用户名/密码进行身份验证.
In my institute, authentication is needed to pass through a proxy so that we can connect to the internet. I normally enter my ldap username/password to authenticate when the pop up appears.
现在,我想将手机连接到学院 WiFi,但我的手机没有使用代理进行身份验证的选项.只能指定代理地址.因此,我计划在我的计算机上设置一个本地代理,以捕获来自我手机的所有请求,添加身份验证详细信息并通过我的计算机将其传递给我的研究所代理.
Now, I want to connect my phone to the institute WiFi but my phone does not have the option of authentication with proxy. Only a proxy address can be specified. So, I am planning to set up a local proxy on my computer to catch all requests from my phone, add authentication details and pass it to my institute proxy through my computer.
我安装了squid3(在Ubuntu上),但是查看配置文件,我迷路了.我试过谷歌搜索,但看起来太复杂了.
希望有人能提供帮助.
推荐答案
我从鱿鱼教程中发现最简单的配置是:
I figured from squid tutorials that the simplest configuration to do this is:
http_access allow all
http_port 3128
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
cache_peer 10.1.2.3 parent 80 0 no-query default login=my_username:my_password
never_direct allow all
这些行应该让你在本地机器上有一个工作代理服务器,它将所有请求转发到另一个代理服务器(相应地更改 IP 地址).但是,请注意,在上面的脚本中,我禁用了任何访问控制/过滤器,因此可能任何人都可以连接并使用您的代理.您需要添加额外的代码来限制只能访问某些设备.
These lines should get you a working proxy server on your local machine that forwards all requests to another proxy server (change ip addresses accordingly). However, please note that in the above script, I have disabled any access control/filters, so potentially, anybody can connect and use your proxy. You need to add additional code to restrict entry to only some devices.
这篇关于Squid:转发到另一个代理(带有父代理的身份验证详细信息)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!