-
Notifications
You must be signed in to change notification settings - Fork 983
Flag to bypass end user auth #49683
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
Merged
Merged
Flag to bypass end user auth #49683
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| - Added a `--bypass-end-user-auth` flag to `fleetctl package` that configures the generated fleetd installer to skip the end-user authentication prompt during enrollment on Linux and Windows hosts (e.g. when the end user already authenticated via another MDM). Requires fleetd v1.60.0 or higher. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| - Added a `--bypass-end-user-auth` flag (env `ORBIT_BYPASS_END_USER_AUTH`) that skips the end-user authentication prompt during enrollment on Linux and Windows by not advertising the end-user auth capability to the Fleet server. When a Windows MDM EUA token is present, it takes precedence and end-user auth is still processed. |
This file contains hidden or 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 hidden or 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,61 @@ | ||
| package packaging | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "strings" | ||
| "testing" | ||
| "text/template" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // TestBypassEndUserAuthTemplates verifies the --bypass-end-user-auth switch is wired into the generated Linux env file | ||
| // and Windows MSI arguments when enabled, and absent when not. macOS is intentionally excluded. | ||
| func TestBypassEndUserAuthTemplates(t *testing.T) { | ||
| baseOpt := Options{ | ||
| FleetURL: "https://fleet.example.com", | ||
| EnrollSecret: "secret", | ||
| OrbitChannel: "stable", | ||
| OsquerydChannel: "stable", | ||
| DesktopChannel: "stable", | ||
| NativePlatform: "windows", | ||
| Architecture: ArchAmd64, | ||
| } | ||
|
|
||
| // render executes tmpl with the bypass option toggled and returns the generated output. | ||
| render := func(t *testing.T, tmpl *template.Template, bypass bool) string { | ||
| t.Helper() | ||
| opt := baseOpt | ||
| opt.BypassEndUserAuth = bypass | ||
| var buf bytes.Buffer | ||
| require.NoError(t, tmpl.Execute(&buf, opt)) | ||
| return buf.String() | ||
| } | ||
|
|
||
| t.Run("linux env file", func(t *testing.T) { | ||
| assert.Contains(t, render(t, envTemplate, true), "ORBIT_BYPASS_END_USER_AUTH=true") | ||
| assert.NotContains(t, render(t, envTemplate, false), "ORBIT_BYPASS_END_USER_AUTH") | ||
| }) | ||
|
|
||
| t.Run("windows msi args", func(t *testing.T) { | ||
| // The flag is one of many appended to the service's ServiceInstall Arguments; isolate that line. | ||
| argsLine := func(output string) string { | ||
| t.Helper() | ||
| for line := range strings.SplitSeq(output, "\n") { | ||
| if strings.Contains(line, "Arguments=") && strings.Contains(line, "--fleet-url") { | ||
| return line | ||
| } | ||
| } | ||
| t.Fatal("ServiceInstall Arguments line not found in template output") | ||
| return "" | ||
| } | ||
| assert.Contains(t, argsLine(render(t, windowsWixTemplate, true)), "--bypass-end-user-auth") | ||
| assert.NotContains(t, argsLine(render(t, windowsWixTemplate, false)), "--bypass-end-user-auth") | ||
| }) | ||
|
|
||
| // Guard the deliberate macOS exclusion: the flag must never leak into the launchd plist. | ||
| t.Run("macos launchd plist excluded", func(t *testing.T) { | ||
| assert.NotContains(t, render(t, macosLaunchdTemplate, true), "ORBIT_BYPASS_END_USER_AUTH") | ||
| }) | ||
|
getvictor marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.