这是我最近设置的东西,是一个相当大的痛苦。 我的环境变得鱿鱼不可见地对Windows 2008服务器的Windows 7客户端进行身份validation。 NTLM不是一个真正的select,因为使用它需要每个客户端的registry更改。
微软自Windows 2000以来一直推荐使用Kerberos,所以终于可以获得这个程序了。
许多非常感谢Squid邮件列表的Markus Moeller帮助完成这个工作。
这是设置与鱿鱼3.0,也已经过鱿鱼3.1testing,应该与鱿鱼2.7。 您的Windows用户必须是Active Directory中的SQUID_USERS组的成员(无论如何都是这种情况)。
在Windows方面,Windows XP和Windows 2007已经针对Windows 2008和针对Windows 2003的Windows XP进行了testing。
请注意,几乎每一步都需要一个步骤才能继续。
如果您遇到问题,DNS 始终是您的首选。 这两台Windows机器都应该能够通过名称ping Linux服务器(反之亦然),并且您可能需要有时运行ipconfig /flushdns 。 重新启动也可以帮助,如果你想要确定没有任何cru hanging声。
dom.local server.dom.local , 172.17.3.11 centos.dom.local , 172.17.3.10 dom.local反向区域。 172.17.3.10静态('A')logging,询问是否要设置反向PTR时select是 。 对于Windows 2008服务器,您需要安装修补程序951191 。
安装软件包
$ yum install -y cyrus-sasl-gssapi cvs autoconf automake openldap openldap-devel krb5-workstation krb5-devel gcc-c++
安装msktutil 。 在构build它之前,您需要修补它。
$ wget http://download.systemimager.org/~finley/msktutil/msktutil_0.3.16.orig.tar.gz $ wget http://download.systemimager.org/~finley/msktutil/msktutil_0.3.16-7.diff.gz $ gunzip msktutil_0.3.16-7.diff.gz $ tar zxf msktutil_0.3.16.orig.tar.gz $ cd msktutil-0.3.16 $ patch < ../msktutil_0.3.16-7.diff $ ./configure && make && make install
编译最新的squid _ curb _ ldap。
$ cvs -z3 -d:pserver:[email protected]:/cvsroot/squidkerbauth co -P squid_kerb_ldap $ cd squid_kerb_ldap $ ./configure && make
使用system-config-network将DNS指向域控制器,将主机名设置为centos.dom.local 。
重启
检查反向DNS正在工作:$ dig -x 172.17.3.10
你应该在答案部分获得centos.dom.local 。 如果你不是没有意义的话 。 没有正确configurationDNS,Kerberos身份validation将不起作用 。
你的krb.conf应该看起来像这样:
[logging] default = FILE:/var/log/krb5libs.log kdc = FILE:/var/log/krb5kdc.log admin_server = FILE:/var/log/kadmind.log [libdefaults] default_realm = DOM.LOCAL dns_lookup_realm = false dns_lookup_kdc = false ticket_lifetime = 24h # For Windows XP: default_tgs_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 default_tkt_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 permitted_enctypes = rc4-hmac des-cbc-crc des-cbc-md5 # For Windows 2007: # default_tgs_enctypes = aes256-cts-hmac-sha1-96 rc4-hmac des-cbc-crc des-cbc-md5 # default_tkt_enctypes = aes256-cts-hmac-sha1-96 rc4-hmac des-cbc-crc des-cbc-md5 # permitted_enctypes = aes256-cts-hmac-sha1-96 rc4-hmac des-cbc-crc des-cbc-md5 forwardable = yes [realms] DOM.LOCAL = { kdc = 172.17.3.11:88 admin_server = 172.17.3.11:7491 default_domain = dom.local } [domain_realm] .dom.local = DOM.LOCAL dom.local = DOM.LOCAL [appdefaults] pam = { debug = false ticket_lifetime = 36000 renew_lifetime = 36000 forwardable = true krb4_convert = false }
创build密钥表:
$ kinit administrator $ msktutil -c -b "CN=COMPUTERS" -s HTTP/centos.dom.local -h centos.dom.local -k /etc/HTTP.keytab --computer-name centos-http --upn HTTP/centos.dom.local --server server.dom.local --verbose
对于Windows 2008,您需要将--enctypes 28添加到msktutil命令。
安装鱿鱼:
$ wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE18.tar.gz $ tar zxvf squid-3.0.STABLE18.tar.gz $ cd squid-3.0.STABLE18 $ ./configure --enable-negotiate-auth-helpers=squid_kerb_auth --enable-stacktraces --prefix=/opt/squid-3.0 $ make $ make install $ cp helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth /opt/squid-3.0/sbin/ $ cp ~/squid_kerb_ldap/squid_kerb_ldap /opt/squid-3.0/sbin/ $ cd /opt/squid-3.0/ $ mv etc/squid.conf etc/squid.conf.ORIG
在squid.conf中设置适当的参数:
auth_param negotiate program /opt/squid-3.0/sbin/squid_kerb_auth -d -s HTTP/centos.dom.local auth_param negotiate children 10 auth_param negotiate keep_alive o external_acl_type SQUID_KERB_LDAP ttl=3600 negative_ttl=3600 %LOGIN /opt/squid-3.0/sbin/squid_kerb_ldap -d -g SQUID_USERS acl AUTHENTICATED proxy_auth REQUIRED acl LDAP_GROUP_CHECK external SQUID_KERB_LDAP acl localnet src 172.17.3.0/24 # RFC1918 possible internal network #http_access allow localnet #http_access allow AUTHENTICATED http_access allow LDAP_GROUP_CHECK cache_dir ufs /var/cache/squid-3.0 100 16 256 access_log /var/log/squid-3.0/access.log squid cache_log /var/log/squid-3.0/cache.log cache_store_log /var/log/squid-3.0/store.log pid_filename /var/run/squid-3.0.pid cache_effective_user squid cache_effective_group squid coredump_dir /var/cache/squid-3.0
设置用户和目录:
$ chown -R squid:squid /opt/squid-3.0/ $ mkdir /var/cache/squid-3.0 $ chown -R squid:squid /var/cache/ $ mkdir /var/log/squid-3.0 $ chown -R squid:squid /var/log/squid-3.0/ $ chown squid:squid /etc/HTTP.keytab
创buildcaching:
$ /opt/squid-3.0/sbin/squid -z
现在这很重要:Squid需要一些环境variables设置才能正常运行。 最好的方法是使用init脚本。 这是一个稍微编辑的CentOS:
#!/bin/bash # squid This shell script takes care of starting and stopping # Squid Internet Object Cache # # chkconfig: - 90 25 # description: Squid - Internet Object Cache. Internet object caching is \ # a way to store requested Internet objects (ie, data available \ # via the HTTP, FTP, and gopher protocols) on a system closer to the \ # requesting site than to the source. Web browsers can then use the \ # local Squid cache as a proxy HTTP server, reducing access time as \ # well as bandwidth consumption. # pidfile: /var/run/squid-3.0.pid # config: /opt/squid-3.0/etc/squid.conf PATH=/usr/bin:/sbin:/bin:/usr/sbin export PATH # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # don't raise an error if the config file is incomplete # set defaults instead: SQUID_OPTS=${SQUID_OPTS:-"-D"} SQUID_PIDFILE_TIMEOUT=${SQUID_PIDFILE_TIMEOUT:-20} SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100} KRB5_KTNAME=/etc/HTTP.keytab export KRB5_KTNAME # determine the name of the squid binary [ -f /opt/squid-3.0/sbin/squid ] && SQUID=/opt/squid-3.0/sbin/squid prog="$SQUID" # determine which one is the cache_swap directory CACHE_SWAP=`sed -e 's/#.*//g' /opt/squid-3.0/etc/squid.conf | \ grep cache_dir | awk '{ print $3 }'` [ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/spool/squid-3.0 RETVAL=0 start() { #check if the squid conf file is present if [ ! -f /opt/squid-3.0/etc/squid.conf ]; then echo "Configuration file /opt/squid-3.0/etc/squid.conf missing" 1>&2 exit 6 fi . /etc/sysconfig/squid # don't raise an error if the config file is incomplete. # set defaults instead: SQUID_OPTS=${SQUID_OPTS:-"-D"} SQUID_PIDFILE_TIMEOUT=${SQUID_PIDFILE_TIMEOUT:-20} SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100} if [ -z "$SQUID" ]; then echo "Insufficient privilege" 1>&2 exit 4 fi for adir in $CACHE_SWAP; do if [ ! -d $adir/00 ]; then echo -n "init_cache_dir $adir... " $SQUID -z -F -D >> /var/log/squid-3.0/squid.out 2>&1 fi done echo -n $"Starting $prog: " $SQUID $SQUID_OPTS >> /var/log/squid-3.0/squid.out 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ]; then timeout=0; while : ; do [ ! -f /var/run/squid-3.0.pid ] || break if [ $timeout -ge $SQUID_PIDFILE_TIMEOUT ]; then RETVAL=1 break fi sleep 1 && echo -n "." timeout=$((timeout+1)) done fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid-3.0 [ $RETVAL -eq 0 ] && echo_success [ $RETVAL -ne 0 ] && echo_failure echo return $RETVAL } stop() { . /etc/sysconfig/squid # don't raise an error if the config file is incomplete. # set defaults instead: SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100} echo -n $"Stopping $prog: " $SQUID -k check >> /var/log/squid-3.0/squid.out 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ] ; then $SQUID -k shutdown & rm -f /var/lock/subsys/squid-3.0 timeout=0 while : ; do [ -f /var/run/squid-3.0.pid ] || break if [ $timeout -ge $SQUID_SHUTDOWN_TIMEOUT ]; then echo return 1 fi sleep 2 && echo -n "." timeout=$((timeout+2)) done echo_success echo else echo_failure echo fi return $RETVAL } reload() { . /etc/sysconfig/squid # don't raise an error if the config file is incomplete. # set defaults instead: SQUID_OPTS=${SQUID_OPTS:-"-D"} $SQUID $SQUID_OPTS -k reconfigure } restart() { stop start } condrestart() { [ -e /var/lock/subsys/squid-3.0 ] && restart || : } rhstatus() { status $SQUID && $SQUID -k check } probe() { return 0 } case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; condrestart) condrestart ;; status) rhstatus ;; probe) exit 0 ;; *) echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" exit 2 esac exit $?
这些是重要的路线:
KRB5_KTNAME=/etc/HTTP.keytab export KRB5_KTNAME
使用端口3128将您的代理设置为服务器centos.dom.local 。 使用完全限定的域名而不是IP地址是非常重要的。
不要编辑/etc/init.d/squid来设置KRB5_KTNAME环境variables,而应该把行放在/ etc / sysconfig / squid中。 由于初始化脚本在每次执行时都会获取/ etc / sysconfig / squid,它将会获取这两行。
另外,您不需要明确将主机命名为KDC和kadmin服务器,只需inputActive Directory域的DNS域即可。 有两个原因:
在这个tuto之后,我可以让鱿鱼在Fedora 12服务器上工作。 检查您的Linux服务器上的防火墙(启用端口3128)并将SELinux设置为允许模式。