Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Help Center/ Elastic Cloud Server/ User Guide/ QingTian Enclave Management/ Getting Started with QingTian Enclave

Getting Started with QingTian Enclave

Updated on 2025-01-02 GMT+08:00

This section guides you through the process of understanding and using the QingTian Enclave feature. It shows you how to launch a parent instance, build a QingTian Enclave image file, query a running QingTian Enclave instance, and stop a QingTian Enclave instance.

  1. Prepare an instance that supports the QingTian Enclave feature.
    • When purchasing an instance, select QingTian Enclave in the advanced settings and select a Linux OS image. Huawei Cloud EulerOS 2.0 is recommended.
    • Connect to the parent instance. For details, see the Huawei Cloud Elastic Cloud Server User Guide.
    • Install the qt CLI on the parent instance, set parameters for resource isolation in the configuration file as required, and enable resource isolation. To use qt CLI, you must install Python libraries. For details, see QingTian CLI (qt CLI).
      • Install the qt CLI and other necessary RPM packages.
        yum install qt-enclave-bootstrap
        yum install virtio-qtbox
        yum install qingtian-tool
      • Set parameters for resource isolation in the configuration file and enable resource isolation. In this tutorial, 1 GiB of memory and 2 vCPUs are used by default.
        systemctl start qt-enclave-env
  2. Use the binary mode to install Docker on the parent instance. You can download the required Docker version from the official website of Docker. Here we use docker-27.0.1 as an example.
    wget https://download.docker.com/linux/static/stable/x86_64/docker-27.0.1.tgz

    Decompress the downloaded package.

    tar zxf docker-27.0.1.tgz

    After the decompression is complete, copy all the files in the Docker directory to the /usr/bin directory.

    cp docker/* /usr/bin

    Start the Docker service and set the log level to error.

    dockerd -l error &

    Verify the Docker version.

    docker version

    Run the hello-world container to check whether Docker is installed.

    docker run hello-world
  3. Build a QingTian Enclave image file.

    Here we use the following hello_enclave.sh script as the QingTian Enclave application.

    #!/bin/bash
    while true
    do
        echo "hello enclave!"
        sleep 2
    done

    The Dockerfile content is as follows:

    FROM ubuntu:latest
    COPY hello_enclave.sh /root/hello_enclave.sh
    CMD ["/root/hello_enclave.sh"]

    Check that the script has execution permissions.

    chmod +x hello_enclave.sh 

    Build a Docker image named hello-enclave.

    docker build -f Dockerfile -t hello-enclave . 

    Run the qt enclave make-img command to convert the Docker image to a QingTian Enclave image file named hello-enclave.eif.

    qt enclave make-img --docker-uri hello-enclave --eif hello-enclave.eif

    The output is as follows:

    # qt enclave make-img --docker-uri hello-enclave --eif hello-enclave.eif
    {
        "digest":   "SHA384",
        "PCR0": "63bf78ece7d2388ff773d0cad2ebc9a3070359db46d567ba271ff8adfb8b0b091be4ff4d5dda3f1c83109096e3656f3b",
        "PCR8": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
    }

    The QingTian Enclave image file named hello-enclave.eif has now been built. The command contains a set of PCR values, including PCR0 and PCR8. (In this example, no certificates or keys are specified during image creation, so PCR8 is 0.) These hash values are measurements of QingTian Enclave images and they are generally used as expected measurements (compared with the measurements in the attestation document during the boot-up process).

    • Run a QingTian Enclave instance.

      You can now run the QingTian Enclave image using the following command:

    qt enclave start --mem 1024 --cpus 2 --eif hello-enclave.eif --cid 4 --debug-mode

    The QingTian Enclave instance runs in debug mode. For details about debug mode, see Introduction to qt enclave Subcommands.

    The output is as follows:

    # qt enclave start --cpus 2 --mem 1024 --eif hello-enclave.eif --cid 4 --debug-mode
    Started enclave with EnclaveID : 0, EnclaveCID : 4, NumberOfCPUs : 2, MemoryMiB : 1024
    {
        "EnclaveID":    0,
        "EnclaveCID":   4,
        "NumberOfCPUs": 2,
        "MemoryMiB":    1024,
        "LaunchMode":   "debug"
    }

    In this tutorial, 2 vCPUs and 1024 MiB of memory are allocated to the QingTian Enclave instance, and the EnclaveCID is set to 4. The EnclaveCID can be used as the IP address of the local socket between the QingTian Enclave instance and the parent instance.

    • Query a running QingTian Enclave instance.

    After the QingTian Enclave instance is created, run the following command to check whether the instance is running:

    qt enclave query --enclave-id 0
    # qt enclave query --enclave-id 0
    [{
            "EnclaveID":    0,
            "ProcessID":    29990,
            "EnclaveCID":   4,
            "NumberOfCPUs": 2,
            "MemoryMiB":    1024,
            "LaunchMode":   "debug"
        }]

    The command can query information about the QingTian Enclave instance, including EnclaveID, ProcessID, EnclaveCID, number of vCPUs, memory size, and its running mode. You can run the qt enclave console command to view the read-only console output of the QingTian Enclave instance because the instance is launched in debug mode.

    hello enclave!
    hello enclave!
    hello enclave!
    hello enclave!

    You can see that the hello enclave! is printed to the console every two seconds.

    • Stop a QingTian Enclave instance.

    If you want to stop a QingTian Enclave instance, run the following commands:

    # qt enclave stop --enclave-id 0
    stop enclave 0 successfully
    {
        "EnclaveID":    0
    }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback