设为首页 收藏本站
查看: 1538|回复: 0

[经验分享] Squid kerberos authtication

[复制链接]

尚未签到

发表于 2018-12-26 10:54:06 | 显示全部楼层 |阅读模式
【准备】

1. yum install cyrus-sasl-gssapi.i386 # 记得先装上这个

2. rpm -ivh msktutil-0.3.16.4-1.el5.rf.i386.rpm  #还有这个

3. 为防止configure出问题,都装上

krb5-auth-dialog.i386                    0.7-1                  installed      
krb5-devel.i386                          1.6.1-25.el5           installed      
krb5-libs.i386                           1.6.1-25.el5           installed      
krb5-server.i386                         1.6.1-25.el5           installed      
krb5-workstation.i386                    1.6.1-25.el5           installed      
pam_krb5.i386                            2.2.14-1               installed



【把Linux samba加入域并】

配置kbr5.conf smb.conf 加入域



【Kerberos 配置 】  这个国内有用资料实在太少

kinit administrator #检查一下

net ads keytab create -U administrator@800BEST.NET  #创建keytab 文件
net ads keytab add HTTP -U administrator@800BEST.NET #像keytab文件添加记录

klist -ke #看看keytab文件
kdb5_util create -s # 初始化库
kadmin.local -q "addprinc administrator/admin" #addprinc 并设置密码

启用kerberos验证

启动服务试试
/sbin/service krb5kdc start
/sbin/service kadmin start
/sbin/service krb524 start

配置成功后,应该直接可以用ldap或者AD账户登录域了 这下正好解决了single sign-on方案。



【编译安装】

4. ./configure --prefix=/Data/software/squid --enable-auth="basic,ntlm, negotiate" --enable-negotiate-auth-helpers="squid_kerb_auth"  #basci, ntlm, kerberos 都支持

5. make

6. make install







下面这段从squid网站上摘下来,看看似乎明白一点

#####


ntlm_auth requires access to the privileged winbind pipe in order to function properly. You enable this access by adding the security user Squid runs as to the winbindd_priv group.
   gpasswd -a proxy winbindd_priv


  • DSC0000.png Remove the cache_effective_group setting in squid.conf, if present. This setting causes squid to ignore the auxiliary winbindd_priv group membership.
    DSC0001.png the default user Squid is bundled as nobodythough some distribution packages are built with squidor proxyor other similar low-access user.


#############

因为这个,squid建议我们在做ntlm验证时候这样加如下configure 选项

--enable-auth="ntlm,basic"
--enable-external-acl-helpers="wbinfo_group"


不过我看2.7和以后版本没有必要。




我老老实实

groupadd winbindd_priv

gpasswd -a squid winbindd_priv # squid 是以squid用户来运行的




发现验证时候还是出错,还是土办法,立即OK了



chgrp squid /var/cache/samba/winbindd_privileged
chmod -R 750 /var/cache/samba/winbindd_privileged





squid.cong 基本都是默认配置

[squid@proxy ~]$ cat /Data/software/squid/etc/squid.conf
#Kerberos authentication
auth_param negotiate program /Data/software/squid/libexec/squid_kerb_auth -d -s HTTP/proxy.800best.net@800BEST.NET
auth_param negotiate children 15
auth_param negotiate keep_alive on
#ntlm_auth
#auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp
#auth_param ntlm children 20
#auth_param ntlm use_ntlm_negotiate on
#basic_auth
auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic
auth_param basic children 10
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours

cachemgr_passwd 800best all
acl all src all
acl auth proxy_auth REQUIRED

#DeniedURLs and IPs
acl DeniedURLs dstdomain -i .tianya.cn .qq.com
acl DeniedIPs dst "/Data/software/squid/etc/deniedIPs.list"

acl manager proto cache_object
acl webserver src 172.18.9.146/32
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access allow manager webserver
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny !auth
http_access allow auth
http_access deny DeniedURLs
http_access deny  DeniedIPs
http_access allow localnet
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128
hierarchy_stoplist cgi-bin ?
access_log /Data/software/squid/var/logs/access.log squid
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /Data/software/squid/var/cache



添加
KRB5_KTNAME=/etc/krb5.keytab
export KRB5_KTNAME
KRB5RCACHETYPE=none
export KRB5RCACHETYPE

export SQUID_HOME=/Data/software/squid


到squid用户的 .bash_profile



squid -z

squid -Nd4c # 好像没有什么错了



echo 'su - squid -c "squid -s"' > /etc/rc.local



看了一下日志,有如下错误,可能与squid自带的kerberos验证模块有关

2009/08/19 17:54:18| squid_kerb_auth: parseNegTokenInit failed with rc=101
2009/08/19 17:54:18| squid_kerb_auth: received type 1 NTLM token
2009/08/19 17:54:18| squid_kerb_auth: Got 'YR TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAFASgKAAAADw==' from squid (length: 5
9).


由于有其他更重要的项目,暂时通过

squid + basic,ntlm 验证 + sarg + wpad 来解决代理服务器方案,至于个别windows7或vista客户端,在squid.conf  添加IP acl 策略作为临时解决方案。






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-656006-1-1.html 上篇帖子: squid for windows 2.6版 下篇帖子: linux+squid+iptable
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表