Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAR Support #516

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

EAR Support #516

wants to merge 14 commits into from

Commits on Oct 28, 2024

  1. policy: make policy error more general

    Since we reference this error enum from mod.rs, it should not
    be rego-specific. The error variants are not specific to OPA,
    so lift them into mod.rs.
    
    Now, someone writing an alternative policy engine
    can use the same errors.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    827ac0f View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2024

  1. token: implement EAR token generation

    This commit allows the AS to issue EAR tokens with the
    help of the rust-ear crate.
    
    EAR tokens require particular claims. This creates a binding
    between the AS policy and the EAR token.
    Specifically, the policy engine must return an EAR appraisal.
    The policy engine is still generic. Multiple policy engines
    could be implemented as long as they create an appraisal.
    
    Since policy evaluation is now closely tied to the type
    of token we are going to generate, make the policy engine
    more generic and move the logic around calling the policy engine
    out of lib.rs and into the token broker.
    
    There are a few other changes, including that the policy engine
    no longer takes multiple policies. For now, we only evaluate
    the first policy in the policy list, but future commits will
    change this convention so that we only ever think about one
    policy for the attestation service (until we introduce support
    for validating multiple devices at once).
    
    EAR Tokens also do not use flattened claims.
    
    The TCB claims are currently flattened so that we can use the
    key names as the input to the RVPS. This commit breaks this
    functionality, but a future commit will change the way
    the RVPS works to accomodate. There isn't a direct pairing
    between claim names and reference values, so there is no
    reason to keep flattening all the claims, especially
    because the flattening code has some corner cases
    that it does not support.
    
    This commit also adds the init_data_claims and
    runtime_data_claims to the tcb claims as long as
    the corresponding claims about the hashes are already there.
    This will allow the init_data to travel with the token,
    which will be convenient except if the init_data is too big.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    Signed-off-by: Xynnn007 <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    ee78aaa View commit details
    Browse the repository at this point in the history
  2. token: allow KBS to validate EAR tokens

    For EAR tokens we require the public key to be set.
    There is no option to deserialize a token without
    validating the signature.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    f34f34f View commit details
    Browse the repository at this point in the history
  3. docker-compose: add attestation token keypair

    A keypair is required to sign and validate the attestation token.
    In the past this was optional, but now it is not.
    
    Update the docker-compose manifest and configs to pass in this
    new keypair and update the docs to tell people how to generate it.
    
    This does complicate the user experience, but things are not secure
    without it. That said, we may be able to implement this automatically
    in a future PR.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    22c9bb2 View commit details
    Browse the repository at this point in the history
  4. tests: add token keypair to docker e2e test

    Now we need to provision a keypair for signing and
    validatig the attestation tokens.
    
    Add this keypair to the docker e2e test
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    9806b83 View commit details
    Browse the repository at this point in the history
  5. tests: remove unnecessary env var

    The sample attester is enabled by default.
    Remove setting the environment variable that used to
    enable it.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    ff7f573 View commit details
    Browse the repository at this point in the history
  6. k8s: add token signing keypair to k8s deployments

    We now require a keypair for signing/validating the attestation
    token. Add this keypair to our k8s deployment tooling.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    01c9201 View commit details
    Browse the repository at this point in the history
  7. tests: update e2e Makefile test

    We now require a keypair to sign/validate the attestation
    token. Add this keypair to the e2e test.
    
    Interestingly, we were using a keypair for validating
    the old CoCo token in this test, but only for the
    passport mode. Even in background check mode, this keypair
    is required or the token won't be validated at all.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    549996a View commit details
    Browse the repository at this point in the history
  8. rvps: change interface to get all reference values

    Previously we expected the caller of the RVPS to provide
    a name for the reference value that they wanted.
    In the AS we were flattening the TCB claims to get this name.
    Ultimately, the names of the TCB claims do not map directly onto
    the names of the required reference values.
    
    This changes the interface to have the RVPS determine which
    reference values to send. At the moment, it simply sends all of them.
    
    This allows the reference values that are used to mostly be set within
    the policy itself, which is probably a good idea.
    
    In the future, the RVPS should be improved to include a context
    abtraction that allows groups of reference values to be provided to the
    AS.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    0f39b40 View commit details
    Browse the repository at this point in the history
  9. policy: expand default policy

    THe skeleton for a policy that can be used to validate the TCB
    claims of all platforms in the context of confidential
    containers.
    
    Only sample and snp are supported currently, but this should give
    a good idea of how to extend the policy to other platforms.
    
    There are a few tweaks we can make later, such as supporting
    `>` or `<` comparisons.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    db301a4 View commit details
    Browse the repository at this point in the history
  10. docs: update docs and examples for EAR tokens

    Update the attestestion service policy docs to describe the
    requirements for policies that will generate EAR tokens.
    
    Also update various example and default policies.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    4bfaa73 View commit details
    Browse the repository at this point in the history
  11. ear: add expiration extension

    EAR tokens do not support an expiration claim by default, but
    fortunately we can use the Extension framework to add an `exp` field
    that will match what we would expect in a JWT.
    
    Add this extension and check it when we validate the token.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    9de30e7 View commit details
    Browse the repository at this point in the history
  12. policy: fix as policy test

    Now that the as policy engine is more generic, re-enable and update the
    test.
    
    This test is slightly tied to EAR.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    afbe923 View commit details
    Browse the repository at this point in the history
  13. ear: remove workaround for null values

    The rust-ear crate now supports null json value so we can remove the
    workaround we had to make sure null value didn't cause an exception.
    
    Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
    fitzthum committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    13d4931 View commit details
    Browse the repository at this point in the history