FreeBSD 上使用Kerberos 5认证
http://tech.ddvip.com 2006年04月01日 社区交流
本文详细介绍FreeBSD 上使用Kerberos 5认证
测试已经完成了。可以使用Kerberos了。
ftp 服务
%kinit cnhawk/test1.the9.com
Cnhawk/test1.the9.com @THE9.COM's Password:
%klist -f
Credentials cache: FILE:/tmp/krb5cc_1001
Principal: cnhawk/test1.the9.com@THE9.COM
Issued Expires Flags Principal
Jun 11 18:49:56 Jun 12 04:49:56 I krbtgt/THE9.COM@THE9.COM
%/usr/local/bin/ftp -v hawk.the9.com
Connected to hawk.the9.com.
220 hawk.the9.com FTP server (Version 5.60) ready.
334 Using authentication type GSSAPI; ADAT must follow
GSSAPI accepted as authentication type
GSSAPI authentication succeeded
Name (hawk.the9.com:cnhawk):
232 GSSAPI user cnhawk@THE9.COM is authorized as cnhawk
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
好了FTP也可以接受登陆
总结
Kerberos使用中需要注意一些地方,例如,时间一定要保证同步,因为Kerberos靠时间戳来保持同步,时间允许的飘溢量非常小。所以必须保证时间的准确。cnhawk# kinit cnhawk/test1.the9.com@THE9.COM cnhawk/test1.the9.com@THE9.COM's Password: kinit: krb5_get_init_creds: time skew (314) larger than max (300) cnhawk# ntpdate time.the9.com 7 Jun 16:59:49 ntpdate[623]: step time server 61.129.93.5 offset 211.348035 sec cnhawk# kinit cnhawk/test1.the9.com @THE9.COM cnhawk/test1.the9.com@THE9.COM's Password: 而且很多时候在登陆前要查看票据是不是过期了。 hawk# klist Credentials cache: FILE:/tmp/krb5cc_0 Principal: cnhawk/test1.the9.com@THE9.COM
Issued Expires Principal
Jun 7 17:19:25 >>>Expired<<< krbtgt/THE9.COM@THE9.COM
Jun 7 17:20:23 >>>Expired<<< host/cnhawk.the9.com@THE9.COM
同时要注意认证时候不只是认证用户信息,还有主机信息,要保证这两个信息都在KDC中心数据库上存储。这样才能保证用户取得票据以后能顺利登陆服务器。
Kerberos系统认证过程示意图
责编:豆豆技术应用