Skip to content

Releases: 4625tracker/ADCS-CDBRP-Provider

ADCS CDBRP Provider 2.1.1

Choose a tag to compare

@github-actions github-actions released this 26 Oct 14:17

ADCS CDBRP Provider 2.1.1

一个只做一件事的补丁版本:让"吊销后一分钟内生效"真的成立。

重点:从 62 秒降到 23 秒

2.1.0 里 nextUpdate 还是 60 秒、快照每分钟才刷新一次,所以客户端看到的延迟保底就是 60 秒,
任何抖动都会超。两个数字现在是分开调的,而且延迟是 max(刷新节奏, 答复寿命),不是两者相加。

实测(往快照里注入一条吊销记录,每 5 秒查一次 OCSP):

baseline   : good
injected   : 21:55:23
  +  6s  good
  + 11s  good
  + 17s  good
  + 23s  revoked        ← 2.1.0 下是 62 秒

快照刷新:60 秒 → 约 20 秒

Windows 任务计划的重复间隔最小是 1 分钟(PT20S / PT30S 都会以 0x80041318 被拒)。所以现在
一个任务挂多个错开启动的触发器:3 个触发器各每分钟重复一次、起点相差 20 秒,等效 20 秒一轮。

安装参数:-SyncPerMinute 1..6(默认 3)。

答复寿命:60 秒 → 30 秒(可配)

新增 provider.ini 配置项 responseseconds,直接驱动 nextUpdate。默认 30;
想更快就调到 20 甚至 10,代价是客户端更频繁地回来校验。

改配置不再需要重启

provider.ini 之前每个进程只读一次,改完必须重启响应程序。现在按文件时间戳自动重载
(节流到 2 秒一次),改完几秒钟内生效 —— 升级到本版后可以现场改、不用停服务。

升级

直接覆盖安装,配置、快照、CLSID、注册表布局都没有变化:

ADCS-CDBRP-Provider-Setup-2.1.1-x64.exe -Mode install --quiet -CAConfig <你的 CA>

已有的 provider.ini 会被保留(安装器不会覆盖已存在的配置文件)。

已知限制

  • 任务计划不能快于 1 分钟重复,所以刷新节奏靠多触发器叠加实现;6 次/分钟是上限。
  • -SyncPerMinute 3 意味着 certutil -view 每分钟跑 3 次。几百行的 CA 无感;几十万条已签发
    证书的大 CA 建议 -SyncPerMinute 1
    ,并相应调大 responseseconds。
  • ARM64 仍未实测,所以不提供 ARM64 包。

完整变更

  • 新增 responseseconds(默认 30),nextUpdate 跟随它
  • 快照刷新改为多触发器错开,默认约 20 秒一轮;新增安装参数 -SyncPerMinute
  • provider.ini 按 mtime 自动重载,改配置不再需要重启响应程序
  • 测试增加到 22 项:断言答复窗口(默认 30、--set 后 15),防止窗口悄悄变回分钟级
  • 文档:DEPLOYMENT 增加"吊销比一分钟慢得多"的三段排查法,以及"间歇性 500 来自重启补丁"

许可证仍是 MIT。仓库不含任何微软二进制文件。

ADCS CDBRP Provider 2.1.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 09:15

ADCS CDBRP Provider 2.1.0

Multi-CA 配置界面 + 状态页自诊断。

项目更名为 ADCS-CDBRP-Provider。 CDBRP = CA Database Based Revocation
Provider,即「基于证书数据库的吊销提供程序」。安装包文件名随之变为
ADCS-CDBRP-Provider-Setup-<version>-<arch>.exe。
CLSID、ProgID、OcspDbProvider.dll、安装目录、provider.ini 与快照格式都没有变,
已部署的机器升级不受影响。

English summary. This release adds a standalone multi-CA configuration tool
(OcspConfig.exe), shares the configuration model between the provider and that tool, and
makes the responder status page explain why a snapshot shows 0 entries. The project is now
named ADCS-CDBRP-Provider — CDBRP stands for CA Database Based Revocation Provider — while
binary identity (CLSID, ProgID, DLL name, install layout) is unchanged.

新增:多 CA 配置界面(OcspConfig.exe)

安装完成后在 %ProgramData%\OcspDbProvider\OcspConfig.exe(开始菜单/资源管理器直接双击即可,
不需要管理员——只有写 provider.ini 时需要对该目录有写权限)。

  • 左侧列出所有「已知 CA」:响应程序里配置过的 CA + provider.ini 里已有分段的 CA,并标注
    [响应程序] / [已配置];
  • 选中任意 CA,右侧编辑它的 快照文件 / 缓存秒数 / 有效·已吊销·未知道 三个状态码;
  • 下方实时显示该 CA 的快照状态:解析到的路径、文件是否存在、字节数、可解析行数、修改时间;
  • 「保存」只写该 CA 的分段,「删除」只删该 CA 的分段,不会碰响应程序自身的配置。

