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

Allow Desktop Streams if Prep Commands fail due to user not being logged in #1207

Merged
merged 2 commits into from
Sep 17, 2023

Conversation

Nonary
Copy link
Collaborator

@Nonary Nonary commented Apr 23, 2023

Description

This changes the behavior of the do commands to no longer fail if the user is launching the desktop.
Since do/undo commands now execute under the users profile, this could potentially prevent users from being able to sign back into their PC if they rebooted or signed out.
This change addresses this scenario by essentially whitelisting the failure, but only if they are streaming the desktop.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@Lucide
Copy link

Lucide commented Jun 28, 2023

I have a windows-only question: to your knowledge, are preparation commands completely impossible without an interactive user session?
My attempt to circumvent this issue was to schedule desktop-only commands at the next logon (with windows task scheduler) if a user session is not detected. I was doing that with a powershell script but I'm unable to access the system.
I wrote a message on the discord server:

Sunshine supports streaming when there are no interactive sessions active on the machine (e.g., when it has just been powered up). In this case, the user impersonation query fails and commands are ran as SYSTEM. All fine till here.
I want to run a powershell script that switches to the extended display mode while streaming, but I'm having permission issues in the case above. Even a simple thing with i/o fails:

Debug: Parsed executable [powershell.exe] from command [powershell.exe -c "'hello' *>> 'D:\temp\streamActionLog.txt'"]
Debug: Resolved executable [powershell.exe] to path ["C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"]
Info: Executing Do Cmd: [powershell.exe -c "'hello' *>> 'D:\temp\streamActionLog.txt'"]
Debug: QueryUserToken failed, this would prevent commands from launching under the users profile.
Error: Couldn't run [powershell.exe -c "'hello' *>> 'D:\temp\streamActionLog.txt'"]: System: Permission denied

SYSTEM, should be able to access the fs. I haven't tampered with its ACLs and it has its default permissions.
Powershell itself runs in non-interactive sessions just fine, but I admit I've never used it as the plain SYSTEM account. I usually use S4U (kerberos delegation?) through the task scheduler ("do not store password" option). I think Sunshine doesn't fiddle with that, because here the impersonation works only if there is an active session.

I'm not sure of where's the issue here. Maybe someone more experienced can point me in the right direction.
Thank you.

@ReenigneArcher
Copy link
Member

Could you update your branch? Preparing for a release soon and would like to include this if it's still relevant.

@Nonary
Copy link
Collaborator Author

Nonary commented Sep 17, 2023

Could you update your branch? Preparing for a release soon and would like to include this if it's still relevant.

Just merged in nightly, yeah it is still relevant. Currently users have to add an application with prep commands disabled for this scenario.

@ReenigneArcher ReenigneArcher merged commit e3bd932 into LizardByte:nightly Sep 17, 2023
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
e-dong pushed a commit to e-dong/Sunshine that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants