afs.txt 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. ====================
  2. kAFS: AFS FILESYSTEM
  3. ====================
  4. Contents:
  5. - Overview.
  6. - Usage.
  7. - Mountpoints.
  8. - Proc filesystem.
  9. - The cell database.
  10. - Security.
  11. - Examples.
  12. ========
  13. OVERVIEW
  14. ========
  15. This filesystem provides a fairly simple secure AFS filesystem driver. It is
  16. under development and does not yet provide the full feature set. The features
  17. it does support include:
  18. (*) Security (currently only AFS kaserver and KerberosIV tickets).
  19. (*) File reading.
  20. (*) Automounting.
  21. It does not yet support the following AFS features:
  22. (*) Write support.
  23. (*) Local caching.
  24. (*) pioctl() system call.
  25. ===========
  26. COMPILATION
  27. ===========
  28. The filesystem should be enabled by turning on the kernel configuration
  29. options:
  30. CONFIG_AF_RXRPC - The RxRPC protocol transport
  31. CONFIG_RXKAD - The RxRPC Kerberos security handler
  32. CONFIG_AFS - The AFS filesystem
  33. Additionally, the following can be turned on to aid debugging:
  34. CONFIG_AF_RXRPC_DEBUG - Permit AF_RXRPC debugging to be enabled
  35. CONFIG_AFS_DEBUG - Permit AFS debugging to be enabled
  36. They permit the debugging messages to be turned on dynamically by manipulating
  37. the masks in the following files:
  38. /sys/module/af_rxrpc/parameters/debug
  39. /sys/module/afs/parameters/debug
  40. =====
  41. USAGE
  42. =====
  43. When inserting the driver modules the root cell must be specified along with a
  44. list of volume location server IP addresses:
  45. insmod af_rxrpc.o
  46. insmod rxkad.o
  47. insmod kafs.o rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91
  48. The first module is the AF_RXRPC network protocol driver. This provides the
  49. RxRPC remote operation protocol and may also be accessed from userspace. See:
  50. Documentation/networking/rxrpc.txt
  51. The second module is the kerberos RxRPC security driver, and the third module
  52. is the actual filesystem driver for the AFS filesystem.
  53. Once the module has been loaded, more modules can be added by the following
  54. procedure:
  55. echo add grand.central.org 18.7.14.88:128.2.191.224 >/proc/fs/afs/cells
  56. Where the parameters to the "add" command are the name of a cell and a list of
  57. volume location servers within that cell, with the latter separated by colons.
  58. Filesystems can be mounted anywhere by commands similar to the following:
  59. mount -t afs "%cambridge.redhat.com:root.afs." /afs
  60. mount -t afs "#cambridge.redhat.com:root.cell." /afs/cambridge
  61. mount -t afs "#root.afs." /afs
  62. mount -t afs "#root.cell." /afs/cambridge
  63. Where the initial character is either a hash or a percent symbol depending on
  64. whether you definitely want a R/W volume (hash) or whether you'd prefer a R/O
  65. volume, but are willing to use a R/W volume instead (percent).
  66. The name of the volume can be suffixes with ".backup" or ".readonly" to
  67. specify connection to only volumes of those types.
  68. The name of the cell is optional, and if not given during a mount, then the
  69. named volume will be looked up in the cell specified during insmod.
  70. Additional cells can be added through /proc (see later section).
  71. ===========
  72. MOUNTPOINTS
  73. ===========
  74. AFS has a concept of mountpoints. In AFS terms, these are specially formatted
  75. symbolic links (of the same form as the "device name" passed to mount). kAFS
  76. presents these to the user as directories that have a follow-link capability
  77. (ie: symbolic link semantics). If anyone attempts to access them, they will
  78. automatically cause the target volume to be mounted (if possible) on that site.
  79. Automatically mounted filesystems will be automatically unmounted approximately
  80. twenty minutes after they were last used. Alternatively they can be unmounted
  81. directly with the umount() system call.
  82. Manually unmounting an AFS volume will cause any idle submounts upon it to be
  83. culled first. If all are culled, then the requested volume will also be
  84. unmounted, otherwise error EBUSY will be returned.
  85. This can be used by the administrator to attempt to unmount the whole AFS tree
  86. mounted on /afs in one go by doing:
  87. umount /afs
  88. ===============
  89. PROC FILESYSTEM
  90. ===============
  91. The AFS modules creates a "/proc/fs/afs/" directory and populates it:
  92. (*) A "cells" file that lists cells currently known to the afs module and
  93. their usage counts:
  94. [root@andromeda ~]# cat /proc/fs/afs/cells
  95. USE NAME
  96. 3 cambridge.redhat.com
  97. (*) A directory per cell that contains files that list volume location
  98. servers, volumes, and active servers known within that cell.
  99. [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/servers
  100. USE ADDR STATE
  101. 4 172.16.18.91 0
  102. [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/vlservers
  103. ADDRESS
  104. 172.16.18.91
  105. [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/volumes
  106. USE STT VLID[0] VLID[1] VLID[2] NAME
  107. 1 Val 20000000 20000001 20000002 root.afs
  108. =================
  109. THE CELL DATABASE
  110. =================
  111. The filesystem maintains an internal database of all the cells it knows and the
  112. IP addresses of the volume location servers for those cells. The cell to which
  113. the system belongs is added to the database when insmod is performed by the
  114. "rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on
  115. the kernel command line.
  116. Further cells can be added by commands similar to the following:
  117. echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells
  118. echo add grand.central.org 18.7.14.88:128.2.191.224 >/proc/fs/afs/cells
  119. No other cell database operations are available at this time.
  120. ========
  121. SECURITY
  122. ========
  123. Secure operations are initiated by acquiring a key using the klog program. A
  124. very primitive klog program is available at:
  125. http://people.redhat.com/~dhowells/rxrpc/klog.c
  126. This should be compiled by:
  127. make klog LDLIBS="-lcrypto -lcrypt -lkrb4 -lkeyutils"
  128. And then run as:
  129. ./klog
  130. Assuming it's successful, this adds a key of type RxRPC, named for the service
  131. and cell, eg: "afs@<cellname>". This can be viewed with the keyctl program or
  132. by cat'ing /proc/keys:
  133. [root@andromeda ~]# keyctl show
  134. Session Keyring
  135. -3 --alswrv 0 0 keyring: _ses.3268
  136. 2 --alswrv 0 0 \_ keyring: _uid.0
  137. 111416553 --als--v 0 0 \_ rxrpc: afs@CAMBRIDGE.REDHAT.COM
  138. Currently the username, realm, password and proposed ticket lifetime are
  139. compiled in to the program.
  140. It is not required to acquire a key before using AFS facilities, but if one is
  141. not acquired then all operations will be governed by the anonymous user parts
  142. of the ACLs.
  143. If a key is acquired, then all AFS operations, including mounts and automounts,
  144. made by a possessor of that key will be secured with that key.
  145. If a file is opened with a particular key and then the file descriptor is
  146. passed to a process that doesn't have that key (perhaps over an AF_UNIX
  147. socket), then the operations on the file will be made with key that was used to
  148. open the file.
  149. ========
  150. EXAMPLES
  151. ========
  152. Here's what I use to test this. Some of the names and IP addresses are local
  153. to my internal DNS. My "root.afs" partition has a mount point within it for
  154. some public volumes volumes.
  155. insmod /tmp/rxrpc.o
  156. insmod /tmp/rxkad.o
  157. insmod /tmp/kafs.o rootcell=cambridge.redhat.com:172.16.18.91
  158. mount -t afs \%root.afs. /afs
  159. mount -t afs \%cambridge.redhat.com:root.cell. /afs/cambridge.redhat.com/
  160. echo add grand.central.org 18.7.14.88:128.2.191.224 > /proc/fs/afs/cells
  161. mount -t afs "#grand.central.org:root.cell." /afs/grand.central.org/
  162. mount -t afs "#grand.central.org:root.archive." /afs/grand.central.org/archive
  163. mount -t afs "#grand.central.org:root.contrib." /afs/grand.central.org/contrib
  164. mount -t afs "#grand.central.org:root.doc." /afs/grand.central.org/doc
  165. mount -t afs "#grand.central.org:root.project." /afs/grand.central.org/project
  166. mount -t afs "#grand.central.org:root.service." /afs/grand.central.org/service
  167. mount -t afs "#grand.central.org:root.software." /afs/grand.central.org/software
  168. mount -t afs "#grand.central.org:root.user." /afs/grand.central.org/user
  169. umount /afs
  170. rmmod kafs
  171. rmmod rxkad
  172. rmmod rxrpc