Fixing issue with Orbit not sending bitlocker error (#14547)

This is related to #14546 

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
This commit is contained in:
Marcos Oviedo 2023-10-16 11:07:40 -03:00 committed by GitHub
parent 7350e1e420
commit 4edab240ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View file

@ -0,0 +1 @@
* Orbit is now properly reporting Bitlocker encryption errors to Fleet server

View file

@ -487,9 +487,13 @@ func (w *windowsMDMBitlockerConfigFetcher) attemptBitlockerEncryption(notifs fle
// Otherwise, using the real one
fn = bitlocker.EncryptVolume
}
// Encryption operation is performed here, err will be captured if any
// Error will be returned if the encryption operation failed after sending it to Fleet Server
recoveryKey, err := fn(targetVolume)
// Getting Bitlocker encryption operation error message if any
// This is going to be sent to Fleet Server
bitlockerError := ""
if err != nil {
bitlockerError = err.Error()
@ -501,16 +505,18 @@ func (w *windowsMDMBitlockerConfigFetcher) attemptBitlockerEncryption(notifs fle
ClientError: bitlockerError,
}
errServerUpdate := w.EncryptionResult.SetOrUpdateDiskEncryptionKey(payload)
if errServerUpdate != nil {
log.Error().Err(errServerUpdate).Msg("failed to send encryption result to Fleet Server")
return
}
// This is the error status of the Bitlocker encryption operation
// it is returned here after sending the result to Fleet Server
if err != nil {
log.Error().Err(err).Msg("failed to encrypt the volume")
return
}
err = w.EncryptionResult.SetOrUpdateDiskEncryptionKey(payload)
if err != nil {
log.Error().Err(err).Msg("failed to send encryption result to Fleet Server")
return
}
w.lastEnrollRun = time.Now()
}