Whamcloud - gitweb
LU-16374 ldiskfs: implement security.encdata xattr 56/49456/13
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 20 Dec 2022 14:40:52 +0000 (15:40 +0100)
committerOleg Drokin <green@whamcloud.com>
Thu, 31 Aug 2023 06:28:45 +0000 (06:28 +0000)
commitd0a722cb8fb886380e24e8261e8efca09a3262d6
treeddfec2d2638e773bd6c8cb962a8f4fb9000d988f
parentfe5706e0c19f96e4f821790004f05ab265002e9d
LU-16374 ldiskfs: implement security.encdata xattr

security.encdata is a virtual xattr containing information related
to encrypted files. It is expressed as ASCII text with a "key: value"
format, and space as field separator. For instance:

   { encoding: base64url, size: 3012, enc_ctx: YWJjZGVmZ2hpamtsbW
   5vcHFyc3R1dnd4eXphYmNkZWZnaGlqa2xtbg, enc_name: ZmlsZXdpdGh2ZX
   J5bG9uZ25hbWVmaWxld2l0aHZlcnlsb25nbmFtZWZpbGV3aXRodmVyeWxvbmdu
   YW1lZmlsZXdpdGg }

'encoding' is the encoding method used for binary data, assume name
can be up to 255 chars.
'size' is the clear text file data length in bytes.
'enc_ctx' is encoded encryption context, 40 bytes for v2.
'enc_name' is encoded encrypted name, 256 bytes max.
So on overall, this xattr is at most 727 chars plus terminating '0'.

On get, the value of the security.encdata xattr is computed from
encrypted file's information.
On set, encrypted file's information is restored from xattr value.
The encrypted name is stored temporarily in a dedicated xattr
LDISKFS_XATTR_NAME_RAWENCNAME, that will be used to set correct name
at linkat.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Ia318c39d403b1c448e71bcd5b29862d022d05d0a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49456
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
ldiskfs/kernel_patches/patches/rhel7.9/ext4-encdata.patch
ldiskfs/kernel_patches/patches/rhel7.9/ext4-filename-encode.patch
ldiskfs/kernel_patches/patches/rhel8/ext4-encdata.patch