-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve device user account creation during MDM IdP enrollment flow (#…
- Loading branch information
1 parent
93b957d
commit 2425f98
Showing
27 changed files
with
900 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- Fixed bug where MDM devices would fail to renew enrollment profiles if applicable end user authentication | ||
settings changed after the device was enrolled. | ||
- Improved device user account creation during MDM IdP enrollment flow by removing enrollment | ||
reference from MDM server url in Fleet-generated enrollment profiles. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
server/datastore/mysql/migrations/tables/20240709175341_AddColumnsToMdmIdpAccounts.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package tables | ||
|
||
import ( | ||
"database/sql" | ||
"fmt" | ||
) | ||
|
||
func init() { | ||
MigrationClient.AddMigration(Up_20240709175341, Down_20240709175341) | ||
} | ||
|
||
func Up_20240709175341(tx *sql.Tx) error { | ||
alterStmt := ` | ||
ALTER TABLE mdm_idp_accounts ADD COLUMN ( | ||
host_uuid varchar(63) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | ||
fleet_enroll_ref varchar(63) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' | ||
)` | ||
|
||
if _, err := tx.Exec(alterStmt); err != nil { | ||
return fmt.Errorf("failed to alter mdm_idp_accounts table: %w", err) | ||
} | ||
|
||
updateStmt := ` | ||
UPDATE | ||
mdm_idp_accounts mia | ||
LEFT JOIN host_mdm hmdm ON mia.uuid = hmdm.fleet_enroll_ref | ||
LEFT JOIN hosts h ON hmdm.host_id = h.id | ||
SET | ||
mia.fleet_enroll_ref = mia.uuid, | ||
mia.host_uuid = COALESCE(h.uuid, ''), | ||
mia.updated_at = mia.updated_at` | ||
|
||
if _, err := tx.Exec(updateStmt); err != nil { | ||
return fmt.Errorf("failed to update data in mdm_idp_accounts: %w", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func Down_20240709175341(tx *sql.Tx) error { | ||
return nil | ||
} |
Oops, something went wrong.