🔗 在 CentOS 5 上使用 Winbind 身份验证配置 Squid 进行 NTLM
*作者:Joseph L. Casale *
本配置示例说明了一种在 CentOS 5(或任何 RHEL 5 衍生版本)上设置 Squid 的简化方法,使用内置配置工具,同时仅启用 Winbind 进行身份验证所需的服务。
🔗 先决条件
🔗 网络时间协议 (NTP)
为了使 Kerberos 正常工作,您的 Active Directory PDC 模拟器和此服务器之间必须保持正确的时间同步。
检查 ntp 客户端是否已安装
# rpm -qa ntp
如果此查询没有任何返回,请安装它
# yum install ntp
现在编辑 ** /etc/ntp.conf ** 并注释掉任何以 ** server ** 开头的行,并仅创建一个指向您的 Active Directory PDC 模拟器的行。
设置守护进程在启动时自动启动并启动它
# vi /etc/ntp.conf
server pdce.example.local
# chkconfig ntpd on
# service ntpd start
🔗 Samba 和 Winbind
Samba 配置文件 ** /etc/samba/smb.conf ** 和 Squid 身份验证助手 ** /usr/bin/ntlm_auth ** 由 samba-common 包提供。
检查软件是否已安装
# rpm -qa |egrep -i '(krb5-workstation|samba-common|authconfig)'
authconfig-5.3.21-5.el5
krb5-workstation-1.6.1-25.el5_2.1
samba-common-3.0.28-1.el5_2.1
如果没有,请使用 yum 安装
# yum install authconfig krb5-workstation samba-common
🔗 配置 Kerberos
为了启用助手进行 Active Directory 组和用户枚举,我们将 CentOS 服务器加入 Active Directory。您可以使用 authconfig 一步配置 Samba、Winbind 并执行加入操作。
- 将 ads.example.local 替换为您的 Active Directory 服务器的完全限定域名 (FQDN)。
- 将 EXAMPLE 替换为您的域的 NetBIOS 名称。
-
将 EXAMPLE.LOCAL 替换为您的域的完整名称。
# authconfig –enableshadow –enablemd5 –passalgo=md5 –krb5kdc=ads.example.local
–krb5realm=EXAMPLE.LOCAL –smbservers=ads.example.local –smbworkgroup=EXAMPLE
–enablewinbind –enablewinbindauth –smbsecurity=ads –smbrealm=EXAMPLE.LOCAL
–smbidmapuid=”16777216-33554431” –smbidmapgid=”16777216-33554431” –winbindseparator=”+”
–winbindtemplateshell=”/bin/false” –enablewinbindusedefaultdomain –disablewinbindoffline
–winbindjoin=Administrator –disablewins –disablecache –enablelocauthorize –updateall [/usr/bin/net join -w EXAMPLE -S ads.example.local -U Administrator] Administrator’s password: Using short domain name – EXAMPLE Joined ‘SERVER’ to realm ‘EXAMPLE.LOCAL’Shutting down Winbind services: [FAILED] Starting Winbind services: [ OK ]
如果 Winbind 在此之前没有运行,它就无法关闭,但 authconfig 会启动它并使其能够在启动时启动。
RHEL/CentOS 5.4 中 **/var/cache/samba/winbindd_privileged** 的默认权限为 750 root:squid(默认情况下工作正常),但在 5.5 中变为 750 root:wbpriv,这不允许 Squid 运行的用户访问套接字。请确保 squid.conf 没有定义 **cache_effective_group**,并将 wbpriv 添加为 Squid 运行用户的一个辅助组。
# usermod -a -G wbpriv squid
您可以通过查看 wbinfo 的输出来测试 Active Directory 组和用户枚举
# wbinfo -{u|g}
如果您能够枚举您的 Active Directory 组和用户,那么一切正常。
🔗 配置 Squid
我创建了一个 Active Directory 组来控制谁可以访问代理。有关选项,请参阅 **ntlm_auth** 的 man 手册页 ntlm_auth。
编辑您的 ** /etc/squid/squid.conf ** 以启用助手并相应地调整 **our_networks**
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp --require-membership-of=EXAMPLE+ADGROUP
auth_param ntlm children 5
auth_param ntlm keep_alive on
acl our_networks 192.168.0.0/24 192.168.1.0/24
acl ntlm proxy_auth REQUIRED
http_access allow our_networks ntlm
- 这不是 Squid 正常运行的完整参数集,但对于身份验证部分是必需的。
🔗 注释
- 当前版本的 Firefox 支持 NTLM 身份验证,因此您无需启用 basic。
- 您无需安装完整的 Samba 包,也无需运行 smbd 和 nmbd 即可进行身份验证。
⚠️ 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
导航:站点搜索,站点页面,分类,🔼 向上