Squid Web Cache Wiki

Squid Web Cache 文档

🔗 使用 LDAP 对 Squid 服务器进行身份验证

作者:Askar Ali Khan

🔗 目录

在本示例中,Squid 安装将使用 LDAP 在用户浏览网页之前对其进行身份验证。出于安全原因,用户在被允许访问互联网之前需要输入他们的用户名和密码。

🔗 用法

在本示例中,我们假设 OpenLDAP 已配置为不允许匿名搜索,必须先绑定才能进行任何搜索。我们将使用 squid_ldap_auth(Squid LDAP 身份验证助手),它允许 Squid 连接到 LDAP 目录来验证 Basic HTTP 身份验证的用户名和密码。

🔗 Squid 配置文件

首先编辑 squid.conf,以便可以针对 LDAP 进行身份验证

# the following is one long line, do not wrap
auth_param basic program /usr/lib/squid/squid_ldap_auth -v 3 -b "dc=yourcompany,dc=com" -D uid=some-user,ou=People,dc=yourcompany,dc=com  -w password -f uid=%s ldap.yourcompany.com

auth_param basic children 5
auth_param basic realm Web-Proxy
auth_param basic credentialsttl 1 minute

acl ldap-auth proxy_auth REQUIRED

http_access allow ldap-auth
http_access allow localhost
http_access deny all

:information_source: 如果您想使用匿名 LDAP 绑定方法,只需不指定绑定 DN(-D 选项及其相关的 -w 选项)

🔗 SSL/TLS 调整

如果您正在寻找一种通过 SSL/TLS 安全通道在 LDAP 服务器上验证 Squid 用户的方法,请将 -ZZ 参数传递给 squid_ldap_auth 程序。有关更多信息,请参阅 squid_ldap_auth 手册。

:information_source: 在使用安全通道身份验证之前,您应该已经生成了 SSL 证书并将其放在 Squid 服务器上的 /etc/openldap/cacerts 目录中。请记住,这仅保护 Squid<->LDAP 服务器之间的流量,而不保护浏览器<->Squid 之间的流量。对于 SSL/TLS,您的 squid_ldap_auth 行将如下所示……

# the following is one long line, do not wrap
auth_param basic program /usr/lib/squid/squid_ldap_auth -v 3 -ZZ -b "dc=yourcompany,dc=com" -D uid=some-user,ou=People,dc=yourcompany,dc=com  -w password -f uid=%s ldap.yourcompany.com

🔗 Windows 2003 Active Directory 调整

Windows 2003 AD 也支持 LDAP 身份验证。需要对搜索过滤器进行一些调整,以映射到 Microsoft 的命名方式……

# the following is one long line, do not wrap
auth_param basic program /usr/lib/squid/squid_ldap_auth -v 3 -b ou="something",ou=something,dc=svbmt,dc=net -D cn=LDAPUSER,ou="Generic User Accounts",ou=something",dc=svbmt,dc=net -w password -f sAMAccountName=%s -h ldap.yourcompany.com

⚠️ Disclaimer: Any example presented here is provided "as-is" with no support
or guarantee of suitability. If you have any further questions about
these examples please email the squid-users mailing list.

类别: ConfigExample

导航:站点搜索站点页面分类🔼 向上