Squid is a caching and forwarding HTTP proxy. It has a wide variety of uses, including speeding up a web server by caching repeated requests, caching World Wide Web (WWW), Domain Name System (DNS), and other lookups for a group of people sharing network resources, and aiding security by filtering traffic. Although used for mainly HTTP and File Transfer Protocol (FTP), Squid includes limited support for several other protocols including Internet Gopher, Secure Sockets Layer (SSL),[7] Transport Layer Security (TLS), and Hypertext Transfer Protocol Secure (HTTPS). Squid does not support the SOCKS protocol, unlike Privoxy, with which Squid can be used in order to provide SOCKS support.
Squid was originally designed to run as a daemon on systems. A Windows port was maintained up to version 2.7. New versions available on Windows use the environment Squid is free software released under the GNU General Public License.
要在 Squid 中配置代理密码,可以按照以下步骤进行:
- 生成代理密码文件
使用以下命令生成代理密码文件:
sudo htpasswd -c /etc/squid/passwd username
其中,“username”是你想要设置的用户名。执行该命令后,会提示你输入密码并确认。
- 配置 Squid
打开 Squid 的配置文件:
sudo vi /etc/squid/squid.conf
找到以下行:
#auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
#auth_param basic children 5
#auth_param basic realm Squid Basic Authentication
#auth_param basic credentialsttl 2 hours
#auth_param basic casesensitive off
将它们修改为:
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
这样就启用了基本身份验证,并指定了密码文件的位置。
- 重启 Squid
使用以下命令重启 Squid:
sudo systemctl restart squid
- 验证配置
现在,当客户端连接到代理服务器时,会提示输入用户名和密码。只有输入正确的凭据才能使用代理服务。
以上就是在 Squid 中配置代理密码的完整流程。请记住,使用密码保护代理服务器时,确保用户名和密码的安全性,并避免使用弱密码。