命令行(便于批量/自动化):

OcspConfig.exe --dump
OcspConfig.exe --set CORP-A --snapshot C:\data\CORP-A.dat --unknown 2
OcspConfig.exe --remove CORP-B

--dump 输出示例:

CA                           source   check  valid  revoked  unk    rows    snapshot
CORP-A                       ini      0      0      1        9      2       C:\ProgramData\OcspDbProvider\data\CORP-A.dat
CORP-B                       both     2      0      1        7      1       C:\ProgramData\OcspDbProvider\data\CORP-B.dat

新增:配置模型共享

provider.ini 的解析与写回抽到 OcspDbConfig.cpp,提供程序(DLL)与配置工具(EXE)编译同一份
实现,不会出现「工具写的东西提供程序读不懂」。现有的平铺/分段配置格式完全不变,是超集兼容。

改进:状态页能自己解释「0 条记录」

以前状态页只显示「快照记录:0 条 / 最后加载:(尚未加载)」,看不出是路径不对、文件是空的,还是
导出格式不对。现在会额外显示:

  • 快照文件:提供程序真正解析出的完整路径(多 CA 时最常错的地方)
  • 文件状态:存在 / 不存在,以及字节数
  • 记录数为 0 时给出一条针对性提示(路径无文件 / 0 字节 / 有内容但无可解析行)

你之前截图里那种「有文件时间、但 0 条」的情形,现在会直接告诉你文件是 0 字节还是有内容但
解析不出行。

修复

以下都是这次在真实服务器上部署时暴露出来的:

  • 计划任务根本没有触发器:install.ps1 调用 Register-ScheduledTask 时没传 -Trigger,
    生成的任务是空的 <Triggers />,从来不运行 —— 快照永远停在安装那一刻。现在用任务 XML
    显式写 TimeTrigger + Repetition Interval PT1M(不带 Duration 才是"无限重复"),
    注册后还会断言 Triggers.Count > 0 且 NextRunTime 有值。
  • 计划任务里的 CA 名被破坏:任务动作把中文 CA 名当参数传递,而无 BOM 的 UTF-8 脚本被
    PowerShell 5.1 按 ANSI 读取,一个多字节序列把后面的反斜杠吃掉了,于是 sync.ps1 认为这个
    名字没有主机前缀、又加了一次,变成 服务器\服务器\CA,certutil 每次都以
    E_INVALIDARG (0x80070057) 失败。现在任务动作不带 CA 名,由 sync.ps1 从响应程序
    注册表解析。
  • 响应程序把答复缓存半小时:nextUpdate 硬编码为 now + 30 分钟,而响应程序和客户端就
    按这个时间缓存答复 —— 快照明明已经更新,OCSP 仍返回半小时前的旧答复。新增 responseseconds
    配置项(默认 60),nextUpdate = now + responseseconds。实测端到端 62 秒:往快照里
    注入一条吊销记录后,OCSP 在 62 秒后变成 revoked。
  • DllRegisterServer 曾把默认安装目录写进注册表。注册表还没有 InstallDir 值时它退回
    %ProgramData%\OcspDbProvider,于是把「猜出来的默认值」写成了事实,之后一直指向那个空目录 ——
    这就是状态页显示 0 条的直接原因。现在以 DLL 自身所在目录为准,安装脚本也会显式写入并校验。
  • 升级时旧 DLL 被 ocspsvc.exe / 打开的 MMC 占用,复制失败。现在安装脚本会自动把旧 DLL
    改名挪开再放新的(重命名不受文件映射影响),并在下一次加载时生效。
  • sync.ps1 在 Windows PowerShell 5.1 上崩溃:用了只有 PowerShell 7 才有的
    ProcessStartInfo.ArgumentList(5.1 上为 $null),导致快照一直没生成。
  • install.ps1 在服务已停止时被中断:Stop-WebAppPool 会抛非终止错误,而脚本开了
    $ErrorActionPreference='Stop',整条安装流程被提前打断。
  • regsvr32 在部分主机上不返回退出码,导致安装误判失败;改为以 InprocServer32 和
    InstallDir 的注册表值为准,regsvr32 只作参考。
  • 计划任务名与快照文件名改用裸 CA 名(之前用「主机名\CA」,会生成
    FTP____NAS-Monitor-CA 这类名字,且与提供程序按 CA id 推导的默认路径不一致)。
  • OcspConfig.exe 的 --dump 输出在重定向到文件时出现 \r\r\n(stdout 文本模式重复翻译换行)。

升级说明

  • 安装包现在多装一个 OcspConfig.exe,其余行为不变;
  • provider.ini 不会被覆盖;
  • 改完配置后仍需 Restart-Service OCSPSvc 让提供程序重新读取(状态页/工具里也会提示)。

兼容性

