Technical document · docs/architecture.md · English · All documentation

Note: this document is shown unchanged from the source code and is older than the program in places. There are now scripts for SMB, NTLM (NTLMv2 only, deny outgoing, deny in the domain with exceptions), LDAP signing, LDAP channel binding, and TLS 1.0/1.1. Binary .evtx files are read. The commands plan, preflight, and collect exist. collect has not yet been run against a real domain. The roadmap document is up to date.

Architecture

flowchart LR
  subgraph inputs [Inputs]
    Json[Snapshot JSON]
    Xml[Event XML]
    Live[Windows collector later]
  end
  Snap[Assessment snapshot]
  Engine[Check engine]
  Report[HTML and JSON report]
  Plan[Baseline plan]
  Art[PowerShell, INF fragment, registry.pol]
  Json --> Snap
  Xml --> Snap
  Live -.-> Snap
  Snap --> Engine --> Report
  Engine --> Plan --> Art

The solid arrows exist. The live probe’s Windows I/O is compiled only on Windows. On any other host, collect stops before a connection. Tests drive the same collector with a fake probe.

Technology choice

The scaffold is a .NET 10 solution:

No NuGet dependencies in the library or the CLI. Tests use xUnit.

Why .NET, and why 10:

The process has no listener. A later Windows build still only makes outbound WinRM and LDAP calls. Customer data is files in the output directory.

Snapshot

AssessmentSnapshot is the only thing the engine reads.

SnapshotLoader reads JSON and, optionally, every *.xml file under an events directory. The XML parser uses XmlReader with DTDs prohibited and a size cap. More than 200,000 events is rejected. Binary .evtx is out of scope until a parser is chosen and reviewed.

WindowsLiveCollector is the seam for the real collector. It does not read the local machine.

Checks

CheckCatalog is the list. CheckEvaluator runs the implemented ids. The report includes the others as NotImplemented, so a gap stays visible.

Each result has:

Scoring lives in ScoreCalculator and is repeated in plain language in the HTML report. The baseline denominator is the implemented hygiene ids (SMB-001, SMB-002, NTLM-001, NTLM-002, LDAP-001, LDAP-002, KRB-001, TLS-001, CERT-001). TLS-003, PQC-001, and PQC-002 feed the narrative and the PQC components, not that percentage.

PQC components:

The overall PQC score is the average of the components that exist, rounded half away from zero. Missing components are named in the note.

Baseline plan

BaselineBuilder.Suggest builds one profile per role present in the snapshot.

Snapshot role Profile
Domain controller domain-controllers, including LDAP and Kerberos settings
Member server or certificate authority member-servers. CAs are not a separate profile yet
Workstation workstations

Computer names are sorted. The first is ring Pilot, the rest Broad. That is a placeholder, not a pilot-selection algorithm. OU and group targets can be written into the plan JSON by hand. Intune profiles are not created.

A setting becomes Enforce when the linked check is AlreadyMet or SafeToEnforce. Otherwise it is Defer. Evidence notes carry the summary and up to eight blockers. BaselineBuilder.Tune sets Overridden so a later script can say a human overruled the evidence.

The plan schema is version 1. The loader rejects anything else.

Artifacts

SmbArtifactGenerator is the only generator.

SMB, NTLM, LDAP, and TLS generators emit a script only for hosts that can take the setting, and only for the safe value (SMB1 off, signing on, LM compatibility 5, LDAP signing and channel binding 2, TLS 1.0 and 1.1 server disabled). Any other value throws. A computer name that is not letters, digits, dots, hyphens, or underscores throws, so a snapshot cannot break out of the script. Two different FQDNs that share a short name throw, because the script compares $env:COMPUTERNAME.

The script:

GptTmpl.smb.inf repeats the signing security options as text. It is not a backup Import-GPO can import. registry.smb.pol is a real Registry.pol body (ASCII PReg, version 1, UTF-16 entries) for the same values, including the SMB1 DWORDs the INF format does not carry. The manifest tells the administrator not to apply more than one copy by accident.

Settings that are Enforce but have no generator (NTLM level 5, for example) stay in the manifest with artifact none.

CLI

pqcprzm assess  --snapshot file.json [--events dir] --out dir
pqcprzm baseline --snapshot file.json [--events dir] [--plan plan.json] --out dir
pqcprzm catalog

Exit 0 means the command ran. It does not mean the estate passed. Exit 2 is usage. Exit 3 is a bad snapshot, a bad plan, or a rejected artifact.

baseline --plan keeps the edited dispositions and regenerates artifacts. If --snapshot is also passed, the report is refreshed from the snapshot and the plan file is still the one that drives the script.

Deployment shape, when there is a Windows build

One signed executable on a management server. A group managed service account, or a dedicated user, in Event Log Readers on the machines it reads, plus remote management rights if WinRM is the transport. No Domain Admins. No inbound rule. Output stays in a directory the MSP already treats as customer data. Details are in permissions and audit.

The HTML report is a single file with inline CSS. It does not load fonts or scripts from the internet.