Skip to content
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

Boxstarter should only modify UAC level, never disable UAC completely #581

Open
2 tasks done
mwallner opened this issue Oct 15, 2024 · 2 comments
Open
2 tasks done
Assignees
Labels
0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint Improvement Issues that enhances existing functionality, or adds new features

Comments

@mwallner
Copy link
Member

mwallner commented Oct 15, 2024

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

Whenever Boxstarter re-enables UAC after it triggered a reboot the UAC is in a 'foggy state' - ignoring ConsentPromptBehavior etc.
In order to bring the host to a clean state again the host needs to be rebooted again.
This 'final reboot' cannot be done from Boxstarter since the reboot would not be a fenced login/suspended bitlocker etc.

This default behavior is currently wanted, since we cannot assume the user has physical access to the machine that runs Boxstarter, therefore we can only do 'fenced reboots' that wind up in a session again.
We could add an option to force a reboot in order to re-enable UAC to a clean state if Boxstarter ever did a reboot during its operation, but this should not be required when this issue is being implemented (and only ConsentPromptBehavior is modified while UAC stays enabled all the time).

Describe The Solution. Why is it needed?

In brief; iff UAC is enabled, set the property ConsentPromptBehaviorAdmin to 0.
(!MIND @pauby 's comment below: if it's running on Windows Server 2016 or newer, this won't work on previous releases - we'll need to keep the current mechanism in place for those older OS versions)

This will cause Windows to allow privileged actions without prompting.

https://docs.microsoft.com/en-us/windows/security/identity-protection/user-account-control/user-account-control-group-policy-and-registry-key-settings#registry-key-settings

Then to be sure that your tasks are launched in an elevated shell you can do:

Start-process Powershell.exe -Arguments $yourargs -Verb runas

Related Issues

Idea Originally posted by @SuperFlue in #358 (comment)

@mwallner mwallner changed the title Boxstarter should only only modify UAC level, never disable UAC completely Boxstarter should only modify UAC level, never disable UAC completely Oct 15, 2024
@mwallner mwallner self-assigned this Oct 15, 2024
@mwallner mwallner added 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue 0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint labels Oct 15, 2024
@pauby
Copy link
Member

pauby commented Oct 15, 2024

Just to be clear, this only applies to Windows Server 2016 and above. Chocolatey CLI and by extension Boxstarter, supports back to Windows Server 2012R2.

@mwallner
Copy link
Member Author

NOTE: there may be edgecases where a installer/setup script can only be run when EnableLUA -eq 0 (though I don't hope so)
=> we'd break those cases even though Boxstarter always runs in an elevated state.
... And they'd be flaky anyway if they'd been run before Boxstarter triggered a reboot (and disabled LUA for that sake) ...

I really do hope this is a constructed example, not something that's out in the wild.

@mwallner mwallner added Improvement Issues that enhances existing functionality, or adds new features and removed 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint Improvement Issues that enhances existing functionality, or adds new features
Projects
None yet
Development

No branches or pull requests

2 participants