forked from containers/composefs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mount: Add support for validating fs-verity signatures on images.
This works by using the build-in fs-verity signatures and the kernel keyring. When you open any file that has fs-verity enabled with a signature the kernel verifies its signature against the keys in the kernel .fs-verity keyring. If the required key is not in the keychain then open will fail. So, to work with this we just ensure that the file is open (i.e. we have an fd to it), it has fs-verity enabled, and there is a signature for the file. If this is all true we must have the valid key in the keyring. To test this, do something like this: Generate keys and sign image: openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -out cert.pem fsverity sign image.composefs image.composefs.sig --key=key.pem --cert=cert.pem Load the certificate into the fs-verity keyring: openssl x509 -in cert.pem -out cert.der -outform der keyctl padd asymmetric '' %keyring:.fs-verity < cert.der Optionally, lock the keyring so that no more keys can be added: keyctl restrict_keyring %keyring:.fs-verity Sign the image: fsverity enable image.composefs --signature=image.composefs.sig Mount the image with the `signed` option: mount -t composefs -o basedir=objects,signed image.composefs mnt This will only succeed if image.composefs is signed with a key, and the matching cert is loaded in the keyring. Fixes: containers#101 Signed-off-by: Alexander Larsson <[email protected]>
- Loading branch information
1 parent
356a60e
commit f3e3a7f
Showing
3 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters