18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci==================== 48c2ecf20Sopenharmony_cikAFS: AFS FILESYSTEM 58c2ecf20Sopenharmony_ci==================== 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci.. Contents: 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci - Overview. 108c2ecf20Sopenharmony_ci - Usage. 118c2ecf20Sopenharmony_ci - Mountpoints. 128c2ecf20Sopenharmony_ci - Dynamic root. 138c2ecf20Sopenharmony_ci - Proc filesystem. 148c2ecf20Sopenharmony_ci - The cell database. 158c2ecf20Sopenharmony_ci - Security. 168c2ecf20Sopenharmony_ci - The @sys substitution. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciOverview 208c2ecf20Sopenharmony_ci======== 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciThis filesystem provides a fairly simple secure AFS filesystem driver. It is 238c2ecf20Sopenharmony_ciunder development and does not yet provide the full feature set. The features 248c2ecf20Sopenharmony_ciit does support include: 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci (*) Security (currently only AFS kaserver and KerberosIV tickets). 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci (*) File reading and writing. 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci (*) Automounting. 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci (*) Local caching (via fscache). 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciIt does not yet support the following AFS features: 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci (*) pioctl() system call. 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciCompilation 408c2ecf20Sopenharmony_ci=========== 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciThe filesystem should be enabled by turning on the kernel configuration 438c2ecf20Sopenharmony_cioptions:: 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci CONFIG_AF_RXRPC - The RxRPC protocol transport 468c2ecf20Sopenharmony_ci CONFIG_RXKAD - The RxRPC Kerberos security handler 478c2ecf20Sopenharmony_ci CONFIG_AFS - The AFS filesystem 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciAdditionally, the following can be turned on to aid debugging:: 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci CONFIG_AF_RXRPC_DEBUG - Permit AF_RXRPC debugging to be enabled 528c2ecf20Sopenharmony_ci CONFIG_AFS_DEBUG - Permit AFS debugging to be enabled 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciThey permit the debugging messages to be turned on dynamically by manipulating 558c2ecf20Sopenharmony_cithe masks in the following files:: 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci /sys/module/af_rxrpc/parameters/debug 588c2ecf20Sopenharmony_ci /sys/module/kafs/parameters/debug 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ciUsage 628c2ecf20Sopenharmony_ci===== 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciWhen inserting the driver modules the root cell must be specified along with a 658c2ecf20Sopenharmony_cilist of volume location server IP addresses:: 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci modprobe rxrpc 688c2ecf20Sopenharmony_ci modprobe kafs rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ciThe first module is the AF_RXRPC network protocol driver. This provides the 718c2ecf20Sopenharmony_ciRxRPC remote operation protocol and may also be accessed from userspace. See: 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci Documentation/networking/rxrpc.rst 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ciThe second module is the kerberos RxRPC security driver, and the third module 768c2ecf20Sopenharmony_ciis the actual filesystem driver for the AFS filesystem. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciOnce the module has been loaded, more modules can be added by the following 798c2ecf20Sopenharmony_ciprocedure:: 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ciWhere the parameters to the "add" command are the name of a cell and a list of 848c2ecf20Sopenharmony_civolume location servers within that cell, with the latter separated by colons. 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciFilesystems can be mounted anywhere by commands similar to the following:: 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci mount -t afs "%cambridge.redhat.com:root.afs." /afs 898c2ecf20Sopenharmony_ci mount -t afs "#cambridge.redhat.com:root.cell." /afs/cambridge 908c2ecf20Sopenharmony_ci mount -t afs "#root.afs." /afs 918c2ecf20Sopenharmony_ci mount -t afs "#root.cell." /afs/cambridge 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ciWhere the initial character is either a hash or a percent symbol depending on 948c2ecf20Sopenharmony_ciwhether you definitely want a R/W volume (percent) or whether you'd prefer a 958c2ecf20Sopenharmony_ciR/O volume, but are willing to use a R/W volume instead (hash). 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ciThe name of the volume can be suffixes with ".backup" or ".readonly" to 988c2ecf20Sopenharmony_cispecify connection to only volumes of those types. 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ciThe name of the cell is optional, and if not given during a mount, then the 1018c2ecf20Sopenharmony_cinamed volume will be looked up in the cell specified during modprobe. 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciAdditional cells can be added through /proc (see later section). 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ciMountpoints 1078c2ecf20Sopenharmony_ci=========== 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ciAFS has a concept of mountpoints. In AFS terms, these are specially formatted 1108c2ecf20Sopenharmony_cisymbolic links (of the same form as the "device name" passed to mount). kAFS 1118c2ecf20Sopenharmony_cipresents these to the user as directories that have a follow-link capability 1128c2ecf20Sopenharmony_ci(ie: symbolic link semantics). If anyone attempts to access them, they will 1138c2ecf20Sopenharmony_ciautomatically cause the target volume to be mounted (if possible) on that site. 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ciAutomatically mounted filesystems will be automatically unmounted approximately 1168c2ecf20Sopenharmony_citwenty minutes after they were last used. Alternatively they can be unmounted 1178c2ecf20Sopenharmony_cidirectly with the umount() system call. 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ciManually unmounting an AFS volume will cause any idle submounts upon it to be 1208c2ecf20Sopenharmony_ciculled first. If all are culled, then the requested volume will also be 1218c2ecf20Sopenharmony_ciunmounted, otherwise error EBUSY will be returned. 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ciThis can be used by the administrator to attempt to unmount the whole AFS tree 1248c2ecf20Sopenharmony_cimounted on /afs in one go by doing:: 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci umount /afs 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ciDynamic Root 1308c2ecf20Sopenharmony_ci============ 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ciA mount option is available to create a serverless mount that is only usable 1338c2ecf20Sopenharmony_cifor dynamic lookup. Creating such a mount can be done by, for example:: 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci mount -t afs none /afs -o dyn 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ciThis creates a mount that just has an empty directory at the root. Attempting 1388c2ecf20Sopenharmony_cito look up a name in this directory will cause a mountpoint to be created that 1398c2ecf20Sopenharmony_cilooks up a cell of the same name, for example:: 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci ls /afs/grand.central.org/ 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciProc Filesystem 1458c2ecf20Sopenharmony_ci=============== 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ciThe AFS modules creates a "/proc/fs/afs/" directory and populates it: 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci (*) A "cells" file that lists cells currently known to the afs module and 1508c2ecf20Sopenharmony_ci their usage counts:: 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cells 1538c2ecf20Sopenharmony_ci USE NAME 1548c2ecf20Sopenharmony_ci 3 cambridge.redhat.com 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci (*) A directory per cell that contains files that list volume location 1578c2ecf20Sopenharmony_ci servers, volumes, and active servers known within that cell:: 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/servers 1608c2ecf20Sopenharmony_ci USE ADDR STATE 1618c2ecf20Sopenharmony_ci 4 172.16.18.91 0 1628c2ecf20Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/vlservers 1638c2ecf20Sopenharmony_ci ADDRESS 1648c2ecf20Sopenharmony_ci 172.16.18.91 1658c2ecf20Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/volumes 1668c2ecf20Sopenharmony_ci USE STT VLID[0] VLID[1] VLID[2] NAME 1678c2ecf20Sopenharmony_ci 1 Val 20000000 20000001 20000002 root.afs 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ciThe Cell Database 1718c2ecf20Sopenharmony_ci================= 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ciThe filesystem maintains an internal database of all the cells it knows and the 1748c2ecf20Sopenharmony_ciIP addresses of the volume location servers for those cells. The cell to which 1758c2ecf20Sopenharmony_cithe system belongs is added to the database when modprobe is performed by the 1768c2ecf20Sopenharmony_ci"rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on 1778c2ecf20Sopenharmony_cithe kernel command line. 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ciFurther cells can be added by commands similar to the following:: 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells 1828c2ecf20Sopenharmony_ci echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ciNo other cell database operations are available at this time. 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ciSecurity 1888c2ecf20Sopenharmony_ci======== 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ciSecure operations are initiated by acquiring a key using the klog program. A 1918c2ecf20Sopenharmony_civery primitive klog program is available at: 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci https://people.redhat.com/~dhowells/rxrpc/klog.c 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ciThis should be compiled by:: 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci make klog LDLIBS="-lcrypto -lcrypt -lkrb4 -lkeyutils" 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ciAnd then run as:: 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci ./klog 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ciAssuming it's successful, this adds a key of type RxRPC, named for the service 2048c2ecf20Sopenharmony_ciand cell, eg: "afs@<cellname>". This can be viewed with the keyctl program or 2058c2ecf20Sopenharmony_ciby cat'ing /proc/keys:: 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci [root@andromeda ~]# keyctl show 2088c2ecf20Sopenharmony_ci Session Keyring 2098c2ecf20Sopenharmony_ci -3 --alswrv 0 0 keyring: _ses.3268 2108c2ecf20Sopenharmony_ci 2 --alswrv 0 0 \_ keyring: _uid.0 2118c2ecf20Sopenharmony_ci 111416553 --als--v 0 0 \_ rxrpc: afs@CAMBRIDGE.REDHAT.COM 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ciCurrently the username, realm, password and proposed ticket lifetime are 2148c2ecf20Sopenharmony_cicompiled in to the program. 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ciIt is not required to acquire a key before using AFS facilities, but if one is 2178c2ecf20Sopenharmony_cinot acquired then all operations will be governed by the anonymous user parts 2188c2ecf20Sopenharmony_ciof the ACLs. 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ciIf a key is acquired, then all AFS operations, including mounts and automounts, 2218c2ecf20Sopenharmony_cimade by a possessor of that key will be secured with that key. 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ciIf a file is opened with a particular key and then the file descriptor is 2248c2ecf20Sopenharmony_cipassed to a process that doesn't have that key (perhaps over an AF_UNIX 2258c2ecf20Sopenharmony_cisocket), then the operations on the file will be made with key that was used to 2268c2ecf20Sopenharmony_ciopen the file. 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ciThe @sys Substitution 2308c2ecf20Sopenharmony_ci===================== 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ciThe list of up to 16 @sys substitutions for the current network namespace can 2338c2ecf20Sopenharmony_cibe configured by writing a list to /proc/fs/afs/sysname:: 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci [root@andromeda ~]# echo foo amd64_linux_26 >/proc/fs/afs/sysname 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_cior cleared entirely by writing an empty list:: 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci [root@andromeda ~]# echo >/proc/fs/afs/sysname 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ciThe current list for current network namespace can be retrieved by:: 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/sysname 2448c2ecf20Sopenharmony_ci foo 2458c2ecf20Sopenharmony_ci amd64_linux_26 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ciWhen @sys is being substituted for, each element of the list is tried in the 2488c2ecf20Sopenharmony_ciorder given. 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ciBy default, the list will contain one item that conforms to the pattern 2518c2ecf20Sopenharmony_ci"<arch>_linux_26", amd64 being the name for x86_64. 252