项目 说明
CLSID 不变 {7B0C4B1E-93A1-4C0F-9E52-0D2A6A5B41C9}
provider.ini 格式不变(新增能力用同样的 [ca:<id>] 分段)
快照文件 格式不变
系统 Windows 7 / Server 2008 R2 及以上,x64 / x86

校验

Get-FileHash .\ADCS-CDBRP-Provider-Setup-2.1.0-x64.exe -Algorithm SHA256
# 与 SHA256SUMS.txt 中对应行比较

OCSP CDBRP Provider 2.0.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 06:20

OCSP CDBRP Provider 2.0.0

A native COM revocation provider for AD CS Online Responder that answers OCSP from a
snapshot of the CA certificate database instead of a CRL. Revocation becomes visible
about one minute after it is recorded, with no CRL publication cycle in the loop.

中文摘要:给 AD CS 联机响应程序用的原生吊销提供程序,数据源是 CA 证书数据库快照而不是
CRL,吊销后约 1 分钟即可在 OCSP 中体现。本版本提供自解包 EXE 安装程序,支持 x64/x86、中英双语、
多 CA。

Downloads

File Description
OCSP-CDBRP-Provider-Setup-2.0.0-x64.exe Installer for 64-bit Windows (most common)
OCSP-CDBRP-Provider-Setup-2.0.0-x86.exe Installer for 32-bit Windows
SHA256SUMS.txt Checksums for the files above

The installers embed the provider DLL, the self-test harness and the install/sync scripts;
nothing else needs to be downloaded. They are unsigned, so SmartScreen may warn — verify the
SHA-256 before running.

Install

# right-click -> Run as administrator, or:
.\OCSP-CDBRP-Provider-Setup-2.0.0-x64.exe

The setup extracts its payload to a temporary directory, then runs the same
install.ps1 that ships in the repository. It installs into
%ProgramData%\OcspDbProvider, registers the COM class, writes provider.ini, creates the
first snapshot and registers the every-minute refresh task. It does not switch the
responder yet
— that is a separate, reversible step:

.\OCSP-CDBRP-Provider-Setup-2.0.0-x64.exe -Mode activate

Other modes: deactivate (back to the built-in CRL provider), uninstall,
status, sync, selftest. Add -CAConfig "SRV1\CORP-CA" to be explicit about the CA,
-InstallDir <dir> to relocate, -RemoveFiles with uninstall to delete the files too.

Non-elevated inspection of the payload is possible:

.\OCSP-CDBRP-Provider-Setup-2.0.0-x64.exe --list
.\OCSP-CDBRP-Provider-Setup-2.0.0-x64.exe --extract-only C:\temp\payload

Verify

# provider contract, no MMC required
& "$env:ProgramData\OcspDbProvider\uitest.exe" info -ca 'SRV1\CORP-CA'

# end to end
openssl ocsp -issuer ca.cer -serial 0x<serial> -url http://<responder>:<port>/ocsp -CAfile ca.cer -no_nonce
# Response verify OK

Requirements

  • Windows 7 / Server 2008 R2 or later, x64 or x86
  • The AD CS Online Responder role on the target host
  • Local administrator rights to install and to switch the provider
  • CA database readable by the SYSTEM task (CA_ACCESS_READ, 0x100)
  • PowerShell 5.1+ (used by the sync task; the provider itself has no PowerShell dependency)

Highlights

  • CA database as the data source — no CRL dependency, revocation reflects the database
  • Multi-CA — independent snapshot and status mapping per CA ([default] / [ca:<id>])
  • Bilingual UI — English and Simplified Chinese, following the system UI language
  • Portable install — OCSPDBPROVIDER_DIR → registry → %ProgramData%\OcspDbProvider
  • x64 and x86 builds; ARM64 build path supported by the scripts (toolchain permitting)
  • Self-contained setup — embeds DLL, uitest.exe, scripts and license; statically
    linked, so no VC++ redistributable is required at runtime
  • No Microsoft binaries are redistributed — only this project's own code

Changes since 1.x

  • install directory, CA name and host names are no longer hard-coded
  • per-CA configuration sections; legacy flat provider.ini files still work
  • configuration dialog localized (English + Simplified Chinese) with two explicit resources
  • thread safety for the MTA apartment the responder uses
  • NormalizeSerial fixed: digits were mapped to control characters and leading zeros were
    never stripped; lookups only happened to match because both sides were corrupted the same
    way
  • the scheduled sync task qualifies a bare CA name with the host name, which certutil requires
  • the earlier .NET prototype is kept under src/legacy/managed for reference only

Known limitations

  • The setup executables are not code-signed (no certificate available). Verify SHA-256.
  • ARM64 setups are not published: the ARM64 C++ toolchain is not available in the build
    environment used for this release. The scripts support -Arch arm64.
  • nextUpdate / nextPublish are fixed values (30 / 120 minutes), not derived from the CA's
    CRL schedule.
  • The provider has no CRL fallback: a missing snapshot makes every serial answer with
    unknownstatus.

Documentation

License

MIT