Skip to content

RFC: integrate Spiffe ID and mTLS into KBS #812

Open
@Xynnn007

Description

@Xynnn007

Background

The Confidential Containers (CoCo) community's Trustee sub-project utilizes the Key Broker Service (KBS) component to provide remote attestation services, aiming to address the implementation of remote attestation and confidential resource distribution. This functionality serves not only CoCo but also other confidential virtualization scenarios. The existing KBS component is a web service that offers remote attestation interface, plug-in-based confidential resource access interface, and access control based on KBS resource policy capabilities.

In the original architecture of KBS, remote attestation is achieved via the RCAR protocol over HTTP, allowing clients to conduct remote attestation. Remote attestation services such as CoCoAS and ITA return results in the form of JWT, which contains the claims of the TCB as well as of the client’s elliptic curve public key. Confidential resource access relies on enforcement of KBS resource policy and JWE payload encryption using the client’s elliptic curve public key, which, although provides access control and protects data confidentiality, still presents issues.

  1. Forward secrecy. JWE does not provides perfect forward secrecy. Once the tee private key is lacked the historical data stream can be decrypted.
  2. Confidential resource policies filter based on specific resource paths and the client's JWT claims, leading to varying policies for different remote attestation services.
  3. Current KBS has the potential to improve the architecture design by decoupling modules based on remote proof authentication, client authorization, and access control. These modules correspond to the core functions of KBS.
  4. Current KBS protocol relies on cookie thus binding to HTTP. The requirement is mostly for session id.

Design and Architecture

The new proposed architecture will include the following changes:

  1. Communication between the client and KBS must use HTTPS (mTLS).
  2. Every client (the kbs client, s.t. confidential VM / CoCo Pod) needs to be specified a Spiffe ID. It would do great help to workload/trust subdomain management by the user.
  3. Every client needs to obtain a X.509 public cert SVID (Spiffe Verifiable Identity Document) for remote attestation and verify successfully before gaining access. In contrast, previous design returns an attestation token directly from the backend attestation service.
  4. Resource access policy is simplified to a unified format based on Spiffe ID, reducing the need for clients to adapt to different remote attestation services.
  5. We decouple session id from http cookie to message level.

This is the overall design diagram

Image

  • CA is a plugin. Different kinds of implementation can be integrated. It helps the KBS to certify certs and also verify the endorsement of a given client cert.
  • AuthN is a wrapper of current attestation module. Similar with De-couple KBS session management from attestation service #729 proposed.
  • Access Control is a wrapper of current kbs resource policy.

KBS protocol updates

The original KBS protocol is

1. C-->S     Request := {}

2. C<--S     Challenge := { Nonce }

3. C-->S     Attestation := { Ev(Nonce, pubkey), pubkey }

4. C<--S     Response := { Token(pubkey, Ev) }

The new one is

1. C-->S     Request := { spiffe_subdomain_id }

2. C<--S     Challenge := { Nonce, session_id }

3. C-->S     Attestation := { Ev(Nonce, pubkey-csr(spiffe_subdomain_id)), pubkey-csr(spiffe_subdomain_id), session-id }

4. C<--S     Response := { pubkey-crt(spiffe_id) }

Note that

  1. KBS will return a public key cert rather than attestation tokens to the client in the final step. The client's Spiffe ID is included inside the public key x509 cert's SAN field.
  2. The key pair is generated inside the guest.

KBS architecture changes

Image

The basic KBS architecture will be as shown in the figure.

  1. We will put the remote attestation and the interaction with the backend attestation as the content of the authentication submodule.
  2. In addition, we will add a plug-in CA module to support certificate issuance and verification.
  3. In addition, the original KBS resource policy module is expanded to an access control module to manage and filter plugin access requests from the client side.

KBS resource policy changes

Before this, KBS resource policy may need to understand the underlying Attestation Token format. For example, when using the EAR format token, you will encounter the following sample policy

package policy
import rego.v1

default allow = false

allow if {
    input["submods"]["cpu"]["ear.status"] == "affirming"
}

The resource policy composer needs to know that the attestation token format.

with the new design, the resource policy focus on access control based on client identity

{
    "allows": {
        "spiffe://domain/usergroup1/*": [
            "resource/path1",
            "resource/path2/*"
        ],
        "spiffe://domain/user2": [
            "resource/default/key/ssh-demo"
        ]
    }
}

The use of wildcards provides flexibility and configurability for concepts such as subdomains and user groups.

Attestation Service Changes

We do not need to do any change upon Attestation Service.

Lifetime of SVID

Note that SVID is a x509 cert with Spiffe ID in it.

  1. The guest will generate an EC key pair. Generate a CSR with the public key and spiffe id
  2. the KBS will call the backend CA to sign the csr to generate the SVID. The SVID will have expired time
  3. the KBS sends back the SVID to the guest
  4. The guest uses the SVID to access secret or other things.
  5. If the SVID is expired, the guest needs to do another round of RCAR attestation process to get a new one. During the whole lifetime of the guest, the Spiffe ID will not change.

At the same time, because SVID is in x509 format, it has a wide range of application scenarios, such as implementing encrypted service mesh based on Pod identity. (like istio)

A typical user experience

  1. Before deploying the actual pod, the user plans how to manage the client, such as which subdomains to divide into and what permissions each has
  2. The user uses kbs-client to register the user and the attestation policy ids that need to be passed in kbs. The input is (spiffe_id, attestation_policy_ids). That means "A client TEE that claims to be a user must be verified against the AS policies with IDs."
  3. The user configures the kbs resource access policy
  4. The user configures the client id through initdata and deploys the pod
  5. Remote attestation occurs, and kbs verifies whether the tee tcb of the source client meets the attributes of the as declaration. If so, it issues a certificate.
  6. kbs responds to resource access requests and filters according to the rules defined by the policy

Potential Usages

Image

Image

Restrictions

  1. This framework does not fully solve the problem of "a group of VMs with the same TCB simultaneously claiming and attesting themselves to with a same spiffe id". Because we only define some solutions from the software perspective, it is easy to cause factory attacks. Unless the remote attestation report of the hardware contains information about the specific hardware ID (such as s390x), the location and uniqueness of the VM can be guaranteed. Otherwise, pure software cannot avoid forgery. So, we can further alleviate this problem by registering once, or resolve this by introducing the definition of hardware platform identity in the remote attestation process. Although these methods are compatible with the currently proposed framework, they are not the main issues to be solved by the current framework and can be gradually supplemented in the future.

  2. The introduction of this framework may cause incompatibility with existing trustees and earlier guest image logic (mainly for KBS protocol). This is also an open that this RFC hopes to discuss: are such destructive changes still allowed before 1.0, or does this new architecture need to be implemented in an independent project rather than based on the existing KBS transformation?

Related previous discussions

#175
confidential-containers/confidential-containers#131
confidential-containers/guest-components#340

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions