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

security policy appended to container's environment variables #1219

Merged
merged 3 commits into from
Nov 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions internal/guest/runtime/hcsv2/uvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ func (h *Host) CreateContainer(ctx context.Context, id string, settings *prot.VM
}()
}

// Export security policy as one of the process's environment variables so that application and sidecar
// containers can have access to it. security policy is required by attestation containers which need to
// verify the attestation report feched from the PSP and extract init-time attestation claims found in
// the security policy. In doing so, an attestation container needs to confirm that the hash digest of
// the report's host_data attribute matches the hash digest of the security policy.
//
// We append the variable after the security policy enforcing logic completes so as to bypass it; the
// security policy variable cannot be included in the security policy as its value is not available
// security policy construction time.
policyEnforcer, ok := (h.securityPolicyEnforcer).(*securitypolicy.StandardSecurityPolicyEnforcer)
svolos marked this conversation as resolved.
Show resolved Hide resolved
if ok {
secPolicyEnv := fmt.Sprintf("SECURITY_POLICY=%s", policyEnforcer.EncodedSecurityPolicy)
settings.OCISpecification.Process.Env = append(settings.OCISpecification.Process.Env, secPolicyEnv)
}

// Create the BundlePath
if err := os.MkdirAll(settings.OCIBundlePath, 0700); err != nil {
return nil, errors.Wrapf(err, "failed to create OCIBundlePath: '%s'", settings.OCIBundlePath)
Expand Down