Enarx
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Attestation Flow ###### tags: `Design` | Author | Period | State | | -------- | -------- | -------- | | Nathaniel McCallum<br>Richard Zak<br>Harald Hoyer<br>Dmitri Pal | November-December, 2022 | **🔴 Draft** | ## Introduction This document is the continuation of the discussion about the attestation flow, started in the [Attestation Concept](https://hackmd.io/@enarx/r1Yg2kb_s) document. It focuses on the entity that receives the attestation report from a Keep, inspects it and validates that the Keep was properly created on the hardware which keys are still trusted. ## Complexity of the validation An attestation report is difficult to consume. It requires careful analysis of a signature hierarchy along with platform state. Likewise, managing the cryptographic measurements of supported applications is tedious and error-prone. Attestation validation, on the other hand, needs to be simple and auditable. > Most attestation validators really only care to answer the question "What is the name and version of the application?" > There are multiple hardware vendors that offer the ability to run workloads within the encrypted memory. While in general the capability is the same, the implementation is quite different. The relying party that receives and validates the attestation report, has to be intimately familiar with the details of the specific attestation process and know how to review and validate provided data. It would have been great, if there were a universal interpreter that on one side could process the raw attestation data delivered by the keep and on the other could produce a simpler and more conventional report that can be easily verified by already existing tools and protocols. ```mermaid flowchart TD manufacturer[Manufacturer Root Cert] intermediate["Intermediate Cert(s)"] attestation[Raw Attestation] report[Report] cpu[CPU Key] data[Data] attestation2[Raw attestation] certificate[Certificate] certificate2[Certificate] manufacturer --signs--> intermediate intermediate --signs--> cpu data --1. requests--> report cpu --2. signs--> report report --3. returns--> attestation attestation --4. provides--> attestation2 attestation2 --5. validates --> attestation2 attestation2 --6. issues --> certificate certificate --7. provides --> certificate2 certificate2 --8. validates --> certificate2 subgraph Hardware Attestation Service manufacturer intermediate end subgraph Host subgraph Firmware report cpu end subgraph Keep attestation data end end subgraph Interpreter attestation2 certificate end subgraph Relying party certificate2 end ``` ### What is Steward? Steward is an attestation-aware certification authority designed to act as such interpreter. The Keep generates a key pair and produces an attestation report proving that the private-public key pair was generated inside of a keep. Steward receives this attestation report as input and, if validation is successful, issues a certificate for the generated key pair. This allows us to convert a proprietary attestation report into a standard X.509 certificate for use with protocols like TLS. To improve interoperability, Keep uses a self-signed certificate as a vehicle of delivery of the attestation report and related metadata to Steward. ```mermaid sequenceDiagram participant enarx participant steward enarx ->> enarx: generate key pair enarx ->> steward: self-signed cert(attestation(pubkey)) steward ->> steward: extract data steward ->> steward: validate steward ->> steward: create a new<br>certificate using<br>extracted data steward ->> enarx: issue a signed certificate ``` #### Division of Labor One of the goals of Steward is to reduce the amount of validation that is required by third parties. Enarx deploys WebAssembly workloads into Keeps. So this means there are effectively three kinds of validation that must occur: 1. Validation of the hardware platform 2. Validation of the Enarx runtime 3. Validation of the workload Steward validates both the hardware platform and the Enarx runtime. Steward **DOES NOT** validate the workload. However, Steward issues a certificate, that the Keep presents to the workload registry. Registry releases the signed workload to the Keep and the Keep does the validation of the workload. For more details about this part of the flow see [Full Provisioning Flow with Attestation](https://hackmd.io/@enarx/rJ55urrvo) document. ## How do you get an Attestation? Enarx shims provide a syscall extension named [`get_attestation()`](https://enarx.dev/docs/technical/attestation-syscall). It is defined as follows (see the previous link for full documentation): ```c ssize_t get_attestation( void *nonce, size_t nonce_length, void *buf, size_t buf_length, size_t *technology ); ``` This takes an opaque blob as input (i.e. `nonce`) and writes the attestation into the provided buffer (i.e. `buf`). This function also outputs a `technology` identifier (i.e. SGX or SEV). This call is not currently exposed to WebAssembly code. ## How does Steward use Attestation? This section is connected to the section of the [Full Attestation Workflow](https://hackmd.io/@enarx/rJ55urrvo#PHASE-3b-Establish-Workload-Identity) document and focuses on the Steward side of processing the attestation ```mermaid sequenceDiagram guest ->> guest: Get platform type<br>[nil, kvm, sgx, snp] guest ->> guest: Generate TLS keypair Note right of guest: Cert URI SAN: slug [w/o wdig] Note right of guest: Cert URI SAN: wdig opt wsig is present Note right of guest: Cert URI SAN: hash(wsig pubkey) end opt Keep = (SGX || SEV) guest ->> guest: Get attestation blob<br>(hash(TLS pubkey)) Note right of guest: Cert Extension: attestation blob Note right of guest: Attestation blob contains<br>measurements of the Enarx runtime end guest ->> guest: Self-sign<br>the TLS keypair Note right of guest: The certificate<br>now contains<br>all the available<br>attestation information<br>and is valid for<br>the lifespan period<br>provided by Drawbridge<br>at the earlier phase.<br> opt Drawbridge provided Steward URL guest ->> steward: Self-signed certificate (Steward API) steward ->> steward: extract data steward ->> steward: validate steward ->> steward: create a new<br>certificate using<br>extracted data steward ->> guest: issue a signed certificate end ``` ## What is in the attestation report? The reports contain a lot of information regarding the model, revision, and firmware version for the CPU. Some items aren't of concern to Steward, some things need to be checked to ensure safety, and other fields need to be customizable based on some criteria. What makes this complicated is that SGX and SNP don't have the same fields, so it makes it more difficult to be consistent. Goals for attestation configuration: * White-list trusted, signed release versions of Enarx. Ensure that the proper version is running, and not some version which has been re-compiled, and possibly altered. * Black-list compromised or obsoleted Enarx versions. * Black-list compromised or obsoleted CPU firmware versions. Non-negiotable aspects of attestation validation in Steward: * Ensure proper algorithms, SGX uses Elliptic Curve NIST P256, SNP uses Elliptic Curve NIST P384. Anything else is evidence of tampering with the data. * Ensure the report is signed with a valid signature. * Ensure the signature validates with the CPU's public key. * Ensure the CPU's public key is part of the vendor's certificate chain. * Ensure reserved fields in the attestation report are zeroed. * Ensure certain fields in the report which are set by Enarx are not zero (these may be checked by an optional attestation configuration file, above). * Ensure that KVM and debug mode SGX, SNP are only allowed if Steward is in debug mode. * Check CPU cert and vendor intermediate certs against vendor's CRL(s) **missing** ### SNP Below are fields for SNP we which are configurable due to being relevent to security. * Policy * Minimum ABI major, minor versions, check, currently 1.51, use this for only allowing secure version * Debug mode (never when Steward not in debug mode) * Single or Multiple CPUs allowed * Migration allowed (never allowed) * SMT allowed * Signing Algorithm, `u32`, must be `1` * PlatformInfo * SMT * TSME * More info https://developer.amd.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf * author_key_en, `u32`, should be 1 since we provide signing info * measurement, `[u8; 48]`, hash of Enarx in memory * Whitelist of allowed hashes * Blacklist of denied hashes * id_key_digest: `[u8; 48]`, signing key of the Enarx binary, optionally don't care * author_key_digest, `[u8; 48]`, signs ID key above * Whitelist of allowed keys * Blacklist of denied keys * [current|committed]_[build|minor|major], `u8` for each * Check that Policy ABI matches **current** minor|major (hard-coded Steward, not config file) ### SGX * Enarx public key signer, `[u8; 32]` * CPU SVN, `[u8; 16]`, not lower than some configured value * Must be checked against Intel's TCB API * https://github.com/profianinc/steward/issues/112 * https://github.com/enarx/enarx/issues/2380 * Features * make sure not debug unless Steward is in debug mode * Force 64-bit mode, required by Wasmtime * Enclave product id, `[u8; 2]` * rpt.enclave_product_id(), must be the configured version * rpt.enclave_security_version(), check not less than some value we specify, currently zero ## What's missing in the Steward implementation? * Steward allows for several CSRs to be sent, ideally to provide a certificate for different uses of keys (signing, encryption, CA, etc). This is not yet implemented in Enarx. * Enarx only sends one CSR. * Enarx only creates one keypair for the workload. * Likely waiting on Crypto VFS. * How to handle debug mode: * Whole Steward is debug or not, or * Debug mode per Technology (allow debug SGX not SNP, for example), * If debug per Technology, when to allow KVM? * Rename KVM, since same applies for `Nil`? * Place information about the Technology as extra data in the certificate? This would allow third parties to know more about the underlying technology versus just trusting all certs signed by a Steward are in a Keep. * Privacy vs. allowing a client to know that the application in a Keep isn't running a compromised version of SNP, SGX. Or provide extra assurances that the application is secure and running with latest CPU firmware after a vulnerability disclosure. * Extension with version number, or hash, of the CPU's firmware/TCB? * Different certificate chain per Technology? * Checking Intel TCB * https://github.com/profianinc/steward/issues/112 * https://github.com/enarx/enarx/issues/2380 * Checking certificates against vendor CRLs * https://github.com/enarx/enarx/issues/2389 * Customizing certificate validity for Steward-signed certificates. * Should Steward have a CRL URL? * OCSP instead * What if attestation config for a technology changes while some certs are still valid? * Need attestation data in the issued cert for periodic re-attestation

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully