Skip to content

fix(pam-rdp): stable acceptor certificate - #376

Merged
bernie-g merged 3 commits into
mainfrom
bernie/pam-rdp-mstsc-cert
Aug 27, 2026
Merged

fix(pam-rdp): stable acceptor certificate#376
bernie-g merged 3 commits into
mainfrom
bernie/pam-rdp-mstsc-cert

Conversation

@bernie-g

Copy link
Copy Markdown
Contributor

The RDP acceptor generated a fresh self-signed certificate per session, so mstsc's second connection saw a different cert than the one the user had just approved and aborted the handshake.

The acceptor generated a fresh self-signed certificate per session. mstsc
opens a second connection after the user accepts the certificate dialog and
compares the certificate it receives against the one just approved, so a
per-session cert never matched and it aborted the second handshake with "an
unexpected server authentication certificate was received from the remote
computer". Generate it once per process instead.

Also adds the logging that made this diagnosable: the crate depended on
tracing but nothing installed a subscriber, so every event from the bridge
and IronRDP was discarded and failures surfaced as a bare status code. The
Rust error string now reaches Go and zerolog instead of a static sentinel.

sspi is pinned to info in the default filter regardless of LOG_LEVEL; it logs
serialized TSCredentials, which contain the injected password in cleartext,
at debug and below.
@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-376-fix-pam-rdp-stable-acceptor-certificate

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@socket-security

socket-security Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​tracing-subscriber@​0.3.239910093100100

View full report

Comment thread packages/pam/handlers/rdp/native/src/logging.rs
@veria-ai

veria-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR stabilizes the PAM RDP acceptor certificate for the lifetime of the CLI process so reconnecting RDP clients see the certificate they previously approved.

  • Caches matching acceptor TLS and CredSSP public-key material in a process-global OnceLock.
  • Adds Rust tracing initialization and timing diagnostics for RDP and CredSSP failures while keeping credential-bearing SSPI logs disabled by default.
  • Propagates detailed Rust session errors through the C ABI to the Go bridge and logs failed sessions with session and target context.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code-triggered correctness, security, portability, or SSRF defect identified.

The cached certificate and CredSSP key remain consistent, the new FFI error path is bounded and used before handle cleanup, and logging defaults avoid enabling credential-bearing SSPI diagnostics.

Important Files Changed

Filename Overview
packages/pam/handlers/rdp/native/src/bridge.rs Reuses internally consistent TLS certificate and CredSSP public-key material across process-local RDP sessions and adds protocol timing diagnostics.
packages/pam/handlers/rdp/native/src/ffi.rs Stores session failure details and exposes a bounded, UTF-8-safe C ABI accessor whose lifecycle matches the Go wait-before-free contract.
packages/pam/handlers/rdp/bridge_cgo_shared.go Retrieves Rust failure details before freeing the bridge and adds contextual session-failure logging.
packages/pam/handlers/rdp/native/src/logging.rs Installs an idempotent tracing subscriber and prevents ordinary LOG_LEVEL changes from enabling credential-bearing SSPI debug output.
packages/pam/handlers/rdp/native/Cargo.toml Adds the pure-Rust tracing subscriber dependency with a restricted feature set.
packages/pam/handlers/rdp/native/include/rdp_bridge.h Extends the bridge ABI with the bounded last-session-error retrieval contract.

Reviews (1): Last reviewed commit: "fix(pam-rdp): stable acceptor certificat..." | Re-trigger Greptile

@bernie-g
bernie-g merged commit 7a8fece into main Aug 27, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants