162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci==================== 462306a36Sopenharmony_cikAFS: AFS FILESYSTEM 562306a36Sopenharmony_ci==================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci.. Contents: 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci - Overview. 1062306a36Sopenharmony_ci - Usage. 1162306a36Sopenharmony_ci - Mountpoints. 1262306a36Sopenharmony_ci - Dynamic root. 1362306a36Sopenharmony_ci - Proc filesystem. 1462306a36Sopenharmony_ci - The cell database. 1562306a36Sopenharmony_ci - Security. 1662306a36Sopenharmony_ci - The @sys substitution. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciOverview 2062306a36Sopenharmony_ci======== 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciThis filesystem provides a fairly simple secure AFS filesystem driver. It is 2362306a36Sopenharmony_ciunder development and does not yet provide the full feature set. The features 2462306a36Sopenharmony_ciit does support include: 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci (*) Security (currently only AFS kaserver and KerberosIV tickets). 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci (*) File reading and writing. 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci (*) Automounting. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci (*) Local caching (via fscache). 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciIt does not yet support the following AFS features: 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci (*) pioctl() system call. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciCompilation 4062306a36Sopenharmony_ci=========== 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciThe filesystem should be enabled by turning on the kernel configuration 4362306a36Sopenharmony_cioptions:: 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci CONFIG_AF_RXRPC - The RxRPC protocol transport 4662306a36Sopenharmony_ci CONFIG_RXKAD - The RxRPC Kerberos security handler 4762306a36Sopenharmony_ci CONFIG_AFS_FS - The AFS filesystem 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ciAdditionally, the following can be turned on to aid debugging:: 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci CONFIG_AF_RXRPC_DEBUG - Permit AF_RXRPC debugging to be enabled 5262306a36Sopenharmony_ci CONFIG_AFS_DEBUG - Permit AFS debugging to be enabled 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciThey permit the debugging messages to be turned on dynamically by manipulating 5562306a36Sopenharmony_cithe masks in the following files:: 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci /sys/module/af_rxrpc/parameters/debug 5862306a36Sopenharmony_ci /sys/module/kafs/parameters/debug 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciUsage 6262306a36Sopenharmony_ci===== 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ciWhen inserting the driver modules the root cell must be specified along with a 6562306a36Sopenharmony_cilist of volume location server IP addresses:: 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci modprobe rxrpc 6862306a36Sopenharmony_ci modprobe kafs rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciThe first module is the AF_RXRPC network protocol driver. This provides the 7162306a36Sopenharmony_ciRxRPC remote operation protocol and may also be accessed from userspace. See: 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci Documentation/networking/rxrpc.rst 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciThe second module is the kerberos RxRPC security driver, and the third module 7662306a36Sopenharmony_ciis the actual filesystem driver for the AFS filesystem. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ciOnce the module has been loaded, more modules can be added by the following 7962306a36Sopenharmony_ciprocedure:: 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ciWhere the parameters to the "add" command are the name of a cell and a list of 8462306a36Sopenharmony_civolume location servers within that cell, with the latter separated by colons. 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciFilesystems can be mounted anywhere by commands similar to the following:: 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci mount -t afs "%cambridge.redhat.com:root.afs." /afs 8962306a36Sopenharmony_ci mount -t afs "#cambridge.redhat.com:root.cell." /afs/cambridge 9062306a36Sopenharmony_ci mount -t afs "#root.afs." /afs 9162306a36Sopenharmony_ci mount -t afs "#root.cell." /afs/cambridge 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ciWhere the initial character is either a hash or a percent symbol depending on 9462306a36Sopenharmony_ciwhether you definitely want a R/W volume (percent) or whether you'd prefer a 9562306a36Sopenharmony_ciR/O volume, but are willing to use a R/W volume instead (hash). 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ciThe name of the volume can be suffixes with ".backup" or ".readonly" to 9862306a36Sopenharmony_cispecify connection to only volumes of those types. 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ciThe name of the cell is optional, and if not given during a mount, then the 10162306a36Sopenharmony_cinamed volume will be looked up in the cell specified during modprobe. 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ciAdditional cells can be added through /proc (see later section). 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ciMountpoints 10762306a36Sopenharmony_ci=========== 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ciAFS has a concept of mountpoints. In AFS terms, these are specially formatted 11062306a36Sopenharmony_cisymbolic links (of the same form as the "device name" passed to mount). kAFS 11162306a36Sopenharmony_cipresents these to the user as directories that have a follow-link capability 11262306a36Sopenharmony_ci(i.e.: symbolic link semantics). If anyone attempts to access them, they will 11362306a36Sopenharmony_ciautomatically cause the target volume to be mounted (if possible) on that site. 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ciAutomatically mounted filesystems will be automatically unmounted approximately 11662306a36Sopenharmony_citwenty minutes after they were last used. Alternatively they can be unmounted 11762306a36Sopenharmony_cidirectly with the umount() system call. 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ciManually unmounting an AFS volume will cause any idle submounts upon it to be 12062306a36Sopenharmony_ciculled first. If all are culled, then the requested volume will also be 12162306a36Sopenharmony_ciunmounted, otherwise error EBUSY will be returned. 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ciThis can be used by the administrator to attempt to unmount the whole AFS tree 12462306a36Sopenharmony_cimounted on /afs in one go by doing:: 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci umount /afs 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ciDynamic Root 13062306a36Sopenharmony_ci============ 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ciA mount option is available to create a serverless mount that is only usable 13362306a36Sopenharmony_cifor dynamic lookup. Creating such a mount can be done by, for example:: 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci mount -t afs none /afs -o dyn 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ciThis creates a mount that just has an empty directory at the root. Attempting 13862306a36Sopenharmony_cito look up a name in this directory will cause a mountpoint to be created that 13962306a36Sopenharmony_cilooks up a cell of the same name, for example:: 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci ls /afs/grand.central.org/ 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ciProc Filesystem 14562306a36Sopenharmony_ci=============== 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ciThe AFS module creates a "/proc/fs/afs/" directory and populates it: 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci (*) A "cells" file that lists cells currently known to the afs module and 15062306a36Sopenharmony_ci their usage counts:: 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cells 15362306a36Sopenharmony_ci USE NAME 15462306a36Sopenharmony_ci 3 cambridge.redhat.com 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci (*) A directory per cell that contains files that list volume location 15762306a36Sopenharmony_ci servers, volumes, and active servers known within that cell:: 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/servers 16062306a36Sopenharmony_ci USE ADDR STATE 16162306a36Sopenharmony_ci 4 172.16.18.91 0 16262306a36Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/vlservers 16362306a36Sopenharmony_ci ADDRESS 16462306a36Sopenharmony_ci 172.16.18.91 16562306a36Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/volumes 16662306a36Sopenharmony_ci USE STT VLID[0] VLID[1] VLID[2] NAME 16762306a36Sopenharmony_ci 1 Val 20000000 20000001 20000002 root.afs 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ciThe Cell Database 17162306a36Sopenharmony_ci================= 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ciThe filesystem maintains an internal database of all the cells it knows and the 17462306a36Sopenharmony_ciIP addresses of the volume location servers for those cells. The cell to which 17562306a36Sopenharmony_cithe system belongs is added to the database when modprobe is performed by the 17662306a36Sopenharmony_ci"rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on 17762306a36Sopenharmony_cithe kernel command line. 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ciFurther cells can be added by commands similar to the following:: 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ci echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells 18262306a36Sopenharmony_ci echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ciNo other cell database operations are available at this time. 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ciSecurity 18862306a36Sopenharmony_ci======== 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ciSecure operations are initiated by acquiring a key using the klog program. A 19162306a36Sopenharmony_civery primitive klog program is available at: 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci https://people.redhat.com/~dhowells/rxrpc/klog.c 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ciThis should be compiled by:: 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci make klog LDLIBS="-lcrypto -lcrypt -lkrb4 -lkeyutils" 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ciAnd then run as:: 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci ./klog 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ciAssuming it's successful, this adds a key of type RxRPC, named for the service 20462306a36Sopenharmony_ciand cell, e.g.: "afs@<cellname>". This can be viewed with the keyctl program or 20562306a36Sopenharmony_ciby cat'ing /proc/keys:: 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci [root@andromeda ~]# keyctl show 20862306a36Sopenharmony_ci Session Keyring 20962306a36Sopenharmony_ci -3 --alswrv 0 0 keyring: _ses.3268 21062306a36Sopenharmony_ci 2 --alswrv 0 0 \_ keyring: _uid.0 21162306a36Sopenharmony_ci 111416553 --als--v 0 0 \_ rxrpc: afs@CAMBRIDGE.REDHAT.COM 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ciCurrently the username, realm, password and proposed ticket lifetime are 21462306a36Sopenharmony_cicompiled into the program. 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ciIt is not required to acquire a key before using AFS facilities, but if one is 21762306a36Sopenharmony_cinot acquired then all operations will be governed by the anonymous user parts 21862306a36Sopenharmony_ciof the ACLs. 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ciIf a key is acquired, then all AFS operations, including mounts and automounts, 22162306a36Sopenharmony_cimade by a possessor of that key will be secured with that key. 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ciIf a file is opened with a particular key and then the file descriptor is 22462306a36Sopenharmony_cipassed to a process that doesn't have that key (perhaps over an AF_UNIX 22562306a36Sopenharmony_cisocket), then the operations on the file will be made with key that was used to 22662306a36Sopenharmony_ciopen the file. 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ciThe @sys Substitution 23062306a36Sopenharmony_ci===================== 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ciThe list of up to 16 @sys substitutions for the current network namespace can 23362306a36Sopenharmony_cibe configured by writing a list to /proc/fs/afs/sysname:: 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci [root@andromeda ~]# echo foo amd64_linux_26 >/proc/fs/afs/sysname 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_cior cleared entirely by writing an empty list:: 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci [root@andromeda ~]# echo >/proc/fs/afs/sysname 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ciThe current list for current network namespace can be retrieved by:: 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci [root@andromeda ~]# cat /proc/fs/afs/sysname 24462306a36Sopenharmony_ci foo 24562306a36Sopenharmony_ci amd64_linux_26 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ciWhen @sys is being substituted for, each element of the list is tried in the 24862306a36Sopenharmony_ciorder given. 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ciBy default, the list will contain one item that conforms to the pattern 25162306a36Sopenharmony_ci"<arch>_linux_26", amd64 being the name for x86_64. 252