-
Notifications
You must be signed in to change notification settings - Fork 779
Impersonate the security context of the Windows account #452
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
Comments
SSH remote sessions are run under the context of the client user. They are however network logon sessions and do not have user's credentials attached. DPAPI encryption and decryption only work with interactive logon sessions in general (or other specific logon sessions that have user's credentials attached), since these APIs actually use user's password to do the encryption and decryption. User profile is guaranteed to be loaded for the duration of the session. I dont think the issue you are running into is due to profiles (rather its becuase of the nature of remote logon session). |
Hi Manoj, Thank you for quick and detailed answer.
As I can see, they don't need to have it attached. From MSDN:
Unfortunately, I have not found the place in the code where this happens. Could you please point me to the code? Also, searching for "impersonation" term I have found the function LoadUserProfile and in the remarks I see:
|
User profile is loaded in ssh-agent (the Windows version is Windows specific. Load up the solution in Visual Studio and search for "LoadUserProfile" |
Found. Thank you. I will check how it works and write back. Please do not close this issue. |
Two questions:
|
For (1) Yes, with password auth, remote session has user creds. So DPAPI works. For (2) you will need to pass password explicitly for each operation needing authentication. Ex "net use" |
@manojampalam Hello Manoj, This issue seems to be related to an issue I am facing. Correct me if I'm wrong. If I logon via SSH with a user that is not the user specified in Log On tab of sshd windows service, and if I try to invoke cmdkey to list the Credential Manager keys, it would return empty list. Do you think it's due to network logon as well. But note that if I use the same user that is specified in Log On tab, it would work fine. Thank you |
@challarao I assume Credential manager would be locked using user's credentials. So if you login via password auth, you should be able to access it. As a security measure, you should run sshd only under its service account. |
When a Windows account user logs in, Win32-OpenSSH Server doesn't impersonate the security context of that Windows account throughout the user's SSH session.
From MSDN:
My colleague @zaufi and I received this error "Key not valid for use in specified state." when we run
nuget list
. The error happened because nuget's config contains external repos and encrypted passwords. As a workaround we decided to used-storepasswordincleartext
option, but hope this issue could be fixed in the near future.Also, please note, to reproduce this issue you need to test it after boot, but before a login. Even if you logout, the user profile remains impersonated.
The text was updated successfully, but these errors were encountered: