- C 96.1%
- Ada 2.7%
- Shell 0.7%
- Python 0.4%
- Makefile 0.1%
Every open file of a namespace now holds the logon key it was opened with; every read, write, splice and mmap fault checks it with key_validate. Once the key is revoked (vaultfs-seal) or expired (an unseal's --timeout) they fail with EKEYREVOKED or EKEYEXPIRED, an mmap fault with SIGBUS. The file's vm_operations have no map_pages, so every page mapped into a process goes through that check. VAULTFS_IOC_SEAL (3) writes back, unmaps and drops the page cache of the namespace's files, found among the superblock's inodes by the key id their context now records. Since it only empties a cache and nobody holds the key once revoked, it is open to anyone who could open the directory; FORMAT.md said 'a holder of the key' and is changed. vaultfs-seal [--force] PATH lists the namespace's files that processes have open or mapped (scanned from /proc by the C layer with readdir; GNAT's Start_Search saw no entries in /proc/PID/fd), asks on the terminal unless --force, revokes the key, then calls the ioctl and says how many files left memory. tests/vm/cut.sh: a process reading and writing through a descriptor and one through mmap, both open across the seal: listed and kept on a no; with --force the descriptor gets EKEYREVOKED for read and write and the mapping SIGBUS, new opens ENOKEY; after a 2-second timeout an open file gets EKEYEXPIRED; a second session with its own unseal goes on reading and writing after the first seals. All host and VM tests pass. |
||
|---|---|---|
| include/uapi | ||
| kernel | ||
| LICENSES | ||
| tests | ||
| testvectors | ||
| tools | ||
| .gitignore | ||
| FORMAT.md | ||
| Makefile | ||
| MANUAL.md | ||
| README.md | ||
vaultfs
An encrypted filesystem for Linux where every directory is a vault of its own: a namespace with its own keys, opened with a key file and its passphrase, for your login session only. It is a kernel module over a dedicated XFS volume, mounted with the module's own copy of XFS, with userspace tools in Ada/SPARK.
- Contents are encrypted and authenticated (AES-256-GCM): tampering is detected, never read as data.
- A namespace can be opened while its parent stays closed; a closed one cannot be read or changed, by anyone, root included.
- Names and the tree's shape stay visible, by design.
- A vaultfs volume can only be mounted as vaultfs, never as plain XFS.
Status: early. The tools make key files and vaultfs volumes (shared or
with a sealed root) and guard their flag; the module mounts a volume,
namespaces are unsealed for a login session, and files in them are read
and written encrypted. Directories as namespaces (mkdir,
createnamespace) come next.
The design is in FORMAT.md (on-disk formats) and MANUAL.md (how the
tools are used).
Layout
| Path | What | License |
|---|---|---|
kernel/ |
the module, C, and its XFS copy (kernel/xfs/<version>/) |
GPL-2.0 |
include/uapi/ |
the interface shared by module and tools | GPL-2.0 WITH Linux-syscall-note |
tools/ |
the userspace tools, Ada/SPARK, C shim | EUPL-1.2 |
testvectors/ |
format test vectors shared by both sides | EUPL-1.2 |
tests/ |
VM and crash-consistency tests | EUPL-1.2 |
FORMAT.md, MANUAL.md |
documentation | EUPL-1.2 |
Each file names its license in an SPDX-License-Identifier line; the texts
are in LICENSES/. The module is GPL-2.0 because the kernel interfaces it
needs are exported to GPL modules only.
Building
make kernel # kernel/vaultfs.ko for the running kernel (load it in a VM only)
make tools # tools/bin/, needs GNAT, gprbuild, libssl-dev, libkeyutils-dev
make test # the tools' unit tests, against testvectors/
make prove # the SPARK proofs of the tools
tests/vm/run.sh # the module in the test VM (tests/vm/README.md)
Target: Linux 7.0 and later, XFS V5, internal disks.