Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RDP Command Center

Windows desktop MVP for a high-DPI friendly RDP central management tool.

Recommended Technology Stack

First version:

  • Client UI: WPF on .NET 8/10, with a clean desktop management-console layout.
  • RDP engine: Microsoft RDP ActiveX hosted inside WPF through WindowsFormsHost.
  • Local data: SQLite.
  • Credentials: Windows DPAPI and Windows Credential Manager.
  • Proxy routing: local TCP forwarder for SOCKS5 and SSH tunnel profiles.
  • Monitoring: ICMP ping, TCP 3389 probe, lightweight RDP handshake probe.
  • Logging: local structured logs, later upgraded to central audit logs.

Why this stack:

  • Microsoft RDP ActiveX avoids rebuilding the RDP protocol, NLA, CredSSP, clipboard, audio, printer, disk redirection, and certificate behavior.
  • WPF is stable for Windows operations tooling and can host the RDP control.
  • DPAPI and Credential Manager fit the Windows security model better than a custom password store for the first release.
  • SQLite is enough for the single-machine MVP and can later sync to a central PostgreSQL/MySQL service.

Later versions can add WinUI 3 styling or a Web admin backend, but the RDP session client should remain native Windows until cross-platform support becomes a hard requirement.

This repository is intentionally shaped around the product direction from the attached specification:

  • centralized server grouping, tags, search, and detail panels
  • per-server DPI strategy profiles, with separate handling for Windows Server 2008 R2 and modern Windows Server versions
  • per-server route profiles for direct, SOCKS5, SSH tunnel, RD Gateway, and jump host style connection paths
  • monitor snapshots for ping, RDP port, handshake, alert, and probe status
  • an adapter boundary for hosting Microsoft RDP ActiveX rather than reimplementing the RDP protocol

Current State

The current project is a WPF prototype:

  • RdpManager/Models contains the domain model for groups, servers, DPI, proxies, monitoring, and generated RDP settings.
  • RdpManager/Services/DpiRecommendationService.cs generates host-specific DPI recommendations and .rdp style properties.
  • RdpManager/Services/ProxyRouteService.cs decides whether a connection should use the real target or a local forwarding endpoint such as 127.0.0.1:<port>.
  • RdpManager/Services/ConnectionProfileBuilder.cs composes the DPI and route layers into the profile that will be passed to the RDP control.
  • RdpManager/Adapters/RdpSessionAdapter.cs writes a generated .rdp file and opens an embedded RDP ActiveX session window, falling back to mstsc.exe if the embedded control cannot be created.
  • RdpManager/Views/RdpSessionWindow.xaml hosts the Microsoft RDP ActiveX control inside WPF through WindowsFormsHost.
  • RdpManager/Views/RdpSessionView.xaml hosts an RDP session inside a main window tab and provides session controls for disconnect, reconnect, DPI refresh, fullscreen, copy host, and copy username. It also polls the ActiveX connection state and automatically falls back to mstsc.exe when embedded startup fails.
  • RdpManager/Adapters/ActiveX/MsRdpClientHost.cs maps generated connection settings onto the RDP ActiveX control.
  • RdpManager/Adapters/Forwarding/Socks5Forwarder.cs starts a local no-auth SOCKS5 TCP forwarder for per-server SOCKS5 routes.
  • RdpManager/Views/ServerEditorWindow.xaml provides the add-server dialog.
  • RdpManager/Services/ServerRepository.cs persists the server list to local JSON under %LOCALAPPDATA%\RdpCommandCenter\servers.json.
  • RdpManager/Services/CredentialVaultService.cs encrypts saved passwords with Windows DPAPI for the current Windows user.
  • RdpManager/Services/CertificatePolicyService.cs blocks proxied routes unless a pinned RDP certificate thumbprint has been recorded for the server.
  • RdpManager/Services/RdpCertificateProbeService.cs performs an RDP negotiation preflight and reads the remote TLS certificate thumbprint with SslStream.
  • RdpManager/Services/ConnectionLogRepository.cs stores recent connection audit entries under %LOCALAPPDATA%\RdpCommandCenter\connection-log.json.
  • RdpManager/Services/AlertRepository.cs stores alert records under %LOCALAPPDATA%\RdpCommandCenter\alerts.json.
  • RdpManager/Views/AlertCenterWindow.xaml provides alert filtering, acknowledgement, silencing, and manual resolution.
  • RdpManager/Services/BackupService.cs exports and restores a JSON backup package containing servers, connection logs, alerts, and audit logs.
  • RdpManager/Views/BackupPreviewWindow.xaml validates and previews a backup before restore.
  • RdpManager/Services/AppSettingsRepository.cs stores user settings under %LOCALAPPDATA%\RdpCommandCenter\settings.json.
  • RdpManager/Views/SettingsWindow.xaml provides the settings center.
  • RdpManager/Views/ErrorDialogWindow.xaml provides a unified error dialog with copyable diagnostic details for import, export, backup, restore, and settings failures.
  • RdpManager/Services/AppLogService.cs writes startup and unhandled exception diagnostics to %LOCALAPPDATA%\RdpCommandCenter\app.log.
  • RdpManager/Services/AuditLogRepository.cs stores operator audit events in the SQLite database.
  • Repositories implement IDataRepository<T>, with JSON and SQLite collection repository implementations available.
  • RdpManager/Services/SqliteCollectionRepository.cs stores servers, connection logs, alerts, and audit logs in %LOCALAPPDATA%\RdpCommandCenter\rdp-command-center.db, with automatic migration from the older JSON files when SQLite is empty.
  • SQLite tables keep the JSON payload for compatibility and also maintain normalized searchable columns and indexes for servers, connection logs, alerts, and audit logs.
  • RdpManager.Cli provides maintenance commands such as writing DPAPI-encrypted credentials without launching the WPF UI.
  • RdpManager/Services/MonitorProbeService.cs performs live Ping and TCP RDP port checks for the selected server.
  • Monitoring supports queued concurrent probes, configurable concurrency, cancellation, and progress text for batch/background runs.
  • RdpManager/Services/ServerImportService.cs imports server records from CSV, .rdp, and mRemoteNG XML files.
  • RdpManager/Views/ImportPreviewWindow.xaml shows an import preview before changes are applied, including add/update/skip status and changed fields.
  • The import preview lets operators choose which field groups to overwrite: profile, credentials, route, DPI, and certificate.
  • .rdp folder import recursively scans a selected folder and sends the result through the same preview workflow.
  • Imports are merged by host:port: new endpoints are added, existing endpoints are updated in place, and saved encrypted passwords are preserved unless the imported record explicitly carries an encrypted password.
  • RdpManager/Services/ServerExportService.cs exports the currently filtered server list to CSV without plaintext passwords.
  • RdpManager/Views/BatchSettingsWindow.xaml applies DPI preference and proxy route changes to the currently filtered server list.
  • Batch settings can also update username, domain, group path, and tags for the currently filtered server list when those fields are provided.
  • RdpManager/Services/SearchFilterService.cs supports advanced search tokens such as tag:production os:2008 status:offline proxy:socks5.
  • RdpManager/ViewModels/MainWindowViewModel.cs provides sample groups and servers so the UI can be exercised before storage and live probes exist.

