afs.rst 7.8 KB

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