1、安装最新版的KDC server
yum install krb5-server krb5-libs krb5-workstation
注:KDC (Key Distribution Center)密匙分配中心, 其在kerberos中通常提供两种服务: 1.Authentication Service (AS):认证服务 2.Ticket-Granting Service (TGS):授予票据服务
2、编辑配置文件
vi /etc/krb5.conf
[libdefaults]
renew_lifetime = 7d
forwardable = true
default_realm = DATAPLAT.COM.CN
ticket_lifetime = 24h
dns_lookup_realm = false
dns_lookup_kdc = false
default_ccache_name = /tmp/krb5cc_%{uid}
#default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
#default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
[logging]
default = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
kdc = FILE:/var/log/krb5kdc.log
[realms]
BIGDATA.ORG.CN = {
admin_server = 10.123.12.7
kdc = 10.123.12.7
}
[domain_realm]
.bigdata.org.cn = DATAPLAT.COM.CN
bigdata.org.cn = DATAPLAT.COM.CN
注:修改[realms]与添加[domain_realm] ,[libdefaults]对应的default_realm的值
3、使用 kdb5_util 创建Kerberos数据库(*注:会提醒你输入密码,要记好密码)
kdb5_util create -s
Enter KDC database master key:xxxxxx
4、启动KDC服务
/etc/rc.d/init.d/krb5kdc start
/etc/rc.d/init.d/kadmin start
5、设置KDC服务开机启动
chkconfig krb5kdc on
chkconfig kadmin on
6、创建Kerberos管理员(根据提示输入密码)
kadmin.local -q "addprinc root/root"
Enter password for principal "root/root@DATAPLAT.COM.CN":xxxxxxxxxx
7、查看KDC ACL权限文件并确保kadm5.acl文件中,有你刚才定义的[realm]信息,无则补上
vi /var/kerberos/krb5kdc/kadm5.acl
*/root@EXAMPLE.COM *
*/root@DATAPLAT.COM.CN *
注:其中 /root@DATAPLAT.COM.CN 即为需要添加的信息
8、重启kadmin进程
/etc/rc.d/init.d/kadmin restart