CSV import recognizes these headers when present:

name,host,port,group,os,tags,owner,proxyMode,proxyHost,proxyPort,description
Web-01,192.168.1.10,3389,Client A/Production,Windows Server 2019,"web,production",Ops,direct,,,
Legacy-01,10.20.8.12,3389,Client A/Production,Windows Server 2008 R2,"2008R2,finance",Alice,socks5,127.0.0.1,1080,Legacy finance server

mRemoteNG XML import:

  • Recursively imports Node entries with Protocol="RDP".
  • Preserves mRemoteNG container paths as groups.
  • Imports host, port, username, domain, and description.
  • Encrypted mRemoteNG passwords are not imported.

Import conflict handling:

  • Existing servers are matched by host and port.
  • Matching records are updated instead of duplicated.
  • Name, group, OS hint, owner, description, tags, DPI, proxy, username, domain, and pinned certificate data can be refreshed from the import.
  • Existing DPAPI-encrypted saved passwords are kept unless an imported record contains an encrypted password value.
  • The preview grid lets an operator uncheck individual records before applying the import.
  • Folder import can recursively load .rdp files and then applies the same conflict rules.

Credential handling:

  • Usernames and domains can be stored per server.
  • Passwords are optional.
  • Saved passwords are encrypted with Windows DPAPI for the current user.
  • Generated .rdp files include the username only, never the password.
  • CSV import does not import plaintext passwords.

Certificate handling:

  • Each server can store a pinned RDP certificate thumbprint.
  • SOCKS5/SSH-style local forwarding routes are blocked until a thumbprint is recorded.
  • Pre-check attempts to discover the RDP TLS certificate thumbprint automatically.
  • Certificate probing first uses RDP negotiation and then falls back to direct TLS, with stage-specific failure messages.
  • If no thumbprint is pinned yet, a successful probe stores it.
  • If a later probe sees a different thumbprint, the server is marked CertificateChanged.
  • CSV import recognizes thumbprint, certificate, or certThumbprint.

