安装
yum install squid -y yum install httpd-tools -y
基本认证配置文件
#网络 http_port 8991 dns_nameservers 100.100.2.136 #认证 auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/auto/passwd auth_param basic realm proxy #acl acl authenticated proxy_auth REQUIRED #应用acl http_access allow authenticated http_access deny all
测试认证
#创建用户 htpasswd -c /etc/squid/auto/passwd user #测试用户 /usr/lib64/squid/basic_ncsa_auth /etc/squid/auth/passwd user 123 OK #返回OK说明正常
ldap配置文件
#网络 http_port 8991 dns_nameservers 100.100.2.136 #认证 auth_param basic program /usr/lib64/squid/basic_ldap_auth -v 3 -b "dc=qq,dc=com" -D "uid=user,cn=users,dc=qq,dc=com" -w "passwd" -f uid=%s -h 115.123.183.123 auth_param basic children 5 auth_param basic realm example Software Corporation auth_param basic credentialsttl 15 #acl acl ldapauth proxy_auth REQUIRED #应用acl http_access allow ldapauth http_access deny all
测试认证(注意你ldap服务器类型参数会有不同)
/usr/lib64/squid/basic_ldap_auth -v 3 -b "dc=qq,dc=com" -D "uid=user,cn=users,dc=qq,dc=com" -w "passwd" -f uid=%s -h 115.123.183.123 OK