Security Mode Overview
| Mode | CLI flag | rdpSettings keys | Description |
|---|---|---|---|
| RDP Security | /sec:rdp | FreeRDP_RdpSecurity | Legacy RC4/RSA encryption layer, no server authentication |
| TLS | /sec:tls | FreeRDP_TlsSecurity | TLS transport, no pre-auth |
| NLA | /sec:nla | FreeRDP_NlaSecurity | CredSSP over TLS: authenticates both client and server before session |
| RDSTLS | /sec:rdstls | (negotiated) | Redirection over TLS with credentials |
nego.c. The client advertises its supported protocols and the server selects one. FreeRDP defaults to preferring NLA.
Transport Security: TLS
Once the protocol negotiation selects TLS or NLA,transport.c upgrades the raw TCP socket to a TLS channel. FreeRDP supports three TLS backends selected at build time:
| Backend | CMake flag | Notes |
|---|---|---|
| OpenSSL | WITH_OPENSSL (default) | Full feature set; supports TLS 1.0–1.3 |
| LibreSSL | (OpenSSL-compatible) | Drop-in OpenSSL replacement |
| MbedTLS | WITH_MBEDTLS | Lightweight, used for embedded targets |
Authentication: NLA / CredSSP
NLA (Network Level Authentication) wraps a CredSSP exchange inside the TLS channel. CredSSP carries SPNEGO tokens that negotiate either NTLM or Kerberos.NTLM
FreeRDP’s NTLM implementation lives in WinPR (libwinpr/sspi/NTLM/). It is always available without additional dependencies.
Kerberos
Kerberos support requires an MIT Kerberos or Heimdal installation at build time:| CMake flag | Library |
|---|---|
WITH_KERBEROS + MIT | MIT krb5 (/usr/lib/libkrb5.so) |
WITH_KERBEROS + Heimdal | Heimdal (/usr/lib/libkrb5.so from Heimdal) |
kinit are used automatically.
NLA API
Authentication Callbacks
Credentials are supplied to FreeRDP through callbacks set on thefreerdp instance. The preferred callback is AuthenticateEx, which also receives the reason for the prompt:
Smartcard / PKCS#11 Logon
FreeRDP supports smartcard-based NLA authentication. When smartcard logon is in use:freerdp_settings_set_bool(settings, FreeRDP_SmartcardLogon, TRUE)is set.- The
ChooseSmartcardcallback on thefreerdpinstance is called when multiple smartcard certificates are detected:
- For PKCS#11 token access, the PKCS#11 module path is set via
FreeRDP_Pkcs11Module. - The
AUTH_SMARTCARD_PINreason inAuthenticateExis used to prompt for the card PIN.
channels/smartcard/) handles runtime smartcard operations during the active session separately from NLA logon.
Certificate Verification
FreeRDP provides two certificate verification callback mechanisms on thefreerdp instance. VerifyX509Certificate is the recommended modern approach (full PEM chain):
VERIFY_CERT_FLAG_* Constants
Defined in include/freerdp/freerdp.h:
| Flag | Value | Meaning |
|---|---|---|
VERIFY_CERT_FLAG_NONE | 0x00 | Normal new certificate |
VERIFY_CERT_FLAG_LEGACY | 0x02 | Legacy SHA-1 fingerprint path |
VERIFY_CERT_FLAG_REDIRECT | 0x10 | Certificate seen during a server redirect |
VERIFY_CERT_FLAG_GATEWAY | 0x20 | Certificate belongs to the RD Gateway |
VERIFY_CERT_FLAG_CHANGED | 0x40 | Certificate differs from stored fingerprint |
VERIFY_CERT_FLAG_MISMATCH | 0x80 | Certificate subject does not match hostname |
VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 | 0x100 | Fingerprint matches legacy SHA-1 stored value |
VERIFY_CERT_FLAG_FP_IS_PEM | 0x200 | fingerprint argument contains PEM data, not a hash |
Certificate Persistence
FreeRDP ships a certificate store (include/freerdp/crypto/certificate_store.h) that saves accepted certificate fingerprints on disk (typically ~/.config/freerdp/known_hosts2). When a certificate is encountered:
- Not found →
VerifyCertificateEx/VerifyX509Certificateis called. - Found, matches → connection proceeds silently.
- Found, changed →
VerifyChangedCertificateExis called (flags includeVERIFY_CERT_FLAG_CHANGED).
AAD / Azure Virtual Desktop
FreeRDP 3.x adds OAuth2 / Azure Active Directory token support for Azure Virtual Desktop (AVD) connections via theGetAccessToken callback:
Security Checklist
Always use NLA in production
Always use NLA in production
NLA authenticates the server before any session data is exchanged, preventing credential exposure to a rogue server. Set
FreeRDP_NlaSecurity = TRUE and FreeRDP_RdpSecurity = FALSE.Implement certificate verification
Implement certificate verification
Always implement
VerifyX509Certificate or VerifyCertificateEx. At minimum, reject connections with VERIFY_CERT_FLAG_MISMATCH set. Consider pinning the expected fingerprint in FreeRDP_CertificateAcceptedFingerprints.Avoid storing passwords in settings long-term
Avoid storing passwords in settings long-term
Set credentials in
AuthenticateEx on demand rather than baking them into settings at startup. This reduces the window during which a password is resident in memory.Keep the TLS backend up to date
Keep the TLS backend up to date
FreeRDP inherits the TLS implementation from its backend. Ensure OpenSSL / MbedTLS is current to benefit from security patches.
