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