Nfsv4 configuration

From Linux NFS

(Difference between revisions)
Jump to: navigation, search
m
m (A Real Life Example)
 
(17 intermediate revisions not shown)
Line 1: Line 1:
-
[http://kinunia.cn/fiera-herida.htm fiera herida] [http://amohseni.info/img/styles/network-security/ network security] [http://nobinters.org/una-coppia.htm una coppia sposata] [http://helmed.info/topic/hp-f/ hp f2105] [http://davte.info/library/html/bambola-chorleau.htm bambola chorleau nuda] [http://psisemiya.com/images/small/www-nido/ www nido hotel com] [http://nobinters.org/pistas-reggaeton.htm pistas reggaeton] [http://bloprofeldi.info/lib/luciano-ferro.htm luciano ferro perdona] [http://davte.info/library/html/la-storia.htm la storia bandita] [http://amohseni.info/img/styles/bo-tylko/ bo tylko ty] [http://nobinters.org/casalinghe-calendario.htm casalinghe calendario] [http://ashythro.info/library/html/giochi-yeti/ giochi yeti] [http://kinunia.cn/gondiya.htm gondiya] [http://bloprofeldi.info/lib/dikom-secure.htm dikom secure digital] [http://saibso.org/giustizia-senza.htm giustizia senza processo] [http://nobinters.org/microsoft-starck.htm microsoft starck mouse] [http://nobinters.org/san-sebastian.htm san sebastian cose fare] [http://nobinters.org/blow-job.htm blow job teen] [http://saibso.org/fs-orario.htm fs orario] [http://bloprofeldi.info/lib/t-compatibili.htm t0441 compatibili] [http://nobinters.org/canon-obiettivi.htm canon obiettivi reflex zoom] [http://nobinters.org/ice-cream.htm ice cream mania] [http://nobinters.org/goo-goo.htm goo goo doo] [http://helmed.info/topic/kingston-sdram/ kingston sdram 512 pc133 dimm] [http://chaba.info/un-altro/ un altro zelda per gamecube] [http://ustall.org/web/mercedes-e.htm mercedes e 320 sw] [http://ustall.org/web/cuando-volvera.htm cuando volvera aventura] [http://davte.info/library/html/canon-ef.htm canon ef 90-300 usm] [http://ustall.org/web/le-mie.htm le mie origini] [http://davte.info/library/html/wind.htm wind] [http://ustall.org/web/dave-candy.htm dave candy] [http://bloprofeldi.info/lib/foto-di.htm foto di ragazze nude] [http://davte.info/library/html/fabrizio-deandre.htm fabrizio deandre] [http://nobinters.org/proposta-tomba.htm proposta tomba] [http://saibso.org/wintv.htm wintv 350] [http://kinunia.cn/tavolo-vetro.htm tavolo vetro] [http://saibso.org/notebook-toshiba.htm notebook toshiba sa60] [http://davte.info/library/html/federgolf.htm federgolf] [http://saibso.org/roberto-ghidoni.htm roberto ghidoni] [http://chaba.info/lettore-memorie/ lettore memorie int] [http://helmed.info/topic/base-audio/ base audio la nostra vita eros ramazzotti] [http://chaba.info/cd-key/ cd key office 2000] [http://bloprofeldi.info/lib/natashakiss.htm natashakiss] [http://amohseni.info/img/styles/sigla-tg/ sigla tg uno] [http://davte.info/library/html/pouf-letto.htm pouf letto] [http://davte.info/library/html/guerlain-terracotta.htm guerlain terracotta pour homme] [http://chaba.info/finanziamento-regionali/ finanziamento regionali] [http://nobinters.org/kula-quest.htm kula quest] [http://davte.info/library/html/cristalreport.htm cristalreport] [http://helmed.info/topic/garmin-street/ garmin street pilot c 330] [http://psisemiya.com/images/small/vaffanculo-mp/ vaffanculo mp3 elio] [http://nobinters.org/clonoa.htm clonoa] [http://davte.info/library/html/scoobydoo-ps.htm scooby-doo ps2 videogiochi] [http://bloprofeldi.info/lib/hp.htm hp 23] [http://ashythro.info/library/html/ricciardi/ ricciardi] [http://helmed.info/topic/lest-outside/ lest outside alone] [http://psisemiya.com/images/small/www-fastfurios/ www 2fast2furios it] [http://saibso.org/autocad-libri.htm autocad libri] [http://bloprofeldi.info/lib/teseo-contro.htm teseo contro il minotauro] [http://saibso.org/cam-seggiolino.htm cam seggiolino auto] [http://saibso.org/lettura-mms.htm lettura mms ricevuto] [http://amohseni.info/img/styles/caratteristiche-cani/ caratteristiche cani] [http://ustall.org/web/marie-claire.htm marie claire d ubaldo] [http://chaba.info/neovo-/ neovo 19 f-419] [http://ashythro.info/library/html/ozcan/ ozcan] [http://saibso.org/viaggi-pullman.htm viaggi pullman roma mantova] [http://psisemiya.com/images/small/inglese-corso/ inglese corso intensivo] [http://bloprofeldi.info/lib/intel.htm intel 915] [http://nobinters.org/hamburger-time.htm hamburger time] [http://helmed.info/topic/asti-cinzano/ asti cinzano] [http://nobinters.org/diademi.htm diademi] [http://ashythro.info/library/html/lettori-mp/ lettori mp3 creative] [http://helmed.info/topic/www-ss/ www ss juvestabia it] [http://nobinters.org/lowell.htm lowell] [http://nobinters.org/la-voglia.htm la voglia] [http://saibso.org/televisione-schermo.htm televisione schermo piatto 28] [http://psisemiya.com/images/small/diabolus/ diabolus 66] [http://psisemiya.com/images/small/lettori-dvd/ lettori dvd divx xvid] [http://ustall.org/web/tchat-gay.htm tchat gay] [http://amohseni.info/img/styles/ati-radeon/ ati radeon 9550 256mb agp] [http://chaba.info/gucci-parfum/ gucci parfum] [http://davte.info/library/html/luli-bossa.htm luli bossa] [http://chaba.info/residence-rimini/ residence rimini] [http://saibso.org/foto-mogli.htm foto mogli] [http://nobinters.org/camargo.htm camargo 1994] [http://amohseni.info/img/styles/dalmatinac/ dalmatinac] [http://amohseni.info/img/styles/sopravvivenza-antichi/ sopravvivenza antichi] [http://saibso.org/ma-ia.htm ma ia hii] [http://psisemiya.com/images/small/video-hard/ video hard] [http://saibso.org/joule-james.htm joule, james prescott] [http://saibso.org/rottura-del.htm rottura del culo] [http://helmed.info/topic/transcend-photobank/ transcend photobank] [http://ustall.org/web/koshi.htm koshi] [http://davte.info/library/html/gerusalemme-liberata.htm gerusalemme liberata parafrasi canto iii] [http://davte.info/library/html/the-rock.htm the rock show] [http://saibso.org/benzin.htm benzin] [http://saibso.org/www-mare.htm www mare] [http://amohseni.info/img/styles/termozeta-tostapane/ termozeta tostapane] [http://chaba.info/bbc-news/ bbc news] [http://ustall.org/web/geom-marco.htm geom marco costantini] [http://nobinters.org/ragazzo-ravenna.htm ragazzo ravenna] [http://kinunia.cn/but-for.htm but for now] [http://bloprofeldi.info/lib/metalo-slug.htm metalo slug] [http://saibso.org/gena-nolin.htm gena nolin] [http://nobinters.org/thierry-cham.htm thierry cham] [http://bloprofeldi.info/lib/clip-hunter.htm clip hunter] [http://ustall.org/web/taglie-forti.htm taglie forti reggio emilia] [http://bloprofeldi.info/lib/noleggio-tendone.htm noleggio tendone] [http://ustall.org/web/porno-video.htm porno video 2004] [http://bloprofeldi.info/lib/www-fine.htm www fine pix viewer it] [http://ustall.org/web/audio-focal.htm audio focal] [http://kinunia.cn/masterizzatori-dvd.htm masterizzatori dvd per mac] [http://kinunia.cn/shrapnel.htm shrapnel] [http://nobinters.org/bob-marley.htm bob marley. spiritual journey] [http://helmed.info/topic/alpina-bmw/ alpina bmw] [http://bloprofeldi.info/lib/volo-lissone.htm volo lissone] [http://davte.info/library/html/michelle-trachtenberg.htm michelle trachtenberg] [http://bloprofeldi.info/lib/fiat-pd.htm fiat pd] [http://psisemiya.com/images/small/u-n/ u n i c e f] [http://kinunia.cn/militari-donne.htm militari donne nude] [http://nobinters.org/freepassword.htm freepassword] [http://amohseni.info/img/styles/www-unina/ www unina it immatricolazioni] [http://ustall.org/web/dre.htm dre] [http://kinunia.cn/canon-ef.htm canon ef fisheye] [http://amohseni.info/img/styles/acrobat-/ acrobat 7 pro ita] [http://kinunia.cn/rosas-rojas.htm rosas rojas] [http://amohseni.info/img/styles/sdram-/ sdram 133 mhz] [http://helmed.info/topic/maniaco-sessuale/ maniaco sessuale] [http://davte.info/library/html/fiat-bravo.htm fiat bravo td 100] [http://nobinters.org/dvd-r.htm dvd r tdk printable] [http://psisemiya.com/images/small/filca/ filca] [http://chaba.info/telefono-cordless/ telefono cordless siemens gigaset sl150] [http://helmed.info/topic/ban/ ban] [http://chaba.info/salvatore-accardo/ salvatore accardo] [http://amohseni.info/img/styles/lacie-hard/ lacie hard disk esterno 500] [http://chaba.info/brisa-hector/ brisa hector y tito] [http://helmed.info/topic/jambes/ jambes] [http://ustall.org/web/galleggiante-nuoto.htm galleggiante nuoto] [http://nobinters.org/model-young.htm model young little] [http://ustall.org/web/n-palmare.htm n50 palmare] [http://saibso.org/orata.htm orata] [http://nobinters.org/knock-on.htm knock on wood] [http://ustall.org/web/behringer-xm.htm behringer xm8500] [http://kinunia.cn/annunci-con.htm annunci con cell] [http://ustall.org/web/uahex.htm uahex] [http://helmed.info/topic/dragostei-di/ dragostei di tei] [http://psisemiya.com/images/small/goooooooooogle/ goooooooooogle] [http://nobinters.org/miss-maglietta.htm miss maglietta bagnata] [http://nobinters.org/qiryat-yam.htm qiryat yam] [http://psisemiya.com/images/small/chat-c/ chat c6] [http://chaba.info/pietta/ pietta] [http://ustall.org/web/www-playtv.htm www playtv com] [http://bloprofeldi.info/lib/philips-jukebox.htm philips jukebox mp3 hdd-100] [http://chaba.info/keygen-stylexp/ keygen stylexp] [http://kinunia.cn/game-boy.htm game boy spiderman] [http://davte.info/library/html/opiniones-del.htm opiniones del la obra de garcia marquez] [http://helmed.info/topic/escpae-the/ escpae the room] [http://helmed.info/topic/yer-cuntry/ yer cuntry] [http://davte.info/library/html/htpc-case.htm htpc case e alimentatori] [http://nobinters.org/il-signore.htm il signore degli anelli 4 dvd] [http://chaba.info/michelangelo-adsl/ michelangelo adsl] [http://bloprofeldi.info/lib/consob.htm consob] [http://davte.info/library/html/gretchen-nua.htm gretchen nua] [http://kinunia.cn/montorsi.htm montorsi] [http://ustall.org/web/triple-play.htm triple play 2001] [http://bloprofeldi.info/lib/atollo-di.htm atollo di ari it] [http://helmed.info/topic/strict-machine/ strict machine] [http://ashythro.info/library/html/fire-wire/ fire wire 1394] [http://chaba.info/staf-srl/ staf srl] [http://amohseni.info/img/styles/hp-ipaq/ hp ipaq h6315] [http://amohseni.info/img/styles/pci-express/ pci express] [http://saibso.org/www-burek.htm www burek com] [http://kinunia.cn/indirizzo-posta.htm indirizzo posta elettronica] [http://amohseni.info/img/styles/salsa-musica/ salsa musica] [http://saibso.org/scuola-in.htm scuola in ospedale] [http://davte.info/library/html/fiat-punto.htm fiat punto sporting] [http://psisemiya.com/images/small/reginella-campagnola/ reginella campagnola] [http://amohseni.info/img/styles/tv-plasma/ tv plasma lcd 42] [http://bloprofeldi.info/lib/ipso-iure.htm ipso iure] [http://kinunia.cn/telefonini-vodafone.htm telefonini vodafone samsung] [http://kinunia.cn/s-t.htm s t u n] [http://psisemiya.com/images/small/filmato-divertenti/ filmato divertenti] [http://davte.info/library/html/daasa.htm daasa] [http://davte.info/library/html/lamiere-.htm lamiere - lavorazione e produzione] [http://nobinters.org/mamma-.htm mamma  mestruazioni] [http://ustall.org/web/condono-edilizio.htm condono edilizio in toscana] [http://saibso.org/immagini-di.htm immagini di harry potter] [http://ustall.org/web/monitor-per.htm monitor per pc] [http://nobinters.org/sony-sdmhspb.htm sony sdm-hs75pb] [http://saibso.org/hunziker-foto.htm hunziker foto] [http://davte.info/library/html/republican-river.htm republican river] [http://davte.info/library/html/discoteche-meridionali.htm discoteche meridionali] [http://helmed.info/topic/baseball-bat/ baseball bat] [http://saibso.org/pc-ram.htm pc2100 ram 266] [http://bloprofeldi.info/lib/igiene-degli.htm igiene degli alimenti] [http://ustall.org/web/panasonic-nvgs.htm panasonic nv-gs250] [http://chaba.info/kingston-rs/ kingston rs mmc dual voltage nokia 6680] [http://davte.info/library/html/fist-of.htm fist of the north star] [http://saibso.org/fotografie-nudo.htm fotografie nudo] [http://psisemiya.com/images/small/amplificatori-denon/ amplificatori denon] from [http://www.citi.umich.edu/projects/nfsv4/linux/using-nfsv4.html CITI] documentation.
+
from [http://www.citi.umich.edu/projects/nfsv4/linux/using-nfsv4.html CITI] documentation.
= NFSv4 configuration =
= NFSv4 configuration =
== Base configuration ==
== Base configuration ==
-
This section maybe skiped on most recent distribution. If so, go [[#Exporting_directories|here]]
+
This section may be skipped on most recent distribution. If so, go [[#Exporting_directories|here]]
You should have already built and installed the kernel and user utilities and setup krb5.
You should have already built and installed the kernel and user utilities and setup krb5.
-
The following steps need only be done once. It maybe skiped most recent distribution.
+
The following steps need only be done once. It maybe skipped most recent distribution.
Add the following lines to /etc/fstab to mount the rpc_pipefs and nfsd filesystems automatically:
Add the following lines to /etc/fstab to mount the rpc_pipefs and nfsd filesystems automatically:
Line 24: Line 24:
Create a directory to export on the server:
Create a directory to export on the server:
*mkdir /export
*mkdir /export
-
*chmod a rwxt /export
+
*chmod a+rwxt /export
The following steps need to be performed on every boot; this should really be done by init scripts. The necessary init scripts already exist in recent Fedora distributions. See also debian/nfs-common.init and debian/nfs-kernel-server.init in the patched nfs-utils tarball for example init scripts.
The following steps need to be performed on every boot; this should really be done by init scripts. The necessary init scripts already exist in recent Fedora distributions. See also debian/nfs-common.init and debian/nfs-kernel-server.init in the patched nfs-utils tarball for example init scripts.
Line 34: Line 34:
  rpc.svcgssd  -> this is obsolete as of nfs-utils version 1.0.8-1
  rpc.svcgssd  -> this is obsolete as of nfs-utils version 1.0.8-1
  rpc.nfsd 8
  rpc.nfsd 8
 +
 +
### Feb 2012: I've added some updates on this in the below
On the client, run rpc.gssd and rpc.idmapd:
On the client, run rpc.gssd and rpc.idmapd:
Line 43: Line 45:
Export your server directory (in this case, to anyone, using any authentication flavor), by adding the following lines to /etc/exports
Export your server directory (in this case, to anyone, using any authentication flavor), by adding the following lines to /etc/exports
-
/export  *(rw,fsid=0,insecure,no_subtree_check)
 
  /export  gss/krb5(rw,fsid=0,insecure,no_subtree_check)
  /export  gss/krb5(rw,fsid=0,insecure,no_subtree_check)
  /export  gss/krb5i(rw,fsid=0,insecure,no_subtree_check)
  /export  gss/krb5i(rw,fsid=0,insecure,no_subtree_check)
Line 62: Line 63:
and mount the server:
and mount the server:
-
  mount -t nfs4 yourserver:/ /mnt/nfs4/
+
  mount -t nfs4 yourserver:/export /mnt/nfs4/
or, to mount with kerberos,
or, to mount with kerberos,
-
  mount -t nfs4 -o sec=krb5 yourserver:/ /mnt/nfs4/
+
  mount -t nfs4 -o sec=krb5 yourserver:/export /mnt/nfs4/
Play around with the mounted filesystem:
Play around with the mounted filesystem:
Line 75: Line 76:
  getfacl FOO
  getfacl FOO
-
etc.  
+
etc.
-
Exporting and mounting can be automated using /etc/fstab and /etc/exports; see the man pages fstab(5) and exports(5). Note that exports behave quite differently under v4 and v3, so some additional explanation may be called for:
+
To mount a filesystem using krb5, provide the "-osec=krb5" option to mount. To export a filesystem using krb5, export it to the special client named "gss/krb5". Replace "krb5" by "krb5i" or "krb5p" for integrity or for privacy, respectively. The -osec= options should also work for NFSv3 exports and mounts.
-
NFSv4 exports on linux
+
-
NFSv4 no longer has a separate "mount" protocol. Instead of exporting a number of distinct exports, an NFSv4 client sees the NFSv4 server's exports as existing inside a single filesystem, called the nfsv4 "pseudofilesystem".
+
Exporting and mounting can be automated using /etc/fstab and /etc/exports; see the man pages fstab(5) and exports(5).
-
On the current linux implementation, the pseudofilesystem is a single real filesystem, identified at export with the fsid=0 option.
+
Technical note: NFSv4 no longer has a separate "mount" protocol. Instead of exporting a number of distinct exports, an NFSv4 client sees the NFSv4 server's exports as existing inside a single filesystem, called the nfsv4 "pseudofilesystem".
-
In the example above, we exported only a single filesystem, which the client mounted as "/". You can provide clients with multiple filesystems to mount, producing NFSv3-like-behavior, by creative use of mount --bind. For example, you could export /usr/local/bin to clients as /bin and /usr/local/etc as /etc as follows:
+
The linux implementation allows you to designate a real filesystem as the pseudofilesystem, identifying that export with the fsid=0 option; we no longer recommend this. Instead, on any recent linux distribution, just list exports in /etc/exports exactly as you would for NFSv2 or NFSv3.
-
mkdir /export
+
== RPC Processes ==
-
mkdir /export/bin
+
-
mkdir /export/etc
+
-
mount --bind /usr/local/bin /export/bin
+
-
mount --bind /usr/local/etc /export/etc
+
-
exportfs -ofsid=0,insecure,no_subtree_check *:/export
+
-
exportfs -orw,nohide,insecure,no_subtree_check *:/export/bin
+
-
exportfs -orw,nohide,insecure,no_subtree_check *:/export/etc
+
-
This is what /etc/exports might look like:
+
1. openSUSE after starting the nfs server
-
/export  *(rw,fsid=0,insecure,no_subtree_check)
+
ps aux | grep rpc
-
/export/bin  *(rw,nohide,insecure,no_subtree_check)
+
-
/export/etc  *(rw,nohide,insecure,no_subtree_check)
+
-
Note that the paths returned by the "showmount" program are meaningful only to clients using nfs versions 2 and 3; in the above example, "showmount" will list the paths /export, /export/bin/, and /export/etc, but nfsv4 clients should mount yourserver:/, yourserver:/bin, or yourserver:/etc.
+
root      1231  0.0  0.1  2356  764 ?        Ss  08:20  0:00 /sbin/rpcbind
-
Mounting and exporting krb5
+
-
To mount a filesystem using krb5, provide the "-osec=krb5" option to mount. To export a filesystem using krb5, export it to the special client named "gss/krb5". Replace "krb5" by "krb5i" or "krb5p" for integrity or for privacy, respectively. The -osec= options should also work for NFSv3 exports and mounts.
+
root      3737  0.0  0.0      0    0 ?        S<  08:28  0:00 [rpciod]
 +
 
 +
root      5215  0.0  0.2  3684  1208 ?        Ss  09:26  0:00 /usr/sbin/rpc.svcgssd
 +
 
 +
root      5223  0.0  0.0  2416  344 ?        Ss  09:26  0:00 /usr/sbin/rpc.idmapd
 +
 
 +
root      5227  0.0  0.1  2976  748 ?        Ss  09:26  0:00 /usr/sbin/rpc.mountd --no-nfs-version 2 --no-nfs-version 3
 +
(note the lack of gssd)
 +
 
 +
2. On both openSUSE (after calling rpc.gssd) and Ubuntu with all the necessary processes for successfully exporting the directory with -o sec=krb5<flavour>
 +
 
 +
ps aux | grep rpc
 +
 
 +
root      1231  0.0  0.1  2356  764 ?        Ss  08:20  0:00 /sbin/rpcbind
 +
 
 +
root      3737  0.0  0.0      0    0 ?        S<  08:28  0:00 [rpciod]
 +
 
 +
root      5215  0.0  0.2  3684  1208 ?        Ss  09:26  0:00 /usr/sbin/rpc.svcgssd
 +
 
 +
root      5223  0.0  0.0  2416  344 ?        Ss  09:26  0:00 /usr/sbin/rpc.idmapd
 +
 
 +
root      5227  0.0  0.1  2976  748 ?        Ss  09:26  0:00 /usr/sbin/rpc.mountd --no-nfs-version 2 --no-nfs-version 3
 +
 
 +
root      5294  0.0  0.0  3816  428 ?        Ss  09:31  0:00 rpc.gssd
 +
 
 +
== NFS Installation details ==
 +
 
 +
=== openSUSE ===
 +
Packages:
 +
zypper in nfs-kernel-server nfs-client nfsidmap limal-nfs-server
 +
 
 +
Configuration (Or use the excellent Yast NFS-Server Module)
 +
/etc/sysconfig/nfs
 +
 
 +
USE_KERNEL_NFSD_NUMBER="4"
 +
 
 +
MOUNTD_PORT=""
 +
 
 +
NFS_SECURITY_GSS="yes"
 +
 
 +
NFS3_SERVER_SUPPORT="no"
 +
 
 +
NFS4_SUPPORT="yes"
 +
 
 +
SM_NOTIFY_OPTIONS=""
 +
 
 +
NFS_START_SERVICES="yes"
 +
 
 +
STATD_OPTIONS=""
 +
 
 +
NFSV4LEASETIME=""
 +
 
 +
RPC_PIPEFS_DIR=""
 +
 
 +
SVCGSSD_OPTIONS=""
 +
 
 +
NFSD_OPTIONS=""
 +
 
 +
=== Ubuntu ===
 +
Packages:
 +
 
 +
apt-get install nfs-common nfs-kernel-server
 +
(you may also need to do a: modprobe nfs before starting the nfs server)
 +
 
 +
Configuration
 +
 
 +
/etc/default/nfs-common
 +
 
 +
NEED_STATD=
 +
 
 +
STATDOPTS=
 +
 
 +
NEED_IDMAPD=yes
 +
 
 +
NEED_GSSD=yes
 +
 
 +
 
 +
/etc/default/nfs-kernel-server
 +
 
 +
RPCNFSDCOUNT=8
 +
 
 +
RPCNFSDPRIORITY=0
 +
 
 +
RPCMOUNTDOPTS=--manage-gids
 +
 
 +
NEED_SVCGSSD=yes
 +
 
 +
RPCSVCGSSDOPTS=
 +
 
 +
RPCNFSDOPTS=
 +
 
 +
 
 +
 
 +
=== Needed on both client and server on both openSUSE and Ubuntu ===
 +
 
 +
/etc/idmapd.conf
 +
 
 +
[General]
 +
 
 +
Verbosity = 0
 +
 
 +
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
 +
 
 +
Domain = hh3.site //or whatever your domain is
 +
 
 +
[Mapping]
 +
 
 +
Nobody-User = nobody
 +
 
 +
Nobody-Group = nogroup
 +
 
 +
== Debugging ==
 +
 
 +
Run rpc.idmapd -fvvv and rpc.gssd -fvvv in separate terminals. They will tell you in no uncertain
 +
terms when you've got it wrong. Please see this screenshot:
 +
 
 +
http://3.bp.blogspot.com/-PLpbJDP1vCQ/TygMlNU6k8I/AAAAAAAAAGE/lVXsw6iGrS0/s1600/krb5-ubuntu3.png
 +
 
 +
== A Real Life Example ==
 +
 
 +
hh3.hh3.site is the nfs server and  HH6$@HH3.SITE is the machine principal for the client.
 +
On the client, we issue a:
 +
 
 +
mount -t nfs4 hh3:/foo /bar -o sec=krb5
 +
 
 +
Here is the log on the KDC:
 +
 
 +
Kerberos: ENC-TS Pre-authentication succeeded -- HH6$@HH3.SITE using arcfour-hmac-md5
 +
 
 +
Kerberos: AS-REQ authtime: 2012-02-06T19:44:47 starttime: unset endtime: 2012-02-07T05:44:47 renew till: 2012-02-07T19:44:47
 +
 
 +
Kerberos: Client supported enctypes: aes256-cts-hmac-sha1-96, aes128-cts-hmac-sha1-96, des3-cbc-
 +
sha1, arcfour-hmac-md5, des-cbc-crc, des-cbc-md5, des-cbc-md4, using arcfour-hmac-md5/arcfour-hmac-md5
 +
 
 +
Kerberos: Requested flags: renewable-ok
 +
 
 +
Kerberos: TGS-REQ HH6$@HH3.SITE from ipv4:192.168.1.10:45421 for nfs/hh3.hh3.site@HH3.SITE [canonicalize, renewable]
 +
 
 +
Kerberos: TGS-REQ authtime: 2012-02-06T19:44:47 starttime: 2012-02-06T19:44:47 endtime: 2012-02-07T05:44:47 renew till: 20
 +
 
 +
The nfs server has identified itself, here are the keys in its keytab:
 +
 
 +
klist -ke /etc/krb5.keytab
 +
Keytab name: WRFILE:/etc/krb5.keytab
 +
 
 +
KVNO Principal
 +
  1 nfs/hh3.hh3.site@HH3.SITE (arcfour-hmac) 
 +
  1 HH3$@hh3.site (arcfour-hmac)
 +
 
 +
== Troubleshooting ==
 +
 
 +
http://wiki.linux-nfs.org/wiki/index.php?title=Troubleshooting
 +
 
 +
== References ==
 +
 
 +
1. man rpc.gssd(8)
 +
 
 +
http://linux.die.net/man/8/rpc.gssd
 +
 
 +
2. A hands on practical using modest hardware. Includes screenshots. openSUSE specific.
 +
 
 +
http://linuxcostablanca.blogspot.com/p/samba-4.html
 +
 
 +
3. The same as (3) but with Ubuntu specific differences
 +
 
 +
http://linuxcostablanca.blogspot.com/2012/01/samba-4-ubuntu.html
 +
 
 +
4. The latest unofficial version of this wiki page. Any new findings, I'll post there.
 +
 
 +
http://linuxcostablanca.blogspot.com/2012/02/nfsv4-myths-and-legends.html

Latest revision as of 16:28, 8 June 2017

from CITI documentation.

Contents

NFSv4 configuration

Base configuration

This section may be skipped on most recent distribution. If so, go here

You should have already built and installed the kernel and user utilities and setup krb5.

The following steps need only be done once. It maybe skipped most recent distribution.

Add the following lines to /etc/fstab to mount the rpc_pipefs and nfsd filesystems automatically:

rpc_pipefs	/var/lib/nfs/rpc_pipefs	rpc_pipefs	defaults	0	0
nfsd	/proc/fs/nfsd	nfsd	defaults	0	0

and create the mountpoint for rpc_pipefs, and mount both filesystems:

  • mkdir /var/lib/nfs/rpc_pipefs
  • mount rpc_pipefs
  • mount nfsd

Modify the fstab line for filesystem you plan to export on the server to add the "acl" option to the mount options.

Create a directory to export on the server:

  • mkdir /export
  • chmod a+rwxt /export

The following steps need to be performed on every boot; this should really be done by init scripts. The necessary init scripts already exist in recent Fedora distributions. See also debian/nfs-common.init and debian/nfs-kernel-server.init in the patched nfs-utils tarball for example init scripts.

On your server, run rpc.mountd, rpc.svcgssd, rpc.idmapd, and rpc.nfsd:

rpc.mountd
rpc.idmapd
rpc.svcgssd   -> this is obsolete as of nfs-utils version 1.0.8-1
rpc.nfsd 8
      1. Feb 2012: I've added some updates on this in the below

On the client, run rpc.gssd and rpc.idmapd:

rpc.gssd -m
rpc.idmapd

Exporting directories

Export your server directory (in this case, to anyone, using any authentication flavor), by adding the following lines to /etc/exports

/export  gss/krb5(rw,fsid=0,insecure,no_subtree_check)
/export  gss/krb5i(rw,fsid=0,insecure,no_subtree_check)
/export  gss/krb5p(rw,fsid=0,insecure,no_subtree_check)

and then running

exportfs -r

(Note that if your server is connected to the internet the first line will give everyone in the world read and write access to /export and (with a little work) to anything on the same disk partition as /export! See the exports man page for more information.)

To access this export from a client:

Create a mountpoint on your client:

mkdir /mnt/nfs4/

and mount the server:

mount -t nfs4 yourserver:/export /mnt/nfs4/

or, to mount with kerberos,

mount -t nfs4 -o sec=krb5 yourserver:/export /mnt/nfs4/

Play around with the mounted filesystem:

cd /mnt/nfs4/
echo "Hello World!" >FOO
cat FOO
getfacl FOO

etc.

To mount a filesystem using krb5, provide the "-osec=krb5" option to mount. To export a filesystem using krb5, export it to the special client named "gss/krb5". Replace "krb5" by "krb5i" or "krb5p" for integrity or for privacy, respectively. The -osec= options should also work for NFSv3 exports and mounts.

Exporting and mounting can be automated using /etc/fstab and /etc/exports; see the man pages fstab(5) and exports(5).

Technical note: NFSv4 no longer has a separate "mount" protocol. Instead of exporting a number of distinct exports, an NFSv4 client sees the NFSv4 server's exports as existing inside a single filesystem, called the nfsv4 "pseudofilesystem".

The linux implementation allows you to designate a real filesystem as the pseudofilesystem, identifying that export with the fsid=0 option; we no longer recommend this. Instead, on any recent linux distribution, just list exports in /etc/exports exactly as you would for NFSv2 or NFSv3.

RPC Processes

1. openSUSE after starting the nfs server

ps aux | grep rpc

root 1231 0.0 0.1 2356 764 ? Ss 08:20 0:00 /sbin/rpcbind

root 3737 0.0 0.0 0 0 ? S< 08:28 0:00 [rpciod]

root 5215 0.0 0.2 3684 1208 ? Ss 09:26 0:00 /usr/sbin/rpc.svcgssd

root 5223 0.0 0.0 2416 344 ? Ss 09:26 0:00 /usr/sbin/rpc.idmapd

root 5227 0.0 0.1 2976 748 ? Ss 09:26 0:00 /usr/sbin/rpc.mountd --no-nfs-version 2 --no-nfs-version 3 (note the lack of gssd)

2. On both openSUSE (after calling rpc.gssd) and Ubuntu with all the necessary processes for successfully exporting the directory with -o sec=krb5<flavour>

ps aux | grep rpc

root 1231 0.0 0.1 2356 764 ? Ss 08:20 0:00 /sbin/rpcbind

root 3737 0.0 0.0 0 0 ? S< 08:28 0:00 [rpciod]

root 5215 0.0 0.2 3684 1208 ? Ss 09:26 0:00 /usr/sbin/rpc.svcgssd

root 5223 0.0 0.0 2416 344 ? Ss 09:26 0:00 /usr/sbin/rpc.idmapd

root 5227 0.0 0.1 2976 748 ? Ss 09:26 0:00 /usr/sbin/rpc.mountd --no-nfs-version 2 --no-nfs-version 3

root 5294 0.0 0.0 3816 428 ? Ss 09:31 0:00 rpc.gssd

NFS Installation details

openSUSE

Packages: zypper in nfs-kernel-server nfs-client nfsidmap limal-nfs-server

Configuration (Or use the excellent Yast NFS-Server Module) /etc/sysconfig/nfs

USE_KERNEL_NFSD_NUMBER="4"

MOUNTD_PORT=""

NFS_SECURITY_GSS="yes"

NFS3_SERVER_SUPPORT="no"

NFS4_SUPPORT="yes"

SM_NOTIFY_OPTIONS=""

NFS_START_SERVICES="yes"

STATD_OPTIONS=""

NFSV4LEASETIME=""

RPC_PIPEFS_DIR=""

SVCGSSD_OPTIONS=""

NFSD_OPTIONS=""

Ubuntu

Packages:

apt-get install nfs-common nfs-kernel-server (you may also need to do a: modprobe nfs before starting the nfs server)

Configuration

/etc/default/nfs-common

NEED_STATD=

STATDOPTS=

NEED_IDMAPD=yes

NEED_GSSD=yes


/etc/default/nfs-kernel-server

RPCNFSDCOUNT=8

RPCNFSDPRIORITY=0

RPCMOUNTDOPTS=--manage-gids

NEED_SVCGSSD=yes

RPCSVCGSSDOPTS=

RPCNFSDOPTS=


Needed on both client and server on both openSUSE and Ubuntu

/etc/idmapd.conf

[General]

Verbosity = 0

Pipefs-Directory = /var/lib/nfs/rpc_pipefs

Domain = hh3.site //or whatever your domain is

[Mapping]

Nobody-User = nobody

Nobody-Group = nogroup

Debugging

Run rpc.idmapd -fvvv and rpc.gssd -fvvv in separate terminals. They will tell you in no uncertain terms when you've got it wrong. Please see this screenshot:

http://3.bp.blogspot.com/-PLpbJDP1vCQ/TygMlNU6k8I/AAAAAAAAAGE/lVXsw6iGrS0/s1600/krb5-ubuntu3.png

A Real Life Example

hh3.hh3.site is the nfs server and HH6$@HH3.SITE is the machine principal for the client. On the client, we issue a:

mount -t nfs4 hh3:/foo /bar -o sec=krb5

Here is the log on the KDC:

Kerberos: ENC-TS Pre-authentication succeeded -- HH6$@HH3.SITE using arcfour-hmac-md5

Kerberos: AS-REQ authtime: 2012-02-06T19:44:47 starttime: unset endtime: 2012-02-07T05:44:47 renew till: 2012-02-07T19:44:47

Kerberos: Client supported enctypes: aes256-cts-hmac-sha1-96, aes128-cts-hmac-sha1-96, des3-cbc- sha1, arcfour-hmac-md5, des-cbc-crc, des-cbc-md5, des-cbc-md4, using arcfour-hmac-md5/arcfour-hmac-md5

Kerberos: Requested flags: renewable-ok

Kerberos: TGS-REQ HH6$@HH3.SITE from ipv4:192.168.1.10:45421 for nfs/hh3.hh3.site@HH3.SITE [canonicalize, renewable]

Kerberos: TGS-REQ authtime: 2012-02-06T19:44:47 starttime: 2012-02-06T19:44:47 endtime: 2012-02-07T05:44:47 renew till: 20

The nfs server has identified itself, here are the keys in its keytab:

klist -ke /etc/krb5.keytab Keytab name: WRFILE:/etc/krb5.keytab

KVNO Principal

  1 nfs/hh3.hh3.site@HH3.SITE (arcfour-hmac)  
  1 HH3$@hh3.site (arcfour-hmac)

Troubleshooting

http://wiki.linux-nfs.org/wiki/index.php?title=Troubleshooting

References

1. man rpc.gssd(8)

http://linux.die.net/man/8/rpc.gssd

2. A hands on practical using modest hardware. Includes screenshots. openSUSE specific.

http://linuxcostablanca.blogspot.com/p/samba-4.html

3. The same as (3) but with Ubuntu specific differences

http://linuxcostablanca.blogspot.com/2012/01/samba-4-ubuntu.html

4. The latest unofficial version of this wiki page. Any new findings, I'll post there.

http://linuxcostablanca.blogspot.com/2012/02/nfsv4-myths-and-legends.html
Personal tools