Documentation
Usage reference for the command line, in the style of a manual page. It describes the current source. The
audit command planned for 0.2.0 is not documented here until it exists.
Name
pqcmap - inventory and grade TLS, SSH and mail STARTTLS cryptography against NSA advisory PP-26-4956
Synopsis
pqcmap <command> [flags]
pqcmap scan [flags] TARGET... | --targets FILE
pqcmap discover [flags]
pqcmap check [flags]
pqcmap render --format text|markdown|prom FILE.json
pqcmap catalog [--json]
pqcmap explain CHECK-ID|REASON
pqcmap version [--json]
pqcmap help [command]
Description
pqcmap records what a server selects or offers, applies a closed set of reason codes and outcomes, and writes a
text or versioned JSON report. It grades against one of two profiles: pragmatic (the default), which
targets widely deployable post-quantum hybrids and ML-DSA while identifying classical fallbacks, and
cnsa, which grades against CNSA 2.0 targets and the CNSA 1.0 interim path.
For each TLS target, scan performs one baseline handshake, eight single-group handshakes and one
TLS 1.2 handshake. It sends no application data and no ALPN. For each SSH target it reads the banner and the
SSH_MSG_KEXINIT message; it performs no key exchange and no authentication. Connections to one host are
spaced by a minimum interval (default 250 ms).
A target has the form tls://HOST[:PORT] (default port 443), ssh://HOST[:PORT] (22),
smtp://HOST[:PORT] (25) or imap://HOST[:PORT] (143), with no user, path or query. Port 2019, the
Caddy admin API, is refused.
For an SMTP or IMAP target, scan opens ten sessions, one per TLS handshake. Each session reads the greeting,
asks for the server's capabilities (EHLO or CAPABILITY), and, when STARTTLS is offered,
requests it and hands the connection to the TLS probe. It never authenticates and never sends a message. It ends a
session that does not upgrade with QUIT or LOGOUT.
scan --targets FILE (- for standard input) reads one target per line. Blank lines and lines
starting with # are ignored. Before the target URL a line may hold host=LABEL and
sni=NAME. The file may have at most 1000 lines of at most 1024 bytes and be at most 1 MiB; port 2019 is an
error.
Scan only systems you own or are authorised to test. One scan can open ten TLS connections, or one SSH connection, per target.
discover inventories the host it runs on: listening TCP sockets, the protocol each one speaks, TLS names,
configuration files and package versions. It does not grade. check runs the same discovery and grades
every endpoint it found with the matching check, in one report. Both contact only listeners of this host that are bound
to the any-address, a loopback address or an address assigned to one of its interfaces. Listeners in other network
namespaces are inventoried and never contacted from the host namespace. Port 2019 is never contacted. Some ports
(5432, 3306, 6379, 11211, 27017, 9090, 9100, 3100, 12345) are inventoried without a connection unless
--sniff-all is given.
With check --from-nmap -, check instead reads nmap XML from standard input, which you produced with
nmap against hosts you own or are authorised to test. It identifies each open TCP port in that file with its own polite
exchange and grades what it finds. It performs no local discovery in that mode and never scans ports itself.
Both commands read /proc and configuration files and are Linux-only. As an ordinary user they read what the
kernel allows, and list every path they could not read as unchecked, with the reason root_required. As root
they also read root-only sources and map sockets to processes.
Commands
- scan [flags] TARGET...
- Grade explicitly named TLS and SSH targets.
- discover [flags]
- Inventory local sockets, names, files and packages. No grading.
- check [flags]
- Discover local services, or read nmap XML, then grade them. Takes the grading options of
scan. - render --format text|markdown|prom FILE.json
- Re-render a stored JSON report. It makes no network connections. It accepts every schema version it knows, and rejects invalid JSON and unknown versions with exit status 2.
- catalog [--json]
- List the tools and checks. With
--json, export the catalog: every declared reason with its outcome and anchor in both profiles, and the protocols that have no check yet. - explain CHECK-ID|REASON
- Show a check's description, why it matters, every result, how to fix it per software, and how to verify. Given a reason code it shows only that reason.
- version [--json]
- Print version information.
- help [command]
- Show command help, for example
pqcmap help scan. A command also accepts--help.
Options
| Option | Default | Meaning |
|---|---|---|
--profile NAME | pragmatic | Grading profile: pragmatic or cnsa. |
--format FORMAT | automatic | Output format: text, json, markdown or prom (Prometheus text exposition). When unset, text if standard output is a terminal, JSON otherwise. |
--targets FILE | none | Read targets from a file (- for standard input) instead of the command line. |
--out FILE | none | Write the report to a file. |
--fail-on LEVEL | fail | Exit 1 on fail, or on warn as well. |
--sni NAME | the target host | TLS server name to send. |
--timeout DURATION | 10s | Timeout per handshake. |
--min-interval DURATION | 250ms | Minimum delay between connections to one host. |
--concurrency N | 4 | Maximum concurrent targets. |
--max-targets N | 256 | Maximum number of targets in one run. |
| Option | Default | Meaning |
|---|---|---|
--name NAME[:PORT] | none | TLS server name to try, repeatable. Without a port it attaches to 443. |
--max-names N | 20 | Maximum TLS names probed per port. |
--skip-port PORT | none | TCP port to inventory without connecting, repeatable. |
--sniff-all | off | Also identify ports on the default skip list. Never port 2019. |
--sniff-timeout DURATION | 2s | How long to wait for a banner or a TLS handshake during identification. |
--allow-root DIR | none | Additional approved directory for configuration files, repeatable. |
--from-nmap FILE | none | check only. Read open ports from nmap XML (- for standard input) instead of discovering locally. In this build only - is wired. |
discover and check take --format (text or json), --out and --min-interval like scan
(minimum interval at least 250 ms locally and 1 s for nmap input). check also takes --profile,
--fail-on, --timeout, --concurrency and --max-targets.
catalog and version take --json.
Exit status
| Code | Meaning |
|---|---|
| 0 | No finding at or above --fail-on. |
| 1 | At least one finding at or above --fail-on. |
| 2 | Usage error. |
| 3 | One or more targets could not be probed and no finding crossed the threshold. |
| 4 | Internal or report-output error. |
When several apply, the precedence is 2, then 4, then 1, then 3, then 0. check uses the exit codes of
scan. An unchecked entry never changes the exit code. On a platform other than Linux, discover and
check report one unsupported_platform entry and exit 3.
Examples
Grade a TLS endpoint and an SSH endpoint:
$ pqcmap scan tls://example.net:443 ssh://example.net:22
Inventory and grade the host you are logged in to:
$ sudo pqcmap check --format json --out check.json
Check whether a mail server offers STARTTLS, and grade its TLS:
$ pqcmap scan smtp://mail.example.net:25 imap://mail.example.net:143
Write a Markdown report, then re-render a stored JSON report as Prometheus text:
$ pqcmap scan --targets targets.txt --format markdown --out report.md
$ pqcmap render --format prom report.json
Grade against CNSA, fail the run on warnings, and keep a JSON report:
$ pqcmap scan --profile cnsa --fail-on warn --format json --out report.json tls://example.net
Ask what a reason means and how to fix it. The output below is the real text of the current source; the program name is shown as pqcmap.
$ pqcmap explain tls.groups.classical_accepted_alone
### tls.groups.classical_accepted_alone
X25519 or P-256 completed a single-group handshake. Pragmatic warn; cnsa fail (advisory-2).
List the checks:
$ pqcmap catalog
tls (TLS)
tls.groups TLS key exchange groups
tls.versions TLS protocol versions
tls.certificate TLS certificate keys
ssh (SSH)
ssh.kex SSH key exchange algorithms
ssh.hostkeys SSH host key algorithms
ssh.version SSH server version banner
