-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full support of secret variables in Apple configuration profiles #24925
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5ca968f
Work in progress
getvictor ddedd13
Initial implementation.
getvictor b2a8429
Added test.
getvictor 5900365
Minor refactoring.
getvictor 5d9d925
Allowing whole profile over legacy endpoint.
getvictor d985197
Adding test for new batch upload endpoint.
getvictor 1da6100
Fixing test/lint fails.
getvictor fc76b87
Fixed test fail.
getvictor ca8cbf6
Updating migration timestamps.
getvictor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
39 changes: 39 additions & 0 deletions
39
server/datastore/mysql/migrations/tables/20241220100000_AddSubtypeToNanoCommands.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,39 @@ | ||
package tables | ||
|
||
import ( | ||
"database/sql" | ||
"fmt" | ||
|
||
"github.com/fleetdm/fleet/v4/server/mdm/nanomdm/mdm" | ||
) | ||
|
||
func init() { | ||
MigrationClient.AddMigration(Up_20241220100000, Down_20241220100000) | ||
} | ||
|
||
func Up_20241220100000(tx *sql.Tx) error { | ||
if !columnExists(tx, "nano_commands", "subtype") { | ||
_, err := tx.Exec(fmt.Sprintf(` | ||
ALTER TABLE nano_commands | ||
ADD COLUMN subtype enum('%s','%s') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '%s'`, | ||
mdm.CommandSubtypeNone, mdm.CommandSubtypeProfileWithSecrets, mdm.CommandSubtypeNone)) | ||
if err != nil { | ||
return fmt.Errorf("failed to create nano_commands.subtype column: %w", err) | ||
} | ||
} | ||
|
||
// With secret variable support, it is possible to have the whole profile as one secret ($FLEET_SECRET_PROFILE), | ||
// which will not be XML when stored. It is cleaner to remove the check than to add a special caveat to documentation. | ||
if constraintExists(tx, "nano_commands", "nano_commands_chk_3") { | ||
_, err := tx.Exec(`ALTER TABLE nano_commands DROP CONSTRAINT nano_commands_chk_3`) | ||
if err != nil { | ||
return fmt.Errorf("failed to drop nano_commands_chk_3 constraint: %w", err) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func Down_20241220100000(_ *sql.Tx) error { | ||
return nil | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we looked into encrypting the profile content here? Otherwise, I'm assuming we are ok for this iteration that unencrypted secrets might be accessible in transit or at rest on the device, for example, by a user running
profiles
in the terminal or via osquerymacos_profiles
table.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I brought up a similar issue with product.
Are you suggesting there is a way to prevent the device user from viewing profile contents. For example, from viewing the EnrollSecret in our Fleetd configuration profile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is possible to encrypt profiles. Here are the Apple docs.