Files
DUO-RDP/native/cpp/README.md
T
2026-10-22 16:31:51 +02:00

92 lines
4.2 KiB
Markdown

# DUO-RDP native C++ release
This directory is the native replacement for the former C# pipe broker, Python
OTP HTTP server, Python admin UI and PyInstaller installer chain.
- `DuoRdpAuthService.exe` is a Windows service and the sole OTP runtime.
It keeps the existing `\\.\pipe\duordp-auth-pipe` JSONL v1 contract used by
the Credential Provider. It reads the existing machine-DPAPI configuration
format, sends Telegram messages with WinHTTP, verifies TOTP and stores OTP
sessions in-process.
- `DuoRdpAdmin.exe` is a native Win32 settings application. It self-elevates
with UAC, then talks to the service through its Administrator/SYSTEM-only
named pipe. The GUI never reads the DPAPI configuration directly. On its
first launch it asks for an administrator login and the same password twice;
later launches require that login and password before any 2FA value is read.
The password is stored only as a salted PBKDF2 verifier inside the same
machine-DPAPI protected config.json.
It manages users and groups, per-user/default Telegram targets, TOTP
generation, Telegram/TOTP proof, global rules and OTP limits.
- `DuoRdpInstaller.exe` and `DUOUnIstall.exe` are native installer/recovery
tools. The installer validates the DLL, starts and checks the pipe before it
enables the Credential Provider Filter. The uninstaller removes the filter
first and preserves config/logs unless `--purge-data` is explicit.
Manual resend semantics are intentional and testable: every `RequestOtp` from
the explicit Credential Provider button creates a replacement record. The
previous code is invalid immediately. Automatic Login-submit still sends at
most one initial code per user/tile; it tells the user to use the explicit
`Отправить новый одноразовый код` command for a new code.
The native release reads plaintext and machine-DPAPI (`ENCdpapi`) configs. An
existing legacy `ENCv1` config is intentionally rejected by the installer
*before* it changes a service or enables the Credential Provider Filter. Migrate
that config once with the old administration tool, then install the native
release; this gate prevents a fail-closed login lockout.
Every native GUI save writes a timestamped encrypted `config_*.json` backup
beside the active configuration before an atomic replacement. Changing a
user's Telegram token/target, TOTP secret or groups invalidates its verified
state; it becomes active again only after a real Telegram or TOTP proof.
Legacy numeric-ID and login-key duplicates are canonicalized into one numeric
row, so a stale token cannot win by map ordering.
When Credential Provider group discovery is incomplete, the service also
resolves local and global Windows group memberships before applying group
rules.
## Configure
1. Run `C:\Program Files\DuoRdp\DuoRdpAdmin.exe` as a local Administrator.
2. On the first opening, enter the administrator login and password twice.
On every later opening, enter that login and password once.
3. Add a user row, Telegram token/target and/or a TOTP secret. Use
**Generate TOTP** when needed.
4. Click **Apply row**, then **Save settings**.
5. Click **Send test**, enter the last received Telegram code (or the current
TOTP code), and click **Verify**.
6. Enable global 2FA only after at least one required row shows Verified.
The native window displays configured Telegram values and Google Authenticator
keys after administrator authentication; it does not mask them with asterisks.
The old `--admin` CLI remains only for scripted inspection and limited edits.
It no longer has a fake `--verify` switch; verification must happen through
the GUI proof flow.
## Build
MSVC 2022 / Windows SDK:
```powershell
cmake -S . -B build -A x64
cmake --build build --config Release
```
The included `scripts/mingw64-toolchain.cmake` supports a reproducible
cross-build on Linux with `x86_64-w64-mingw32-g++`.
## Acceptance checks
Run on Windows before any install:
```text
DuoRdpAuthService.exe --self-test
DuoRdpAuthService.exe --admin-self-test
DuoRdpAuthService.exe --pipe-self-test
DuoRdpInstaller.exe --self-test
```
Do not register the Credential Provider Filter until the service and the pipe
health check pass. A broken filter can remove the normal password tile from the
logon screen.