mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
core, channels: client-side remote credential guard
This patch implements the client-side part of the remote credential guard feature as described in MS-RDPEAR. The 2 main changes are: shipping the TSRemoteGuardaCreds in NLA, and implement the rdpear channel that allows LSASS to remote all the calls to our client. For now it's UNIX only as the windows implementation would be implemented in a completely different way. To test, you may establish you ccache and then connect with (RCG enabled on the server): xfreerdp /remoteGuard /u:<user> /d:<domain> /v<server> That should log you in, and in the session you should not be asked for credentials when doing mstsc /remoteGuard /v:<other server>.
This commit is contained in:
39
include/freerdp/channels/rdpear.h
Normal file
39
include/freerdp/channels/rdpear.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Authentication redirection channel
|
||||
*
|
||||
* Copyright 2023 David Fort <contact@hardening-consulting.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CHANNEL_RDPEAR_H
|
||||
#define FREERDP_CHANNEL_RDPEAR_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/dvc.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#define RDPEAR_CHANNEL_NAME "rdpear"
|
||||
#define RDPEAR_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::AuthRedirection"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CHANNEL_RDPEAR_H */
|
||||
@@ -23,6 +23,7 @@
|
||||
#define FREERDP_H
|
||||
|
||||
#include <winpr/stream.h>
|
||||
#include <winpr/sspi.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
@@ -538,10 +539,10 @@ owned by rdpRdp */
|
||||
It is used to get the username/password. The reason
|
||||
argument tells why it was called. */
|
||||
ALIGN64 pChooseSmartcard
|
||||
ChooseSmartcard; /* (offset 70)
|
||||
Callback for choosing a smartcard for logon.
|
||||
Used when multiple smartcards are available. Returns an index into a list
|
||||
of SmartcardCertInfo pointers */
|
||||
ChooseSmartcard; /* (offset 70)
|
||||
Callback for choosing a smartcard for logon.
|
||||
Used when multiple smartcards are available. Returns an index into a list
|
||||
of SmartcardCertInfo pointers */
|
||||
ALIGN64 pGetAccessToken GetAccessToken; /* (offset 71)
|
||||
Callback for obtaining an access token
|
||||
for \b AccessTokenType authentication */
|
||||
@@ -660,6 +661,40 @@ owned by rdpRdp */
|
||||
|
||||
FREERDP_API UINT32 freerdp_get_nla_sspi_error(rdpContext* context);
|
||||
|
||||
/** Encrypts the provided buffer using the NLA's GSSAPI context
|
||||
*
|
||||
* \param context the RDP context
|
||||
* \param inBuffer the SecBuffer buffer to encrypt
|
||||
* \param outBuffer a SecBuffer to hold the encrypted content
|
||||
* \returns if the operation completed successfully
|
||||
* \since version 3.9.0
|
||||
*/
|
||||
FREERDP_API BOOL freerdp_nla_encrypt(rdpContext* context, const SecBuffer* inBuffer,
|
||||
SecBuffer* outBuffer);
|
||||
|
||||
/** Decrypts the provided buffer using the NLA's GSSAPI context
|
||||
*
|
||||
* \param context the RDP context
|
||||
* \param inBuffer the SecBuffer buffer to decrypt
|
||||
* \param outBuffer a SecBuffer to hold the decrypted content
|
||||
* \returns if the operation completed successfully
|
||||
* \since version 3.9.0
|
||||
*/
|
||||
FREERDP_API BOOL freerdp_nla_decrypt(rdpContext* context, const SecBuffer* inBuffer,
|
||||
SecBuffer* outBuffer);
|
||||
|
||||
/** Calls QueryContextAttributes on the SSPI context associated with the NLA part of
|
||||
* the RDP context
|
||||
*
|
||||
* \param context the RDP context
|
||||
* \param ulAttr the attribute
|
||||
* \param pBuffer an opaque pointer depending on ulAttr
|
||||
* \returns a SECURITY_STATUS indicating if the operation completed successfully
|
||||
* \since version 3.9.0
|
||||
*/
|
||||
FREERDP_API SECURITY_STATUS freerdp_nla_QueryContextAttributes(rdpContext* context,
|
||||
DWORD ulAttr, PVOID pBuffer);
|
||||
|
||||
FREERDP_API void clearChannelError(rdpContext* context);
|
||||
FREERDP_API HANDLE getChannelErrorEventHandle(rdpContext* context);
|
||||
FREERDP_API UINT getChannelError(rdpContext* context);
|
||||
|
||||
Reference in New Issue
Block a user