don't preemptively set disk encryption as on (#14533)

for #14422

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
This commit is contained in:
Roberto Dip 2023-10-13 18:05:03 -03:00 committed by GitHub
parent eb0babe51a
commit 9172b69669
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -7209,6 +7209,11 @@ func (s *integrationMDMTestSuite) TestHostDiskEncryptionKey() {
require.NotNil(t, hdek.Decryptable)
require.True(t, *hdek.Decryptable)
// the disk encryption status of the host is not set with this request
var hostResp getHostResponse
s.DoJSON("GET", fmt.Sprintf("/api/latest/fleet/hosts/%d", host.ID), nil, http.StatusOK, &hostResp)
require.Nil(t, hostResp.Host.DiskEncryptionEnabled)
// the key is encrypted the same way as the macOS keys (except with the WSTEP
// certificate), so it can be decrypted using the same decryption function.
wstepCert, _, _, err := s.fleetCfg.MDM.MicrosoftWSTEP()

View file

@ -589,10 +589,6 @@ func (svc *Service) SetOrUpdateDiskEncryptionKey(ctx context.Context, encryption
if err := svc.ds.SetOrUpdateHostDiskEncryptionKey(ctx, host.ID, encryptedEncryptionKey, clientError, decryptable); err != nil {
return ctxerr.Wrap(ctx, err, "set or update disk encryption key")
}
if encryptedEncryptionKey != "" {
if err := svc.ds.SetOrUpdateHostDisksEncryption(ctx, host.ID, true); err != nil {
return ctxerr.Wrap(ctx, err, "set or update host disks encryption")
}
}
return nil
}