RHS333-5 Kerberized NFSv4
?Kerberized NFSv4 with NIS
一、環(huán)境
kdc:server1.example.com??192.168.32.31
nfs&nis server: station2.example.com??192.168.32.32
nfs&nis client: station3.example.com??192.168.32.33
注:默認(rèn)kerberos和nis環(huán)境已有配置
二、NFSv4 Server配置
1、?固定相關(guān)端口,并開啟安全功能
[root@station2 ~]# vi /etc/sysconfig/nfs
LOCKD_TCPPORT=4001
LOCKD_UDPPORT=4001
MOUNTD_PORT=4002
STATD_PORT=4003
SECURE_NFS="yes"??
?#啟動nfs4必須開啟此選項(xiàng),默認(rèn)nfs4只支持tcp
2、?綁定mount需要共享的文件夾(即偽裝共享的真實(shí)目錄)
[root@station2 ~]#mkdir –p /export/nfs
[root@station2 ~]#mount --bind /home/nfs /export/nfs
[root@station2 ~]#vi /etc/fstab
/home/nfs????/exports/nfs???????????????none????bind????????????0 0
#共享的真實(shí)目錄是/home/nfs但客戶看到的將是/exports/nfs目錄
3、?設(shè)置NFSv4共享
[root@station2 ~]#vi /etc/exports
/exports????gss/krb5p(rw,fsid=0,crossmnt)
/exports/nfs gss/krb5p(rw)
#使用fsid=0選項(xiàng)的時(shí)候只能共享一個(gè)目錄,這個(gè)目錄將成為NFS服務(wù)器的根目錄。要通過NFS4共享一個(gè)目錄,首先需要在/etc/exports文件中定義這個(gè)目錄,并且使用?fsid=0?的參數(shù)。
#注kerberos認(rèn)證支持三種模式:
gss/sys:只要有kerberos票據(jù)解決使用nfs共享目錄,nfsv3也支持此項(xiàng)
gss/krb5i:kerberos會檢查數(shù)據(jù)的完整性
gss/krb5p:kerberos會讀nfs共享數(shù)據(jù)進(jìn)行加密
4、?在kdc中添加nfs服務(wù)器服務(wù),并導(dǎo)出票據(jù)
[root@station2 ~]# kadmin
kadmin:??addprinc -e des-cbc-md5:normal -randkey nfs/station2.example.com
kadmin:??ktadd -e des-cbc-md5:normal -k /etc/krb5.keytab nfs/station2.example.com
[root@station2 ~]# ktutil?????????#查看票據(jù)
ktutil:??rkt /etc/krb5.keytab
ktutil:??list
slot KVNO Principal
---- ---- -------------------------------------------------------------
???1????4????host/station2.example.com@EXAMPLE.COM
???2????4????host/station2.example.com@EXAMPLE.COM
???3????4????host/station2.example.com@EXAMPLE.COM
???4????4????host/station2.example.com@EXAMPLE.COM
???5????4?????nfs/station2.example.com@EXAMPLE.COM
5、?啟動服務(wù)器端相關(guān)服務(wù)(nfs、rpcsvcgssd、rpcidmapd)
[root@station2 ~]# service nfs start
啟動?RPC svcgssd:?????????????????????????????????????????[確定]
啟動?NFS?服務(wù):????????????????????????????????????????????[確定]
關(guān)掉?NFS?配額:????????????????????????????????????????????[確定]
啟動?NFS?守護(hù)進(jìn)程:????????????????????????????????????????[確定]
啟動?NFS mountd:??????????????????????????????????????????[確定]
????????#開啟nfsv4后,啟動nfs服務(wù)是會自動啟動rpcsvcgssd服務(wù)
????????[root@station2 ~]# service rpcidmapd start
三、NFSv4 Client配置
1、?開啟安全功能
[root@station3 ~]# vi /etc/sysconfig/nfs
SECURE_NFS="yes"??????
#要故障nfs4目錄客戶端也必須開啟此選項(xiàng)
2、?在kdc中添加nfs客戶端服務(wù),并導(dǎo)出票據(jù)
[root@station3 ~]# kadmin
kadmin:??addprinc -e des-cbc-md5:normal -randkey nfs/station3.example.com
kadmin:??ktadd -e des-cbc-md5:normal -k /etc/krb5.keytab nfs/station3.example.com
[root@station3 ~]# ktutil??
ktutil:??rkt /etc/krb5.keytab
ktutil:??list
slot KVNO Principal
---- ---- -------------------------------------------------------------
???1????5????host/station3.example.com@EXAMPLE.COM
???2????5????host/station3.example.com@EXAMPLE.COM
???3????5????host/station3.example.com@EXAMPLE.COM
???4????5????host/station3.example.com@EXAMPLE.COM
???5????3?????nfs/station3.example.com@EXAMPLE.COM
3、?啟動客戶端相關(guān)服務(wù)(rpcgssd、rpcidmapd)
[root@station3 ~]#sevice rpcgssd start
[root@station3 ~]#service rpcidmapd start
4、?掛載服務(wù)器共享目錄
????[root@station3 ~]#mkdir /home/nfs
[root@station3 ~]#mount -t nfs4 -o rw,sec=krb5p 192.168.32.32:/nfs /home/nfs
#掛載時(shí)必須用-t nfs4?:掛載nfs4的共享目錄
#-o sec=krb5p:利用kerberos加密認(rèn)證,與服務(wù)器向?qū)?yīng)
???[root@station3 ~]#vi /etc/fstab?
???192.168.32.32:/home/nfs??/home/nfs????nfs4????defaults,sec=krb5p 0 0
???#開機(jī)自動掛載
5、?測試
[root@station3 ~]# su - netsword
[netsword@station3 ~]$ su - guest2001
口令:
-bash-3.2$ pwd
/home/nfs/guest2001
#只有獲擁有kdc認(rèn)證票據(jù)的guest2001等用戶才能登錄并使用nfs4共享的目錄
?
本文轉(zhuǎn)自netsword 51CTO博客,原文鏈接:http://blog.51cto.com/netsword/523306
總結(jié)
以上是生活随笔為你收集整理的RHS333-5 Kerberized NFSv4的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: AIR程序打包
- 下一篇: wxWidgets第九课 wx绘图工具