2020-02-17 19:11:50 +03:00
|
|
|
.. SPDX-License-Identifier: GPL-2.0
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
====================
|
|
|
|
kAFS: AFS FILESYSTEM
|
|
|
|
====================
|
|
|
|
|
|
|
|
.. Contents:
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
- Overview.
|
|
|
|
- Usage.
|
|
|
|
- Mountpoints.
|
2018-02-06 09:26:30 +03:00
|
|
|
- Dynamic root.
|
2007-04-27 02:57:43 +04:00
|
|
|
- Proc filesystem.
|
|
|
|
- The cell database.
|
|
|
|
- Security.
|
2018-04-09 23:12:31 +03:00
|
|
|
- The @sys substitution.
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Overview
|
2007-04-27 02:57:43 +04:00
|
|
|
========
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
This filesystem provides a fairly simple secure AFS filesystem driver. It is
|
|
|
|
under development and does not yet provide the full feature set. The features
|
|
|
|
it does support include:
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
(*) Security (currently only AFS kaserver and KerberosIV tickets).
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2009-08-19 19:10:16 +04:00
|
|
|
(*) File reading and writing.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
(*) Automounting.
|
|
|
|
|
2009-08-19 19:10:16 +04:00
|
|
|
(*) Local caching (via fscache).
|
2007-04-27 02:57:43 +04:00
|
|
|
|
2009-08-19 19:10:16 +04:00
|
|
|
It does not yet support the following AFS features:
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
(*) pioctl() system call.
|
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Compilation
|
2007-04-27 02:57:43 +04:00
|
|
|
===========
|
|
|
|
|
|
|
|
The filesystem should be enabled by turning on the kernel configuration
|
2020-02-17 19:11:50 +03:00
|
|
|
options::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
CONFIG_AF_RXRPC - The RxRPC protocol transport
|
|
|
|
CONFIG_RXKAD - The RxRPC Kerberos security handler
|
|
|
|
CONFIG_AFS - The AFS filesystem
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Additionally, the following can be turned on to aid debugging::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
CONFIG_AF_RXRPC_DEBUG - Permit AF_RXRPC debugging to be enabled
|
|
|
|
CONFIG_AFS_DEBUG - Permit AFS debugging to be enabled
|
|
|
|
|
|
|
|
They permit the debugging messages to be turned on dynamically by manipulating
|
2020-02-17 19:11:50 +03:00
|
|
|
the masks in the following files::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
/sys/module/af_rxrpc/parameters/debug
|
2009-08-19 19:10:16 +04:00
|
|
|
/sys/module/kafs/parameters/debug
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Usage
|
2005-04-17 02:20:36 +04:00
|
|
|
=====
|
|
|
|
|
|
|
|
When inserting the driver modules the root cell must be specified along with a
|
2020-02-17 19:11:50 +03:00
|
|
|
list of volume location server IP addresses::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2017-02-17 21:16:21 +03:00
|
|
|
modprobe rxrpc
|
2009-08-19 19:10:16 +04:00
|
|
|
modprobe kafs rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
The first module is the AF_RXRPC network protocol driver. This provides the
|
|
|
|
RxRPC remote operation protocol and may also be accessed from userspace. See:
|
|
|
|
|
2020-04-30 19:04:21 +03:00
|
|
|
Documentation/networking/rxrpc.rst
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
The second module is the kerberos RxRPC security driver, and the third module
|
|
|
|
is the actual filesystem driver for the AFS filesystem.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
Once the module has been loaded, more modules can be added by the following
|
2020-02-17 19:11:50 +03:00
|
|
|
procedure::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2009-08-19 19:10:16 +04:00
|
|
|
echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
Where the parameters to the "add" command are the name of a cell and a list of
|
2007-04-27 02:57:43 +04:00
|
|
|
volume location servers within that cell, with the latter separated by colons.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Filesystems can be mounted anywhere by commands similar to the following::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
mount -t afs "%cambridge.redhat.com:root.afs." /afs
|
|
|
|
mount -t afs "#cambridge.redhat.com:root.cell." /afs/cambridge
|
|
|
|
mount -t afs "#root.afs." /afs
|
|
|
|
mount -t afs "#root.cell." /afs/cambridge
|
|
|
|
|
|
|
|
Where the initial character is either a hash or a percent symbol depending on
|
2017-11-02 18:27:51 +03:00
|
|
|
whether you definitely want a R/W volume (percent) or whether you'd prefer a
|
|
|
|
R/O volume, but are willing to use a R/W volume instead (hash).
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
The name of the volume can be suffixes with ".backup" or ".readonly" to
|
|
|
|
specify connection to only volumes of those types.
|
|
|
|
|
|
|
|
The name of the cell is optional, and if not given during a mount, then the
|
2009-08-19 19:10:16 +04:00
|
|
|
named volume will be looked up in the cell specified during modprobe.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
Additional cells can be added through /proc (see later section).
|
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Mountpoints
|
2005-04-17 02:20:36 +04:00
|
|
|
===========
|
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
AFS has a concept of mountpoints. In AFS terms, these are specially formatted
|
|
|
|
symbolic links (of the same form as the "device name" passed to mount). kAFS
|
|
|
|
presents these to the user as directories that have a follow-link capability
|
|
|
|
(ie: symbolic link semantics). If anyone attempts to access them, they will
|
|
|
|
automatically cause the target volume to be mounted (if possible) on that site.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
Automatically mounted filesystems will be automatically unmounted approximately
|
|
|
|
twenty minutes after they were last used. Alternatively they can be unmounted
|
|
|
|
directly with the umount() system call.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
Manually unmounting an AFS volume will cause any idle submounts upon it to be
|
|
|
|
culled first. If all are culled, then the requested volume will also be
|
|
|
|
unmounted, otherwise error EBUSY will be returned.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
This can be used by the administrator to attempt to unmount the whole AFS tree
|
2020-02-17 19:11:50 +03:00
|
|
|
mounted on /afs in one go by doing::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
umount /afs
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Dynamic Root
|
2018-02-06 09:26:30 +03:00
|
|
|
============
|
|
|
|
|
|
|
|
A mount option is available to create a serverless mount that is only usable
|
2020-02-17 19:11:50 +03:00
|
|
|
for dynamic lookup. Creating such a mount can be done by, for example::
|
2018-02-06 09:26:30 +03:00
|
|
|
|
|
|
|
mount -t afs none /afs -o dyn
|
|
|
|
|
|
|
|
This creates a mount that just has an empty directory at the root. Attempting
|
|
|
|
to look up a name in this directory will cause a mountpoint to be created that
|
2020-02-17 19:11:50 +03:00
|
|
|
looks up a cell of the same name, for example::
|
2018-02-06 09:26:30 +03:00
|
|
|
|
|
|
|
ls /afs/grand.central.org/
|
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Proc Filesystem
|
2005-04-17 02:20:36 +04:00
|
|
|
===============
|
|
|
|
|
|
|
|
The AFS modules creates a "/proc/fs/afs/" directory and populates it:
|
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
(*) A "cells" file that lists cells currently known to the afs module and
|
2020-02-17 19:11:50 +03:00
|
|
|
their usage counts::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
[root@andromeda ~]# cat /proc/fs/afs/cells
|
|
|
|
USE NAME
|
|
|
|
3 cambridge.redhat.com
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
(*) A directory per cell that contains files that list volume location
|
2020-02-17 19:11:50 +03:00
|
|
|
servers, volumes, and active servers known within that cell::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
[root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/servers
|
|
|
|
USE ADDR STATE
|
|
|
|
4 172.16.18.91 0
|
|
|
|
[root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/vlservers
|
|
|
|
ADDRESS
|
|
|
|
172.16.18.91
|
|
|
|
[root@andromeda ~]# cat /proc/fs/afs/cambridge.redhat.com/volumes
|
|
|
|
USE STT VLID[0] VLID[1] VLID[2] NAME
|
|
|
|
1 Val 20000000 20000001 20000002 root.afs
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
The Cell Database
|
2005-04-17 02:20:36 +04:00
|
|
|
=================
|
|
|
|
|
2007-04-27 02:57:43 +04:00
|
|
|
The filesystem maintains an internal database of all the cells it knows and the
|
|
|
|
IP addresses of the volume location servers for those cells. The cell to which
|
2009-08-19 19:10:16 +04:00
|
|
|
the system belongs is added to the database when modprobe is performed by the
|
2007-04-27 02:57:43 +04:00
|
|
|
"rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on
|
|
|
|
the kernel command line.
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Further cells can be added by commands similar to the following::
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells
|
2009-08-19 19:10:16 +04:00
|
|
|
echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
No other cell database operations are available at this time.
|
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
Security
|
2007-04-27 02:57:43 +04:00
|
|
|
========
|
|
|
|
|
|
|
|
Secure operations are initiated by acquiring a key using the klog program. A
|
|
|
|
very primitive klog program is available at:
|
|
|
|
|
|
|
|
http://people.redhat.com/~dhowells/rxrpc/klog.c
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
This should be compiled by::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
make klog LDLIBS="-lcrypto -lcrypt -lkrb4 -lkeyutils"
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
And then run as::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
./klog
|
|
|
|
|
|
|
|
Assuming it's successful, this adds a key of type RxRPC, named for the service
|
|
|
|
and cell, eg: "afs@<cellname>". This can be viewed with the keyctl program or
|
2020-02-17 19:11:50 +03:00
|
|
|
by cat'ing /proc/keys::
|
2007-04-27 02:57:43 +04:00
|
|
|
|
|
|
|
[root@andromeda ~]# keyctl show
|
|
|
|
Session Keyring
|
|
|
|
-3 --alswrv 0 0 keyring: _ses.3268
|
|
|
|
2 --alswrv 0 0 \_ keyring: _uid.0
|
|
|
|
111416553 --als--v 0 0 \_ rxrpc: afs@CAMBRIDGE.REDHAT.COM
|
|
|
|
|
|
|
|
Currently the username, realm, password and proposed ticket lifetime are
|
|
|
|
compiled in to the program.
|
|
|
|
|
|
|
|
It is not required to acquire a key before using AFS facilities, but if one is
|
|
|
|
not acquired then all operations will be governed by the anonymous user parts
|
|
|
|
of the ACLs.
|
|
|
|
|
|
|
|
If a key is acquired, then all AFS operations, including mounts and automounts,
|
|
|
|
made by a possessor of that key will be secured with that key.
|
|
|
|
|
|
|
|
If a file is opened with a particular key and then the file descriptor is
|
|
|
|
passed to a process that doesn't have that key (perhaps over an AF_UNIX
|
|
|
|
socket), then the operations on the file will be made with key that was used to
|
|
|
|
open the file.
|
2018-04-09 23:12:31 +03:00
|
|
|
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
The @sys Substitution
|
2018-04-09 23:12:31 +03:00
|
|
|
=====================
|
|
|
|
|
|
|
|
The list of up to 16 @sys substitutions for the current network namespace can
|
2020-02-17 19:11:50 +03:00
|
|
|
be configured by writing a list to /proc/fs/afs/sysname::
|
2018-04-09 23:12:31 +03:00
|
|
|
|
|
|
|
[root@andromeda ~]# echo foo amd64_linux_26 >/proc/fs/afs/sysname
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
or cleared entirely by writing an empty list::
|
2018-04-09 23:12:31 +03:00
|
|
|
|
|
|
|
[root@andromeda ~]# echo >/proc/fs/afs/sysname
|
|
|
|
|
2020-02-17 19:11:50 +03:00
|
|
|
The current list for current network namespace can be retrieved by::
|
2018-04-09 23:12:31 +03:00
|
|
|
|
|
|
|
[root@andromeda ~]# cat /proc/fs/afs/sysname
|
|
|
|
foo
|
|
|
|
amd64_linux_26
|
|
|
|
|
|
|
|
When @sys is being substituted for, each element of the list is tried in the
|
|
|
|
order given.
|
|
|
|
|
|
|
|
By default, the list will contain one item that conforms to the pattern
|
|
|
|
"<arch>_linux_26", amd64 being the name for x86_64.
|