FreeBSD 上使用Kerberos 5认证

http://tech.ddvip.com   2006年04月01日    社区交流

本文详细介绍FreeBSD 上使用Kerberos 5认证

  下面添加测试机B的域名地址信息,就是允许测试机B能登陆测试机A。 特别注意Kerberos必须使用域名来访问机器。如果使用IP添加主机会出现一些意外的问题。

  test1# kadmin -l
kadmin> add --random-key host/test1.the9.com //说明添加的是主机不是用户
Max ticket life [1 day]:
Max renewable life [1 week]:
Principal expiration time [never]:
Password expiration time [never]:
Attributes []:
kadmin> ext host/test1.the9.com
kadmin> ext --keytab=/tmp/the9.keytab host/test1.the9.com

  这样完成以后就好了,基本配置已经结束了,可以使用。

  调试

  我们开始使用Kerberos的认证部署网络服务,注意Kerberos通过修改用户主目录下的.klogin和.k5login文件,将你允许登陆的用户Principal添加在文件里就好了。

  test1# cat .k5login
# $FreeBSD: src/etc/root/dot.k5login,v 1.1 2003/04/30 20:58:49 markm Exp $
#
# user1/root@YOUR.REALM.WHEREVER
# user2/root@YOUR.REALM.WHEREVER
cnhawk/test1.the9.com@THE9.COM

  这样就可以了

  使用Kerberos认证的telnet

  修改/etc/inetd.conf 添加

  telnet stream tcp nowait root /usr/libexec/telnetd telnetd -a user

  然后开启

  test2# inetd

  然后从test1登陆test2

  test1# kinit cnhawk/test1.the9.com //先取得票据
cnhawk/test1.the9.com@THE9.COM's Password:
test1# klist –f //看看是不是取得
Credentials cache: FILE:/tmp/krb5cc_0
Principal: cnhawk/test1.the9.com@THE9.COM
Issued Expires Flags Principal
Jun 11 16:21:36 Jun 12 02:21:36 I krbtgt/THE9.COM@THE9.COM
//可以了
test1# telnet -a -l the9 192.168.0.3 //开始登陆
Trying 192.168.0.3...
Connected to test2.the9.com.
Escape character is '^]'.
[ Trying mutual KERBEROS5 (host/test2.the9.com@THE9.COM)... ]
[ Kerberos V5 accepts you as `` cnhawk/test1.the9.com@THE9.COM'' ]
FreeBSD/i386 (test2.the9.com) (ttyp1)
//登陆欢迎词
%id
uid=1001(the9) gid=0(wheel) groups=0(wheel)
% //好了成功了

责编:豆豆技术应用

正在加载评论...