Kerberos+LDAP+NFSv4實(shí)現(xiàn)單點(diǎn)登錄(中)-創(chuàng)新互聯(lián)

Kerberos+LDAP+NFSv4 實(shí)現(xiàn)單點(diǎn)登錄(中)

創(chuàng)新互聯(lián)建站擁有網(wǎng)站維護(hù)技術(shù)和項(xiàng)目管理團(tuán)隊(duì),建立的售前、實(shí)施和售后服務(wù)體系,為客戶提供定制化的網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站、網(wǎng)站維護(hù)、鄭州服務(wù)器托管解決方案。為客戶網(wǎng)站安全和日常運(yùn)維提供整體管家式外包優(yōu)質(zhì)服務(wù)。我們的網(wǎng)站維護(hù)服務(wù)覆蓋集團(tuán)企業(yè)、上市公司、外企網(wǎng)站、商城網(wǎng)站開發(fā)、政府網(wǎng)站等各類型客戶群體,為全球1000+企業(yè)提供全方位網(wǎng)站維護(hù)、服務(wù)器維護(hù)解決方案。

五.nfs服務(wù)器的安裝
1.安裝nfs-kernel-server
root@debian:~# apt-get install nfs-kernel-server nfs-common

修改/etc/default/nfs-kernel-server文件

NEED_SVCGSSD=""
改為
NEED_SVCGSSD="yes"

重啟nfs-kernel-server

root@debian:~# /etc/init.d/nfs-kernel-server stop
root@debian:~# /etc/init.d/nfs-kernel-server start
root@debian:~# ps -e |grep gss
10275 ?        00:00:00 rpc.svcgssd

2.安裝libnss-ldapd、nslcd
為了獲取ldap用戶信息,要安裝libnss-ldapd、nslcd
在新立得選上libnss-ldapd、nslcd會(huì)自動(dòng)將libpam-ldapd、nscd、nslcd-utils三個(gè)包打上安裝標(biāo)記,可手工將該三個(gè)包去掉安裝標(biāo)記,不需此三個(gè)包

root@debian:~# apt-get install libnss-ldapd nslcd

注意安裝nslcd配置過程中,提示輸入LDAP服務(wù)器地址的輸入框默認(rèn)了uri ldapi:/// ,一定要將 ldapi 改為 ldap ,因?yàn)閘dapi:///表示用在unix域

1)nslcd
安裝過程中
ldap server uri 填 ldap://192.168.1.101/
ldap服務(wù)器搜索起點(diǎn) 填 dc=ctp,dc=net

查看配置文件

root@debian:~# cat /etc/nslcd.conf
#The user and group nslcd should run as.
uid nslcd
gid nslcd

#The location at which the LDAP server(s) should be reachable.
#填LDAP服務(wù)器地址,即kdc服務(wù)器地址
uri ldap://192.168.1.101/

#The search base that will be used for all queries.
base dc=ctp,dc=net

root@debian:~#

2)libnss-ldapd
安裝過程中
name services to configure 選 [*] passwd

新建測試目錄
root@debian:~# mkdir /home/linlin/share

將該目錄屬性改為用戶ID及用戶組ID都為4001,即為ldap用戶krblinlin的uidNumber/gidNumber,但并在nfs客/服兩主機(jī)本地不存在該ID用戶
root@debian:~# chown 4001:4001 /home/linlin/share

2.1)假定沒選[*] passwd

linlin@debian:~$ ls -ld /home/linlin/share
drwxr-xr-x 2 4001 4001 4096 9月  18 21:13 /home/linlin/share

則取不到ldap用戶信息

2.2)可重設(shè)libnss-ldapd,選上[*] passwd
root@debian:~# dpkg-reconfigure libnss-ldapd

