Skip to content

policy: do not set policy to open door if none is provided - #1572

Merged
Maksim An (anmaxvl) merged 1 commit into
microsoft:mainfrom
anmaxvl:fix-empty-policy-measurement
Jan 5, 2023
Merged

policy: do not set policy to open door if none is provided#1572
Maksim An (anmaxvl) merged 1 commit into
microsoft:mainfrom
anmaxvl:fix-empty-policy-measurement

Conversation

@anmaxvl

Copy link
Copy Markdown
Contributor

Currently hcsshim is setting an allow all open door policy if no security policy has been provided.
On the host side, the security policy is hashed and used as HostData when starting an SNP-uVM. However, guest receives the aforementioned "open_door" policy and computes hash over it. As a result, this has doesn't match the LaunchData which is returned by the attestation report and rightfully so, GCS rejects the security policy.

Fix this by not special handling empty security policy on the host side and let the guest decide what to do with it, thus ensuring that both host and guest compute the hash over the same thing.

Signed-off-by: Maksim An maksiman@microsoft.com

Currently hcsshim is setting an allow all open door policy if
no security policy has been provided.
On the host side, the security policy is hashed and used as
HostData when starting an SNP-uVM. However, guest receives the
aforementioned "open_door" policy and computes hash over it.
As a result, this has doesn't match the LaunchData which is
returned by the attestation report and rightfully so, GCS
rejects the security policy.
Fix this by not special handling empty security policy on the
host side and let the guest decide what to do with it, thus
ensuring that both host and guest compute the hash over the
same thing.
Signed-off-by: Maksim An <maksiman@microsoft.com>
@anmaxvl
Maksim An (anmaxvl) requested a review from a team as a code ownerNovember 21, 2022 17:53

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that now we would have to set a default policy in one isnt provided in uvmboot, since the guest may default to something that isnt opendoor policy?

@anmaxvl

Copy link
Copy Markdown
ContributorAuthor

This means that now we would have to set a default policy in one isnt provided in uvmboot, since the guest may default to something that isnt opendoor policy?

The guest should handle empty security policy and enforcer properly.

Comment on lines -24 to -31
if policy == "" {
openDoorPolicy := securitypolicy.NewOpenDoorPolicy()
policyString, err := openDoorPolicy.EncodeToString()
if err != nil {
return err
}
policy = policyString
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there at least be a check that policy isn't empty? Or do you end up with a deny all if policy is empty?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default policy set will be determined by -initial-policy-stance flag that GCS binary accepts. In SNP case, we'll set it to deny. This PR enables the scenario where we want to boot from a VMGS file, but don't need a security policy. e.g. for debugging purposes or what not.

@msscotbScott Brender (msscotb) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@anmaxvl
Maksim An (anmaxvl) merged commit 6547959 into microsoft:mainJan 5, 2023
@anmaxvl
Maksim An (anmaxvl) deleted the fix-empty-policy-measurement branch January 5, 2023 00:37
Prince Pereira (princepereira) pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
…#1572)
Currently hcsshim is setting an allow all open door policy if
no security policy has been provided.
On the host side, the security policy is hashed and used as
HostData when starting an SNP-uVM. However, guest receives the
aforementioned "open_door" policy and computes hash over it.
As a result, this has doesn't match the LaunchData which is
returned by the attestation report and rightfully so, GCS
rejects the security policy.
Fix this by not special handling empty security policy on the
host side and let the guest decide what to do with it, thus
ensuring that both host and guest compute the hash over the
same thing.
Signed-off-by: Maksim An <maksiman@microsoft.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@anmaxvl@BryceDFisher@msscotb@helsaawy