Skip to content

Commit f748190

Browse files
committed
Start Linux disk encryption enterprise test, don't touch macOS FileVault on enabling encryption if macOS MDM isn't enabled
1 parent b63b725 commit f748190

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

server/service/apple_mdm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ func (svc *Service) updateAppConfigMDMDiskEncryption(ctx context.Context, enable
21572157
if ac.MDM.EnableDiskEncryption.Value != *enabled {
21582158
ac.MDM.EnableDiskEncryption = optjson.SetBool(*enabled)
21592159
didUpdate = true
2160-
didUpdateMacOSDiskEncryption = true
2160+
didUpdateMacOSDiskEncryption = ac.MDM.EnabledAndConfigured
21612161
}
21622162
}
21632163

server/service/integration_enterprise_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,6 +2881,40 @@ func (s *integrationEnterpriseTestSuite) TestAppleOSUpdatesTeamConfig() {
28812881
}, http.StatusUnprocessableEntity, &tmResp)
28822882
}
28832883

2884+
func (s *integrationEnterpriseTestSuite) TestLinuxDiskEncryption() {
2885+
t := s.T()
2886+
2887+
// create a Linux host
2888+
hostLin, err := s.ds.NewHost(context.Background(), &fleet.Host{
2889+
DetailUpdatedAt: time.Now(),
2890+
LabelUpdatedAt: time.Now(),
2891+
PolicyUpdatedAt: time.Now(),
2892+
SeenTime: time.Now(),
2893+
NodeKey: ptr.String(strings.ReplaceAll(t.Name(), "/", "_") + "3"),
2894+
OsqueryHostID: ptr.String(strings.ReplaceAll(t.Name(), "/", "_") + "3"),
2895+
UUID: t.Name() + "3",
2896+
Hostname: t.Name() + "foo3.local",
2897+
PrimaryIP: "192.168.1.3",
2898+
PrimaryMac: "30-65-EC-6F-C4-60",
2899+
Platform: "ubuntu",
2900+
OSVersion: "Ubuntu 22.04",
2901+
})
2902+
require.NoError(t, err)
2903+
2904+
// turn on disk encryption enforcement
2905+
s.Do("POST", "/api/latest/fleet/disk_encryption", updateDiskEncryptionRequest{EnableDiskEncryption: true}, http.StatusNoContent)
2906+
2907+
// set encrypted for host
2908+
require.NoError(t, s.ds.SetOrUpdateHostDisksEncryption(context.Background(), hostLin.ID, true))
2909+
2910+
// should succeed as we no longer require MDM to access this endpoint, as Linux encryption doesn't require MDM
2911+
var summary getMDMDiskEncryptionSummaryResponse
2912+
s.DoJSON("GET", "/api/latest/fleet/mdm/disk_encryption/summary", getMDMDiskEncryptionSummaryRequest{}, http.StatusOK, &summary)
2913+
s.DoJSON("GET", "/api/latest/fleet/disk_encryption", getMDMDiskEncryptionSummaryRequest{}, http.StatusOK, &summary)
2914+
// disk is encrypted but key hasn't been escrowed yet
2915+
require.Equal(t, fleet.MDMDiskEncryptionSummary{ActionRequired: fleet.MDMPlatformsCounts{Linux: 1}}, *summary.MDMDiskEncryptionSummary)
2916+
}
2917+
28842918
func (s *integrationEnterpriseTestSuite) TestListDevicePolicies() {
28852919
t := s.T()
28862920
ctx := context.Background()

0 commit comments

Comments
 (0)