...
┌───────────┤  正在設(shè)定 libnss-ldapd  ├──────────────────────────┐  
│  For this package to work, you need to modify the /etc/nsswitch.conf file to use the ldap datasource. │  
│  You can select the services that should have LDAP lookups enabled. The new LDAP lookups will be added│
│as the last datasource. Be sure to review these changes.                                               │  
│  Name services to configure:                                                                          │  
│    [ ] hosts                                                                                          │  
│    [ ] netgroup                                                                                       │  
│    [ ] networks                                                                                       │  
│    [*] passwd                                                                                         │  
│    [ ] protocols                                          
...

/etc/nsswitch.conf: enable LDAP lookups for passwd
root@debian:~#

查看配置文件,可見passwd一行后添加了ldap

root@debian:~# cat /etc/nsswitch.conf
passwd:         compat ldap
group:          compat
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
root@debian:~#
linlin@debian:~$ ls -ld /home/linlin/share
drwxr-xr-x 2 krblinlin 4001 4096 9月  18 21:13 /home/linlin/share

則已獲取顯示ldap用戶信息,krblinlin為ldap用戶,同時(shí)也是Kerberos用戶
獲取用戶信息很重要,因?yàn)閚fs客/服兩端的認(rèn)證用戶信息要匹配,即兩邊的域+用戶名要一致

注:本實(shí)驗(yàn)只獲取ldap用戶的用戶名,無法獲取ldap用戶的所屬用戶組名(如上仍顯示用戶組ID 4001),但不影響實(shí)驗(yàn)效果

3.網(wǎng)絡(luò)共享
本實(shí)驗(yàn)?zāi)康腘FSv4認(rèn)證采用安全性強(qiáng)的gss/krb5認(rèn)證(Kerberos),而不是弱的系統(tǒng)認(rèn)證(AUTH_SYS)

編輯/etc/exports文件

root@debian:~# cat /etc/exports
/home/linlin/share  gss/krb5(rw,sync,no_subtree_check)
root@debian:~#

執(zhí)行導(dǎo)出
root@debian:~# exportfs -r

查看導(dǎo)出

root@debian:~# exportfs -v
/home/linlin/share
        gss/krb5(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,root_squash,no_all_squash)
root@debian:~#

4.問題解決
nfs服務(wù)器沒有啟動(dòng)rpc.idmapd,導(dǎo)致nfs客戶機(jī)沒寫權(quán)限
1)

root@debian:~# rpc.idmapd
rpc.idmapd: libnfsidmap: using (default) domain: ctp.net
rpc.idmapd: libnfsidmap: Realms list: 'CTP.NET'
rpc.idmapd: libnfsidmap: loaded plugin /lib/x86_64-linux-gnu/libnfsidmap/nsswitch.so for method nsswitch

root@debian:~# ps -e|grep rpc
  634 ?        00:00:00 rpciod
  757 ?        00:00:00 rpcbind
 1188 ?        00:00:00 rpc.svcgssd
 1261 ?        00:00:00 rpc.mountd
root@debian:~#

手工運(yùn)行rpc.idmapd仍沒啟動(dòng)rpc.idmapd

2)
原來nfs服務(wù)器的nfs-common要重啟

root@debian:~# /etc/init.d/nfs-common stop
root@debian:~# /etc/init.d/nfs-common start

root@debian:~# ps -e|grep rpc
  634 ?        00:00:00 rpciod
  757 ?        00:00:00 rpcbind
14256 ?        00:00:00 rpc.svcgssd
14258 ?        00:00:00 rpc.mountd
15023 ?        00:00:00 rpc.statd
15041 ?        00:00:00 rpc.idmapd
root@debian:~#

nfs客戶機(jī)已可寫權(quán)限了

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)站名稱:Kerberos+LDAP+NFSv4實(shí)現(xiàn)單點(diǎn)登錄(中)-創(chuàng)新互聯(lián)
轉(zhuǎn)載來于:http://www.muchs.cn/article42/dpgiec.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站建站公司、動(dòng)態(tài)網(wǎng)站、域名注冊小程序開發(fā)、網(wǎng)頁設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)