fix DEP enrollment by setting configuration_web_url if empty (#10662)

https://github.com/fleetdm/fleet/issues/10661

- [x] Manual QA for all new/changed functionality
This commit is contained in:
Roberto Dip 2023-03-22 10:00:41 -03:00 committed by GitHub
parent f5c8daacf0
commit c1aa0f04b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -124,6 +124,13 @@ func (svc *Service) setDEPProfile(ctx context.Context, enrollmentProfile *fleet.
// Override url with Fleet's enroll path (publicly accessible address).
depProfileRequest.URL = enrollURL
// If the profile doesn't have a configuration_web_url, use Fleet's
// enrollURL, otherwise the request for the enrollment profile is
// submitted as a POST instead of GET.
if depProfileRequest.ConfigurationWebURL == "" {
depProfileRequest.ConfigurationWebURL = enrollURL
}
depClient := apple_mdm.NewDEPClient(svc.depStorage, svc.ds, svc.logger)
res, err := depClient.DefineProfile(ctx, apple_mdm.DEPName, &depProfileRequest)
if err != nil {