From d60c0bb5bee64f03f0f7b53eae531e8e53b5cb89 Mon Sep 17 00:00:00 2001 From: SoGi Date: Fri, 13 Nov 2026 20:44:59 +0100 Subject: [PATCH] Package native DUO-RDP 2.2.0 with Inno Setup wizard --- CHANGELOG.md | 9 +++ CMakeLists.txt | 2 +- README.md | 28 ++++++++ THIRD_PARTY_NOTICES.md | 2 + docs/installer-2.2.0-validation.md | 35 +++++++++ native/cpp/DuoRdpInstaller.cpp | 17 +++-- packaging/DuoRdp.iss | 111 +++++++++++++++++++++++++++++ packaging/README.txt | 17 +++++ packaging/description.ru.txt | 6 ++ scripts/package_release.py | 61 ++++++++++++++++ 10 files changed, 280 insertions(+), 8 deletions(-) create mode 100644 docs/installer-2.2.0-validation.md create mode 100644 packaging/DuoRdp.iss create mode 100644 packaging/README.txt create mode 100644 packaging/description.ru.txt create mode 100644 scripts/package_release.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 378dd37..aa9b5b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 2.2.0 - Windows installer + +- Inno Setup 7 wizard, RU/UK/EN, Start-menu and optional desktop shortcuts. +- Native C++ service/CP installation remains authoritative; installer errors stop the wizard. +- Added --no-launch for unattended native installation and finish-page admin launch. +- Existing runtime blocks replacement; uninstall/reinstall retains config and keys. +- Windows Apps removal invokes native filter-first recovery without purging data. +- Reproducible packaging script with an explicit payload allowlist. + # Changelog ## 2.1.0-native-admin-final - 2026-10-22 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eb22ba..bcf1b0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.21) -project(DuoRdpNative VERSION 2.0.0 LANGUAGES CXX) +project(DuoRdpNative VERSION 2.2.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/README.md b/README.md index e83738a..5b81e0d 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,31 @@ docs/ актуальные эксплуатаци ## Важное ограничение Credential Provider Filter скрывает штатную password tile на logon/unlock. Устанавливать DUO-RDP на удалённый сервер без console/recovery-доступа нельзя. Installer включает Filter только после проверки payload, сервиса и live pipe, но это не отменяет необходимость плана восстановления. + +## Windows installer 2.2.0 + +Run `DUO-RDP-Setup-2.2.0-x64.exe` from Releases. The Inno Setup 7 wizard +(Russian/Ukrainian/English) requests Administrator rights, installs to +`C:\Program Files\DuoRdp`, adds Start-menu shortcuts and an optional desktop +shortcut, and registers removal in Windows Apps. Python is not required. +The native C++ installer still performs service/pipe health checks before +enabling the Credential Provider Filter. Admin opens only when requested on +the finish page (never during silent installation). + +Existing installations are deliberately blocked before any runtime changes. +To upgrade, uninstall the previous version first; config.json, admin credentials, +Telegram/TOTP keys and backups are kept. Restart Windows if the loaded CP DLL +cannot be removed. Reinstall on the same computer to retain DPAPI decryption. +No real configuration or secrets are included in either package. + +Build with `bash scripts/build_native.sh`, then: + +```text +python scripts/package_release.py --dist build/native-cmake/release --iscc C:/Inno/ISCC.exe +``` + +On Linux, use MinGW and add `--wine /usr/lib/wine/wine64` under `xvfb-run -a`. +The build creates Setup.exe and a portable installation/recovery ZIP from an +explicit binary allowlist. Source ZIP must be generated from the release tag. +The UI follows KeySwitcher desktop/installer/KeySwitcher.iss; per-user startup +settings are intentionally replaced by DUO-RDP's machine-wide Windows service. diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 648002b..af5225e 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -3,3 +3,5 @@ Current native runtime собирается CMake/C++20 и использует Windows SDK APIs (Credential Provider, SCM, DPAPI, WinHTTP, BCrypt, CryptoAPI). `mini_json.hpp` находится в этом репозитории и поставляется как часть исходников. Сторонние runtime-библиотеки не включены в текущий native release. Инструменты сборки (Visual Studio Build Tools, Windows SDK, CMake или MinGW-w64) устанавливаются отдельно по их собственным лицензиям. + +The Windows Setup executable is generated by Inno Setup 7 (Jordan Russell and Martijn Laan), https://jrsoftware.org/isinfo.php. Inno Setup is a build tool; its compiler is not distributed in this repository. MinGW-w64 builds statically link their GCC runtime under its runtime library exception. diff --git a/docs/installer-2.2.0-validation.md b/docs/installer-2.2.0-validation.md new file mode 100644 index 0000000..f221aa5 --- /dev/null +++ b/docs/installer-2.2.0-validation.md @@ -0,0 +1,35 @@ +# Installer 2.2.0 validation + +Implementation reference: sogerien/sogerien-keyswitcher, +`desktop/installer/KeySwitcher.iss` and `desktop/build.py` on main, read from +Gitea API. Current desktop uses Inno Setup 7, not the older NSIS packaging. + +DUO-RDP uses Inno Setup 7.1.1, SetupArchitecture=x64, x64os only, elevated +machine-wide installation at the fixed native Program Files path. +The compiler was run under Wine 9 with Xvfb; C++20 targets were rebuilt +using CMake/Ninja and MinGW-w64. Existing compiler warnings in CP COM classes +about nonvirtual destructors remain; CP sources are unchanged. + +Passed on Windows node-sogerien-rdp using extracted release binaries: + +- Installer --self-test. +- Service --self-test (OTP challenge isolation/resend/legacy compatibility). +- Service --admin-self-test (config normalization, groups and PBKDF2 compatibility). +- Setup /VERYSILENT /SUPPRESSMSGBOXES /NORESTART correctly refused an existing + installation with exit 7 and the expected log message. +- Live config SHA-256 unchanged; live service Running before and after. +- Transferred Setup SHA-256 matched the local artifact. + +Publication also validates source/portable ZIP integrity, exact portable file +allowlist, main/tag commit identity, repository privacy, and downloaded artifact +SHA-256. See release SHA256SUMS.txt for the actual published bytes. + +Not validated: complete fresh install/uninstall on a clean Windows VM, +interactive wizard appearance, and real RDP login with this freshly rebuilt +payload. No installation or replacement of live runtime was performed. +A Wine launch of Setup is not a substitute for these Windows checks. + +Upgrade procedure: uninstall previous runtime while keeping config, reboot if +a loaded CP DLL remains locked, then install the new package on the same +computer. Uninstall removes native filter/provider/service first and retains +configuration, logs, backup files and the standalone recovery executable. diff --git a/native/cpp/DuoRdpInstaller.cpp b/native/cpp/DuoRdpInstaller.cpp index 4f278c7..3bd9acf 100644 --- a/native/cpp/DuoRdpInstaller.cpp +++ b/native/cpp/DuoRdpInstaller.cpp @@ -282,7 +282,7 @@ bool pipe_health(std::wstring& error) { return false; } -int install(const std::wstring& payloadDirectory) { +int install(const std::wstring& payloadDirectory, bool launchAdmin) { if (!is_elevated()) { std::fputs("Installer requires an elevated administrator token.\n", stderr); return 2; @@ -352,6 +352,7 @@ int install(const std::wstring& payloadDirectory) { return 1; } std::wprintf(L"DUO-RDP native C++ installation complete: %s\n", installDirectory.c_str()); + if (!launchAdmin) return 0; const HINSTANCE launched = ShellExecuteW(nullptr, L"open", (installDirectory + L"\\DuoRdpAdmin.exe").c_str(), nullptr, installDirectory.c_str(), SW_SHOWNORMAL); if (reinterpret_cast(launched) <= 32) { std::fwprintf(stderr, L"Installation is complete, but open DuoRdpAdmin.exe manually (ShellExecute error=%lld).\n", static_cast(reinterpret_cast(launched))); @@ -392,7 +393,7 @@ int uninstall(bool purgeData) { } void usage() { - std::puts("DuoRdpInstaller.exe --install [--payload ] | --uninstall [--purge-data] | --self-test"); + std::puts("DuoRdpInstaller.exe --install [--payload ] [--no-launch] | --uninstall [--purge-data] | --self-test"); } bool run_self_test() { @@ -443,12 +444,14 @@ int wmain(int argc, wchar_t** argv) { const std::wstring_view command = argv[1]; if (command == L"--install") { std::wstring payload = module_directory() + L"\\payload"; - if (argc == 4 && std::wstring_view(argv[2]) == L"--payload") payload = argv[3]; - else if (argc != 2) { - usage(); - return 2; + bool launchAdmin = true; + for (int i = 2; i < argc; ++i) { + const std::wstring_view option = argv[i]; + if (option == L"--no-launch") launchAdmin = false; + else if (option == L"--payload" && i + 1 < argc) payload = argv[++i]; + else { usage(); return 2; } } - return install(payload); + return install(payload, launchAdmin); } if (command == L"--uninstall") { if (argc > 3 || (argc == 3 && std::wstring_view(argv[2]) != L"--purge-data")) { diff --git a/packaging/DuoRdp.iss b/packaging/DuoRdp.iss new file mode 100644 index 0000000..907610d --- /dev/null +++ b/packaging/DuoRdp.iss @@ -0,0 +1,111 @@ +#ifndef AppVersion +#define AppVersion "2.2.0" +#endif +#ifndef AppDist +#define AppDist "..\build\native-cmake\release" +#endif +#ifndef ReleaseDir +#define ReleaseDir "..\artifacts" +#endif +[Setup] +AppId={{F4A9EF74-875E-4C47-BC5B-451F169F4D22} +AppName=DUO-RDP +AppVersion={#AppVersion} +AppPublisher=Sogerien +DefaultDirName={autopf}\DuoRdp +DefaultGroupName=DUO-RDP +PrivilegesRequired=admin +SetupArchitecture=x64 +ArchitecturesAllowed=x64os +ArchitecturesInstallIn64BitMode=x64os +MinVersion=10.0 +DisableDirPage=yes +UsePreviousAppDir=no +DisableProgramGroupPage=yes +DisableWelcomePage=no +WizardStyle=modern +WizardSizePercent=112 +SetupMutex=DuoRdpSetup +OutputDir={#ReleaseDir} +OutputBaseFilename=DUO-RDP-Setup-{#AppVersion}-x64 +Compression=lzma2 +SolidCompression=yes +UninstallDisplayName=DUO-RDP +UninstallDisplayIcon={app}\DuoRdpAdmin.exe +CloseApplications=no +RestartApplications=no +InfoBeforeFile=description.ru.txt +VersionInfoVersion={#AppVersion}.0 +VersionInfoDescription=DUO-RDP Setup +VersionInfoProductName=DUO-RDP +[Languages] +Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" +Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl" +Name: "english"; MessagesFile: "compiler:Default.isl" +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked +[Files] +Source: "{#AppDist}\DuoRdpInstaller.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#AppDist}\DuoRdpInstaller.exe"; Flags: dontcopy +Source: "{#AppDist}\payload\DuoRdpAuthService.exe"; Flags: dontcopy +Source: "{#AppDist}\payload\DuoRdpAdmin.exe"; Flags: dontcopy +Source: "{#AppDist}\payload\DuoRdpCredentialProvider.dll"; Flags: dontcopy +Source: "{#AppDist}\payload\DUOUnIstall.exe"; Flags: dontcopy +Source: "..\LICENSE"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\THIRD_PARTY_NOTICES.md"; DestDir: "{app}"; Flags: ignoreversion +Source: "README.txt"; DestDir: "{app}"; Flags: ignoreversion +[Icons] +Name: "{group}\DUO-RDP Admin"; Filename: "{app}\DuoRdpAdmin.exe" +Name: "{group}\Uninstall DUO-RDP"; Filename: "{uninstallexe}" +Name: "{autodesktop}\DUO-RDP Admin"; Filename: "{app}\DuoRdpAdmin.exe"; Tasks: desktopicon +[Run] +Filename: "{app}\DuoRdpAdmin.exe"; Description: "DUO-RDP Admin"; Flags: nowait postinstall skipifsilent runascurrentuser +[Code] +function PrepareToInstall(var NeedsRestart: Boolean): String; +var + ExitCode: Integer; +begin + Result := ''; + if CompareText(ExpandConstant('{app}'), ExpandConstant('{autopf}\DuoRdp')) <> 0 then + begin + Result := 'DUO-RDP must be installed in Program Files\DuoRdp. Remove the /DIR override.'; + exit; + end; + // Never overwrite a running service or a DLL loaded by LogonUI. + if RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\DuoRdpAuthService') or + FileExists(ExpandConstant('{app}\DuoRdpAuthService.exe')) or + FileExists(ExpandConstant('{app}\DuoRdpCredentialProvider.dll')) then + begin + Result := 'DUO-RDP is already installed. Uninstall the previous version first (config.json and keys are kept), then run Setup again. Restart Windows if a file is locked.'; + exit; + end; + ExtractTemporaryFile('DuoRdpInstaller.exe'); + ExtractTemporaryFile('DuoRdpAuthService.exe'); + ExtractTemporaryFile('DuoRdpAdmin.exe'); + ExtractTemporaryFile('DuoRdpCredentialProvider.dll'); + ExtractTemporaryFile('DUOUnIstall.exe'); + if not Exec(ExpandConstant('{tmp}\DuoRdpInstaller.exe'), + ExpandConstant('--install --no-launch --payload "{tmp}"'), + ExpandConstant('{tmp}'), SW_HIDE, ewWaitUntilTerminated, ExitCode) then + Result := 'Cannot start the native DUO-RDP installer.' + else if ExitCode <> 0 then + Result := 'Native installation failed (code ' + IntToStr(ExitCode) + '). Use DUOUnIstall.exe from the portable package for recovery. Setup has not completed.'; +end; + +function InitializeUninstall(): Boolean; +var + ExitCode: Integer; +begin + Result := False; + // Native recovery removes filter FIRST, then provider/service. Keep config. + if not FileExists(ExpandConstant('{app}\DUOUnIstall.exe')) then + begin + MsgBox('Native recovery executable is missing. Restore DUOUnIstall.exe from the release package before uninstalling.', mbError, MB_OK); + exit; + end; + if Exec(ExpandConstant('{app}\DUOUnIstall.exe'), '--uninstall', + ExpandConstant('{app}'), SW_HIDE, ewWaitUntilTerminated, ExitCode) then + Result := ExitCode = 0; + if not Result then + MsgBox('Native uninstall failed. Files and Windows uninstall entry have been kept for recovery.', mbError, MB_OK); +end; diff --git a/packaging/README.txt b/packaging/README.txt new file mode 100644 index 0000000..de81737 --- /dev/null +++ b/packaging/README.txt @@ -0,0 +1,17 @@ +DUO-RDP 2.2.0 + +Run DUO-RDP-Setup-2.2.0-x64.exe as Administrator. +Requires Windows 10/11 x64 or Windows Server 2016+. ARM64 is not supported. +Install path: C:\Program Files\DuoRdp (fixed by the native engine). +Open DUO-RDP Admin from Start. First run creates an admin login/password. +Existing config.json, admin login, Telegram/TOTP keys are preserved. + +Upgrade: uninstall the previous version first, then install this release. +Settings are kept. Restart Windows if a Credential Provider DLL is locked. +Uninstall: Windows Settings > Apps > DUO-RDP. No config purge is performed. +Recovery: run DUOUnIstall.exe as Administrator from the portable release. +Do not close the current RDP session until 2FA has been configured and tested. + +Build: scripts/build_native.sh, then Python scripts/package_release.py --dist + --iscc . Use Inno Setup 7. +Portable ZIP is an installation/recovery layout, not an unregistered RDP app. diff --git a/packaging/description.ru.txt b/packaging/description.ru.txt new file mode 100644 index 0000000..2700446 --- /dev/null +++ b/packaging/description.ru.txt @@ -0,0 +1,6 @@ +DUO-RDP 2.2.0 - нативная двухфакторная защита входа Windows/RDP. + +Требуются права администратора и Windows 10/11 x64 или Windows Server 2016+. +Конфиг, Telegram и Google Authenticator ключи не входят в пакет. +Существующие настройки сохраняются. Для обновления сначала удалите прежнюю версию. +После установки откройте админку, настройте и проверьте 2FA перед выходом из текущей сессии. diff --git a/scripts/package_release.py b/scripts/package_release.py new file mode 100644 index 0000000..815f26c --- /dev/null +++ b/scripts/package_release.py @@ -0,0 +1,61 @@ +"""Package the native CMake install layout with Inno Setup 7. + +Windows: python scripts/package_release.py --dist build/native/release --iscc C:/Inno/ISCC.exe +Linux: add --wine /usr/lib/wine/wine64 (run under xvfb-run when headless). +""" +from __future__ import annotations + +import argparse +import hashlib +from pathlib import Path +import re +import subprocess +import zipfile + +ROOT = Path(__file__).resolve().parent.parent +REQUIRED = ( + "DuoRdpInstaller.exe", "DUOUnIstall.exe", "payload/DUOUnIstall.exe", + "payload/DuoRdpAuthService.exe", "payload/DuoRdpAdmin.exe", + "payload/DuoRdpCredentialProvider.dll", +) + + +def windows_path(path: Path, wine: str | None) -> str: + return "Z:" + str(path.resolve()).replace("/", "\\") if wine else str(path.resolve()) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--dist", type=Path, required=True) + parser.add_argument("--iscc", type=Path, required=True) + parser.add_argument("--wine") + parser.add_argument("--output", type=Path, default=ROOT / "artifacts") + args = parser.parse_args() + version = re.search(r"project\(DuoRdpNative VERSION ([\d.]+)", + (ROOT / "CMakeLists.txt").read_text()).group(1) + for name in REQUIRED: + path = args.dist / name + if not path.is_file() or path.read_bytes()[:2] != b"MZ": + raise ValueError(f"Missing Windows binary: {path}") + # Explicit allowlist prevents configs, keys and local backup files leaking. + args.output.mkdir(parents=True, exist_ok=True) + portable = args.output / f"DUO-RDP-Portable-{version}-x64.zip" + with zipfile.ZipFile(portable, "w", zipfile.ZIP_DEFLATED) as archive: + for name in REQUIRED: + archive.write(args.dist / name, name) + for source, name in [(ROOT / "packaging/README.txt", "README.txt"), + (ROOT / "LICENSE", "LICENSE"), + (ROOT / "THIRD_PARTY_NOTICES.md", "THIRD_PARTY_NOTICES.md")]: + archive.write(source, name) + command = ([args.wine] if args.wine else []) + [str(args.iscc.resolve()), + "/DAppVersion=" + version, + "/DAppDist=" + windows_path(args.dist, args.wine), + "/DReleaseDir=" + windows_path(args.output, args.wine), + windows_path(ROOT / "packaging/DuoRdp.iss", args.wine)] + subprocess.run(command, cwd=ROOT, check=True) + for path in [portable, args.output / f"DUO-RDP-Setup-{version}-x64.exe"]: + print(hashlib.sha256(path.read_bytes()).hexdigest(), path.name) + + +if __name__ == "__main__": + main()