Search syntax examples:

tag:production os:2008
status:offline proxy:socks5
group:Production owner:Ops
web status:online

Connection logging:

  • Each connection attempt records time, server, target address, proxy mode, DPI mode, route summary, and result.
  • The local log keeps the latest 1000 records.
  • The selected server detail panel shows recent connection history for that server, matched by server id or host:port.
  • The connection history window provides a full searchable table across all connection records.
  • Current MVP records launch success or adapter failure; session duration can be added after the embedded RDP ActiveX host is implemented.

Audit logging:

  • Add, edit, delete, import, export, restore, settings, connect, pre-check, and batch probe operations are written to SQLite.
  • Recent audit entries are visible in the main detail panel.
  • The audit log window provides a full searchable table across all audit entries.
  • Audit entries are also mirrored into app.log with an AUDIT prefix.

Group management:

  • The group management window lists current groups and servers.
  • Operators can move a selected server to a new group.
  • Operators can rename a group path across matching servers.

UI polish:

  • Connection history and audit windows include searchable tables, consistent table borders, tooltips, and empty-state messages.
  • Restore uses a dedicated preview dialog instead of a destructive confirmation prompt.

Alert center:

  • Pre-check and batch check generate alerts for offline, RDP port closed, certificate changed, proxy unavailable, slow response, and related states.
  • Alert rules in settings control failure-count threshold, slow-response threshold, and whether ping, RDP port, certificate change, and slow response alerts are enabled.
  • Returning to Online automatically resolves open alerts for that server.
  • The dashboard shows the current open alert count and recent open alerts.
  • The alert center can filter alerts, acknowledge them, silence them for one hour, or resolve them manually.

Backup and restore:

  • Toolbar actions export or restore *.rdpcc-backup.json packages.
  • Packages include servers, connection logs, alerts, audit logs, package version, and export time.
  • Restore validates package version, server hosts, and duplicate endpoints before applying changes.
  • Restore opens a preview window showing package counts and export time before the operator confirms.
  • When enabled, restore first writes an automatic backup under %LOCALAPPDATA%\RdpCommandCenter\Backups.
  • Automatic backups are pruned by the configured retention count.
  • Passwords remain DPAPI-encrypted in the package. They are intended to restore for the same Windows user profile.

Runtime diagnostics:

  • Startup and unhandled exceptions are written to %LOCALAPPDATA%\RdpCommandCenter\app.log.
  • The app has been smoke-tested to stay alive for at least 5 seconds after startup in the local desktop environment.
  • The P0 smoke test starts the WPF executable, waits 5 seconds, then closes it cleanly.

Settings center:

  • Default port, username, group, and DPI preference.
  • Pre-check timeout and log retention days.
  • Optional background monitoring and monitoring interval.
  • Background monitoring concurrency.
  • Alert rule controls for failure count, slow response threshold, and alert type switches.
  • Restore safety controls for automatic backup-before-restore and automatic backup retention count.
  • Enforce certificate thumbprint for tunneled/proxied routes.
  • Prefer external mstsc.exe instead of embedded ActiveX. This startup strategy applies on the next app launch.

Background monitoring:

  • Disabled by default.
  • When enabled, the app periodically checks all servers with the same Ping/TCP and certificate logic used by manual pre-check.
  • Alerts are generated or resolved automatically during background checks.

Roadmap priority:

  • P0 completed: SQLite normalized projection columns and indexes, real WPF startup smoke test, unified error dialog.
  • P1 later: permission and role model.
  • P2 later: connection history and audit log export.

CLI maintenance:

dotnet RdpManager.Cli\bin\Debug\net8.0-windows\RdpManager.Cli.dll set-credential <host> <port> <username> <password>

This updates the matching local server record with a DPAPI-encrypted password.

MVP Implementation Path

  1. Host Microsoft RDP ActiveX inside WPF through WindowsFormsHost.
  2. Feed RdpConnectionSettings.RdpHostForControl, RdpPortForControl, and RdpProperties into the RDP adapter.
  3. Add a local TCP forwarder for SOCKS5 and SSH tunnel profiles.
  4. Store groups, servers, DPI profiles, monitor profiles, and proxy profiles in SQLite.
  5. Store credentials with Windows DPAPI or Windows Credential Manager.
  6. Replace sample monitoring snapshots with ping, TCP 3389, and RDP handshake probes.
  7. Add certificate thumbprint pinning before allowing proxied RDP sessions.

Build

cd D:\codex\rdp\RdpManager
dotnet build

The project targets net8.0-windows and uses WPF.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages