安裝服務器:yum install krb5-server krb5-libs krb5-auth-dialog數據庫
修改 /var/kerberos/krb5kdc/kdc.conf, 改 realm 爲本身的域centos
[kdcdefaults]緩存
kdc_ports = 88服務器
kdc_tcp_ports = 88dom
[realms]tcp
YLH.COM = {ui
#master_key_type = aes256-ctsthis
acl_file = /var/kerberos/krb5kdc/kadm5.acl.net
dict_file = /usr/share/dict/wordsorm
admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
max_renewable_life = 7d
supported_enctypes = aes256-cts:normal aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal camellia256-cts:normal camellia128-cts:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
}
修改/etc/krb5.conf
# Configuration snippets may be placed in this directory as well
includedir /etc/krb5.conf.d/
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
rdns = false
default_realm = YLH.COM
default_ccache_name = KEYRING:persistent:%{uid}
[realms]
YLH.COM = {
kdc = 192.168.1.173
admin_server = 192.168.1.173
}
[domain_realm]
.ylh.com = YLH.COM
ylh.com = YLH.COM
建立kerberos數據庫:/usr/sbin/kdb5_util create -s -r YLH.COM , 保存登錄密碼
添加數據庫admin: /usr/sbin/kadmin.local -q "addprinc admin/admin"
爲admin受權,將文件/var/kerberos/krb5kdc/kadm5.acl的內容編輯爲: */admin@YLH.COM
centos環境須要覆蓋Java jce文件$JAVA_HOME/jre/lib/security
啓動服務器:
service krb5kdc start
service kadmin start
設置開機開啓:
chkconfig krb5kdc on
chkconfig kadmin on
安裝客戶端:yum install krb5-workstation krb5-libs krb5-auth-dialog
配置這些主機上的/etc/krb5.conf,這個文件的內容與KDC中的文件保持一致便可。
登錄:
在服務器登錄:admin.local 。直接登錄
在客戶端登錄: kinit admin/admin 而後輸入kadmin命令 。 密碼登錄
建立princ: addprinc test/192.168.1.170@YLH.COM
注意:此處設置的principal信息是針對每臺機器設置的,name本身設置,後面的host就是訪問kdc的機器host切記
生成keytab: xst -k keyname.keytab test/192.168.1.170
經過keytab認證: kinit -kt keyname.keytab test/192.168.1.170
查看當前的認證用戶: klist
刪除認證緩存:kdestroy
安裝kerberos: https://my.oschina.net/u/185335/blog/2963061
kafka sever配置kerberos: https://my.oschina.net/u/185335/blog/2963062
kafka client使用kerberos: https://my.oschina.net/u/185335/blog/2963063