grub/tests/ext234_test.in
Eric Biggers 734668238f Allow GRUB to mount ext2/3/4 filesystems that have the encryption feature.
On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set.
For a regular file, this means its contents are encrypted; for a
directory, this means the filenames in its directory entries are
encrypted; and for a symlink, this means its target is encrypted.  Since
GRUB cannot decrypt encrypted contents or filenames, just issue an error
if it would need to do so.  This is sufficient to allow unencrypted boot
files to co-exist with encrypted files elsewhere on the filesystem.

(Note that encrypted regular files and symlinks will not normally be
encountered outside an encrypted directory; however, it's possible via
hard links, so they still need to be handled.)

Tested by booting from an ext4 /boot partition on which I had run
'tune2fs -O encrypt'.  I also verified that the expected error messages
are printed when trying to access encrypted directories, files, and
symlinks from the GRUB command line.  Also ran 'sudo ./grub-fs-tester
ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+.

Signed-off-by: Eric Biggers <ebiggers@google.com>
2017-06-29 13:29:53 +00:00

33 lines
667 B
Text

#!@BUILD_SHEBANG@
set -e
if [ "x$EUID" = "x" ] ; then
EUID=`id -u`
fi
if [ "$EUID" != 0 ] ; then
exit 77
fi
if ! which mkfs.ext2 >/dev/null 2>&1; then
echo "mkfs.ext2 not installed; cannot test ext2."
exit 77
fi
if ! which mkfs.ext3 >/dev/null 2>&1; then
echo "mkfs.ext3 not installed; cannot test ext3."
exit 77
fi
if ! which mkfs.ext4 >/dev/null 2>&1; then
echo "mkfs.ext4 not installed; cannot test ext4."
exit 77
fi
"@builddir@/grub-fs-tester" ext2_old
"@builddir@/grub-fs-tester" ext2
"@builddir@/grub-fs-tester" ext3
"@builddir@/grub-fs-tester" ext4
"@builddir@/grub-fs-tester" ext4_metabg
"@builddir@/grub-fs-tester" ext4_encrypt