|
| 1 | +# Encrypted virtual File System with TDX-RA |
| 2 | + |
| 3 | +[Intel TDX (Trust Domain Extensions)](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html) technology provides `runtime` security for VMs through hardware encryption. This solution aims to provide `storage security` (via [LUKS](https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup)) and `remote attestation` (via [gRPC-RA-TLS](https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/grpc-ra-tls)) enhancements for `Intel TDX`. |
| 4 | + |
| 5 | +## Introduction |
| 6 | + |
| 7 | +Intel TDX is a CPU hardware-based isolation and encryption technology that provides runtime data security (such as CPU registers, memory data, and interrupt injection) for services within a TDX VM instance. Intel® TDX provides default out-of-the-box protection for your instances and applications. You can migrate existing applications to TDX instances to secure them without modifying application code. |
| 8 | + |
| 9 | +The `LUKS` (Linux Unified Key Setup) is a disk encryption specification created by Clemens Fruhwirth in 2004 and was originally intended for Linux. LUKS is used to encrypt a block device. The contents of the encrypted device are arbitrary, and therefore any filesystem can be encrypted, including swap partitions. The `LUKS` implements a platform-independent standard on-disk format for use in various tools. This not only facilitates compatibility and interoperability among different programs, but also assures that they all implement password management in a secure and documented manner. |
| 10 | + |
| 11 | +The `gRPC-RA-TLS` technology provide identity authentication and key transmission support for LUKS, which simplifies the process of decrypting and mounting, and allow it to be safely and automatically deployed. |
| 12 | + |
| 13 | +## Architecture |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +On the trusted side, users use secret keys to create encrypted block files, store secret data into it, and then deploy the `get secret` service to manage the keys. |
| 18 | + |
| 19 | +The user copies the encrypted block file from the trusted end to the non-trusted end. |
| 20 | + |
| 21 | +On the untrustworthy side, the `LUKS storage service` communicates with the trusted side for attestation and getting the key, then decrypts and mounts the block file through the key, so that the application can safely read the data from the mounting path. |
| 22 | + |
| 23 | +## Deployment |
| 24 | + |
| 25 | +### Setup LUKS environment |
| 26 | + |
| 27 | +``` |
| 28 | +# for centos |
| 29 | +yum install cryptsetup |
| 30 | +
|
| 31 | +# for ubuntu |
| 32 | +apt install cryptsetup |
| 33 | +``` |
| 34 | + |
| 35 | +### Create encrypted block file |
| 36 | + |
| 37 | +This command will create luks block file and bind it to a idle loop device. |
| 38 | + |
| 39 | +``` |
| 40 | +VIRTUAL_FS=/root/vfs |
| 41 | +./create_encrypted_vfs.sh ${VIRTUAL_FS} |
| 42 | +``` |
| 43 | + |
| 44 | +After above, user need to create env `LOOP_DEVICE` to bind to the loop device manually. |
| 45 | + |
| 46 | +``` |
| 47 | +export LOOP_DEVICE=<the binded loop device in outputs> |
| 48 | +``` |
| 49 | + |
| 50 | +### Mount encrypted block file |
| 51 | + |
| 52 | +- Mount and format via password |
| 53 | + |
| 54 | + The block loop device needs to be formatted as `ext4` on first mount. |
| 55 | + |
| 56 | + ``` |
| 57 | + FS_DIR=luks_fs |
| 58 | + ./mount_encrypted_vfs.sh ${LOOP_DEVICE} ${FS_DIR} format |
| 59 | + ``` |
| 60 | +
|
| 61 | + `Note`: only need to format device on first mount. |
| 62 | +
|
| 63 | +- Mount without format via password |
| 64 | +
|
| 65 | + ``` |
| 66 | + FS_DIR=luks_fs |
| 67 | + ./unmount_encrypted_vfs.sh ${VIRTUAL_FS} ${FS_DIR} |
| 68 | + ./mount_encrypted_vfs.sh ${LOOP_DEVICE} ${FS_DIR} notformat |
| 69 | + ``` |
| 70 | +
|
| 71 | +- Mount without format via `gRPC-ra-tls` |
| 72 | +
|
| 73 | + 1. build `get_secret` service and copy runtime. |
| 74 | +
|
| 75 | + refer to [get_secret/README.md](https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/tdx-encrypted-vfs/get_secret/README.md) for detail. |
| 76 | +
|
| 77 | + 2. start `get_secret` service. |
| 78 | +
|
| 79 | + refer to [get_secret/README.md](https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/tdx-encrypted-vfs/get_secret/README.md) for detail. |
| 80 | +
|
| 81 | + 3. mount with `get_secret` service. |
| 82 | +
|
| 83 | + ``` |
| 84 | + FS_DIR=luks_fs |
| 85 | + ./unmount_encrypted_vfs.sh ${VIRTUAL_FS} ${FS_DIR} |
| 86 | +
|
| 87 | + export hostname=localhost:50051 |
| 88 | + ./mount_encrypted_vfs.sh ${LOOP_DEVICE} ${FS_DIR} notformat get_secret |
| 89 | + ``` |
| 90 | +
|
| 91 | +## Cloud Practice |
| 92 | +
|
| 93 | +1. Aliyun ECS |
| 94 | +
|
| 95 | + Aliyun ECS (Elastic Compute Service) is an IaaS (Infrastructure as a Service) level cloud computing service provided by Alibaba Cloud. It builds eighth generation security-enhanced instance families based on Intel® TDX technology to provide a trusted and confidential environment with a higher security level. |
| 96 | +
|
| 97 | + About how to build TDX confidential computing instance, please refer to the below links: |
| 98 | +
|
| 99 | + Chinese version: https://www.alibabacloud.com/help/zh/elastic-compute-service/latest/build-a-tdx-confidential-computing-environment |
| 100 | +
|
| 101 | + English version:https://www.alibabacloud.com/help/en/elastic-compute-service/latest/build-a-tdx-confidential-computing-environment |
| 102 | +
|
| 103 | + Notice: Ali TDX instance is under external public preview. |
0 commit comments