blob: ca062a7f8ee2d0e6a61c9d7a5bde1e6c25d32ab8 [file] [log] [blame]
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +01001.. SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +01003====================
4kAFS: AFS FILESYSTEM
5====================
6
7.. Contents:
David Howells0795e7c02007-04-26 15:57:43 -07008
9 - Overview.
10 - Usage.
11 - Mountpoints.
David Howells4d673da2018-02-06 06:26:30 +000012 - Dynamic root.
David Howells0795e7c02007-04-26 15:57:43 -070013 - Proc filesystem.
14 - The cell database.
15 - Security.
David Howells6f8880d2018-04-09 21:12:31 +010016 - The @sys substitution.
David Howells0795e7c02007-04-26 15:57:43 -070017
18
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010019Overview
David Howells0795e7c02007-04-26 15:57:43 -070020========
21
22This filesystem provides a fairly simple secure AFS filesystem driver. It is
23under development and does not yet provide the full feature set. The features
24it does support include:
25
26 (*) Security (currently only AFS kaserver and KerberosIV tickets).
27
Anton Blanchard0dc9aa82009-08-19 16:10:16 +010028 (*) File reading and writing.
David Howells0795e7c02007-04-26 15:57:43 -070029
30 (*) Automounting.
31
Anton Blanchard0dc9aa82009-08-19 16:10:16 +010032 (*) Local caching (via fscache).
33
David Howells0795e7c02007-04-26 15:57:43 -070034It does not yet support the following AFS features:
35
David Howells0795e7c02007-04-26 15:57:43 -070036 (*) pioctl() system call.
37
38
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010039Compilation
David Howells0795e7c02007-04-26 15:57:43 -070040===========
41
42The filesystem should be enabled by turning on the kernel configuration
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010043options::
David Howells0795e7c02007-04-26 15:57:43 -070044
45 CONFIG_AF_RXRPC - The RxRPC protocol transport
46 CONFIG_RXKAD - The RxRPC Kerberos security handler
47 CONFIG_AFS - The AFS filesystem
48
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010049Additionally, the following can be turned on to aid debugging::
David Howells0795e7c02007-04-26 15:57:43 -070050
51 CONFIG_AF_RXRPC_DEBUG - Permit AF_RXRPC debugging to be enabled
52 CONFIG_AFS_DEBUG - Permit AFS debugging to be enabled
53
54They permit the debugging messages to be turned on dynamically by manipulating
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010055the masks in the following files::
David Howells0795e7c02007-04-26 15:57:43 -070056
57 /sys/module/af_rxrpc/parameters/debug
Anton Blanchard0dc9aa82009-08-19 16:10:16 +010058 /sys/module/kafs/parameters/debug
David Howells0795e7c02007-04-26 15:57:43 -070059
60
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010061Usage
Linus Torvalds1da177e2005-04-16 15:20:36 -070062=====
63
64When inserting the driver modules the root cell must be specified along with a
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010065list of volume location server IP addresses::
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
David Howells88c48452017-02-17 18:16:21 +000067 modprobe rxrpc
Anton Blanchard0dc9aa82009-08-19 16:10:16 +010068 modprobe kafs rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
David Howells0795e7c02007-04-26 15:57:43 -070070The first module is the AF_RXRPC network protocol driver. This provides the
71RxRPC remote operation protocol and may also be accessed from userspace. See:
72
Mauro Carvalho Chehab9f723742020-04-30 18:04:21 +020073 Documentation/networking/rxrpc.rst
David Howells0795e7c02007-04-26 15:57:43 -070074
75The second module is the kerberos RxRPC security driver, and the third module
76is the actual filesystem driver for the AFS filesystem.
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
78Once the module has been loaded, more modules can be added by the following
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010079procedure::
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
Anton Blanchard0dc9aa82009-08-19 16:10:16 +010081 echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83Where the parameters to the "add" command are the name of a cell and a list of
David Howells0795e7c02007-04-26 15:57:43 -070084volume location servers within that cell, with the latter separated by colons.
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +010086Filesystems can be mounted anywhere by commands similar to the following::
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070093Where the initial character is either a hash or a percent symbol depending on
David Howellsbecfcc72017-11-02 15:27:51 +000094whether you definitely want a R/W volume (percent) or whether you'd prefer a
95R/O volume, but are willing to use a R/W volume instead (hash).
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
97The name of the volume can be suffixes with ".backup" or ".readonly" to
98specify connection to only volumes of those types.
99
100The name of the cell is optional, and if not given during a mount, then the
Anton Blanchard0dc9aa82009-08-19 16:10:16 +0100101named volume will be looked up in the cell specified during modprobe.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102
103Additional cells can be added through /proc (see later section).
104
105
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100106Mountpoints
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107===========
108
David Howells0795e7c02007-04-26 15:57:43 -0700109AFS has a concept of mountpoints. In AFS terms, these are specially formatted
110symbolic links (of the same form as the "device name" passed to mount). kAFS
111presents these to the user as directories that have a follow-link capability
Randy Dunlapf7775c22021-01-17 13:33:51 -0800112(i.e.: symbolic link semantics). If anyone attempts to access them, they will
David Howells0795e7c02007-04-26 15:57:43 -0700113automatically cause the target volume to be mounted (if possible) on that site.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
David Howells0795e7c02007-04-26 15:57:43 -0700115Automatically mounted filesystems will be automatically unmounted approximately
116twenty minutes after they were last used. Alternatively they can be unmounted
117directly with the umount() system call.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
David Howells0795e7c02007-04-26 15:57:43 -0700119Manually unmounting an AFS volume will cause any idle submounts upon it to be
120culled first. If all are culled, then the requested volume will also be
121unmounted, otherwise error EBUSY will be returned.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
David Howells0795e7c02007-04-26 15:57:43 -0700123This can be used by the administrator to attempt to unmount the whole AFS tree
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100124mounted on /afs in one go by doing::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
David Howells0795e7c02007-04-26 15:57:43 -0700126 umount /afs
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127
128
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100129Dynamic Root
David Howells4d673da2018-02-06 06:26:30 +0000130============
131
132A mount option is available to create a serverless mount that is only usable
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100133for dynamic lookup. Creating such a mount can be done by, for example::
David Howells4d673da2018-02-06 06:26:30 +0000134
135 mount -t afs none /afs -o dyn
136
137This creates a mount that just has an empty directory at the root. Attempting
138to look up a name in this directory will cause a mountpoint to be created that
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100139looks up a cell of the same name, for example::
David Howells4d673da2018-02-06 06:26:30 +0000140
141 ls /afs/grand.central.org/
142
143
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100144Proc Filesystem
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145===============
146
Randy Dunlapf7775c22021-01-17 13:33:51 -0800147The AFS module creates a "/proc/fs/afs/" directory and populates it:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
David Howells0795e7c02007-04-26 15:57:43 -0700149 (*) A "cells" file that lists cells currently known to the afs module and
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100150 their usage counts::
David Howells0795e7c02007-04-26 15:57:43 -0700151
152 [root@andromeda ~]# cat /proc/fs/afs/cells
153 USE NAME
154 3 cambridge.redhat.com
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
156 (*) A directory per cell that contains files that list volume location
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100157 servers, volumes, and active servers known within that cell::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158
David Howells0795e7c02007-04-26 15:57:43 -0700159 [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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
David Howells0795e7c02007-04-26 15:57:43 -0700169
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100170The Cell Database
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171=================
172
David Howells0795e7c02007-04-26 15:57:43 -0700173The filesystem maintains an internal database of all the cells it knows and the
174IP addresses of the volume location servers for those cells. The cell to which
Anton Blanchard0dc9aa82009-08-19 16:10:16 +0100175the system belongs is added to the database when modprobe is performed by the
David Howells0795e7c02007-04-26 15:57:43 -0700176"rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on
177the kernel command line.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100179Further cells can be added by commands similar to the following::
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
181 echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells
Anton Blanchard0dc9aa82009-08-19 16:10:16 +0100182 echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183
184No other cell database operations are available at this time.
185
186
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100187Security
David Howells0795e7c02007-04-26 15:57:43 -0700188========
189
190Secure operations are initiated by acquiring a key using the klog program. A
191very primitive klog program is available at:
192
Alexander A. Klimov011c9ec2020-07-08 10:14:03 +0200193 https://people.redhat.com/~dhowells/rxrpc/klog.c
David Howells0795e7c02007-04-26 15:57:43 -0700194
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100195This should be compiled by::
David Howells0795e7c02007-04-26 15:57:43 -0700196
197 make klog LDLIBS="-lcrypto -lcrypt -lkrb4 -lkeyutils"
198
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100199And then run as::
David Howells0795e7c02007-04-26 15:57:43 -0700200
201 ./klog
202
203Assuming it's successful, this adds a key of type RxRPC, named for the service
Randy Dunlapf7775c22021-01-17 13:33:51 -0800204and cell, e.g.: "afs@<cellname>". This can be viewed with the keyctl program or
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100205by cat'ing /proc/keys::
David Howells0795e7c02007-04-26 15:57:43 -0700206
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
213Currently the username, realm, password and proposed ticket lifetime are
Randy Dunlapf7775c22021-01-17 13:33:51 -0800214compiled into the program.
David Howells0795e7c02007-04-26 15:57:43 -0700215
216It is not required to acquire a key before using AFS facilities, but if one is
217not acquired then all operations will be governed by the anonymous user parts
218of the ACLs.
219
220If a key is acquired, then all AFS operations, including mounts and automounts,
221made by a possessor of that key will be secured with that key.
222
223If a file is opened with a particular key and then the file descriptor is
224passed to a process that doesn't have that key (perhaps over an AF_UNIX
225socket), then the operations on the file will be made with key that was used to
226open the file.
David Howells6f8880d2018-04-09 21:12:31 +0100227
228
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100229The @sys Substitution
David Howells6f8880d2018-04-09 21:12:31 +0100230=====================
231
232The list of up to 16 @sys substitutions for the current network namespace can
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100233be configured by writing a list to /proc/fs/afs/sysname::
David Howells6f8880d2018-04-09 21:12:31 +0100234
235 [root@andromeda ~]# echo foo amd64_linux_26 >/proc/fs/afs/sysname
236
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100237or cleared entirely by writing an empty list::
David Howells6f8880d2018-04-09 21:12:31 +0100238
239 [root@andromeda ~]# echo >/proc/fs/afs/sysname
240
Mauro Carvalho Chehabca6e9042020-02-17 17:11:50 +0100241The current list for current network namespace can be retrieved by::
David Howells6f8880d2018-04-09 21:12:31 +0100242
243 [root@andromeda ~]# cat /proc/fs/afs/sysname
244 foo
245 amd64_linux_26
246
247When @sys is being substituted for, each element of the list is tried in the
248order given.
249
250By default, the list will contain one item that conforms to the pattern
251"<arch>_linux_26", amd64 being the name for x86_64.