Command-line tool
custodian is a .NET tool for the people who operate and review a Custodian application. This page lists every
command with its purpose, its arguments and its exit codes. The commands are the Art. 30 report, the dry-run purge,
audit verification, the break-glass list and the three onboarding commands.
How the tool finds your setup
The tool does not start your application. You point it at an assembly, and it looks there for one static method
named ConfigureCustodian. The method takes a CustodianOptionsBuilder and, optionally, an IConfiguration. Call
the same method from AddCustodian in your application, so the tool and the application read one definition of the
model, the roles and the system principals. The tool's tests use
ConfigureCustodian in SampleSetup as their example.
An assembly with no such method, or with several, is refused with exit code 1.
The onboarding commands are different. They load no assembly and take no --assembly.
Options shared by the commands
| Option | Meaning |
|---|---|
--assembly <path> |
The assembly that holds ConfigureCustodian. Required, except for onboard commands. |
--set key=value |
A configuration value for your setup method. Repeatable. |
--tenant <guid> |
The tenant to act in. Required for audit, purge and breakglass. |
--role <name> |
A role from your role mappings that the tool acts as. Required for audit, purge and breakglass. |
--purpose <name> |
The purpose the tool declares. Defaults to custodian-tool. |
--verbose |
Prints the full text of a failure raised by your setup method. That text can hold secrets. |
--help, -h |
Prints the usage text and exits with 0. |
Environment variables named CUSTODIAN_<Section>__<Key> are passed to your setup method as configuration too, as
<Section>:<Key>. Use them for connection strings, so they stay off the command line. A --set value wins over a
variable of the same key. See
Values_given_with_set_and_CUSTODIAN_variables_reach_the_applications_setup.
export CUSTODIAN_ConnectionStrings__Privacy="..."
custodian audit verify --assembly bin/Release/net10.0/MyApp.dll --tenant <tenant-guid> --role PrivacyOfficer
The variable name after the prefix is whatever key your own setup method reads.
Two rules hold for every run that touches the database:
--rolemust be a role your setup maps. Any other name is refused, and the message lists the valid roles (A_role_that_is_not_mapped_is_rejected_naming_the_valid_roles).- The audited actor is always
custodian-tool:<operating-system user>. You cannot choose it (The_tool_records_the_operating_system_user_and_not_a_chosen_actor).
Exit codes
| Code | Meaning |
|---|---|
| 0 | Done. |
| 1 | Bad usage, an invalid setup, an unreadable file or a failed database connection. |
| 2 | A finding. This is a broken audit chain. |
| 3 | An onboarding command finished but left something only a person can settle. |
Running custodian with no arguments prints the usage text and exits with 1. Messages for exit code 1 go to
standard error and start with custodian:
(A_missing_option_an_unknown_command_an_assembly_without_an_entry_point_or_an_invalid_setup_exits_1_with_a_message).
When your setup method throws, the tool prints only the exception's type unless you pass --verbose
(The_application_failure_text_is_printed_only_with_verbose).
report processing
Prints the record of processing activities that Art. 30 asks for. It is derived from your setup alone and needs no database, tenant or role.
custodian report processing --assembly bin/Release/net10.0/MyApp.dll --format markdown --output art30.md
| Option | Meaning |
|---|---|
--format markdown|json |
The output format. Defaults to markdown. |
--output <file> |
Writes to a file. Without it the report goes to standard output. |
For each personal entity the report lists its table, its data categories, whether it holds special-category data, and
per purpose the lawful basis, retention, anchor, expiry action and the roles with access. For each field it lists the
category, the protection and the purposes. Registered system principals follow, with their purpose, lawful basis,
database role and declared data. The report names entities and fields and never holds their data. See
Every_personal_entity_is_listed_with_categories_purposes_lawful_basis_retention_and_the_roles_with_access,
System_principals_are_listed_with_purpose_basis_and_declared_data
and Markdown_carries_the_same_facts_and_no_personal_data.
Exit code 0, or 1 for an unknown format.
audit verify
Walks one tenant's audit hash chain and reports the first gap or edit.
custodian audit verify --assembly bin/Release/net10.0/MyApp.dll --tenant <tenant-guid> --role PrivacyOfficer
It prints Audit chain intact: <n> entries checked. and exits with 0, or
Audit chain BROKEN at sequence <n> after <m> entries checked. and exits with 2. See
Audit_verify_exits_0_on_an_intact_chain_and_2_on_a_broken_one.
Reading the audit trail needs a role mapped to the privacy database role. Audit trail explains the chain.
purge --dry-run
Reports what the retention worker would purge or anonymise for one tenant. It changes nothing.
custodian purge --dry-run --assembly bin/Release/net10.0/MyApp.dll --tenant <tenant-guid> --role <role>
The tool never purges. Without --dry-run the command is refused with exit code 1, because purging is the retention
worker's job. The output is one tab-separated line per entity, purpose and action with a row count, followed by the
number of rows held back by a legal hold. See
Purge_needs_dry_run_and_runs_the_retention_pass_as_a_dry_run.
Retention covers the worker.
Exit code 0.
breakglass list
Lists one tenant's outstanding and escalated break-glass accesses.
custodian breakglass list --overdue --assembly bin/Release/net10.0/MyApp.dll --tenant <tenant-guid> --role PrivacyOfficer
| Option | Meaning |
|---|---|
--overdue |
Lists only items past their deadline. |
Each line holds the item id, status, actor, subject, time of first access, deadline, access count and the entity names
read, separated by tabs. A final line gives the count. See
Breakglass_list_asks_for_overdue_items_only_when_told_to.
Listing other people's items needs a role mapped to the privacy database role.
Health data and break-glass covers the items.
Exit code 0.
The onboard commands
These three commands prepare a legacy database for Custodian. They read the connection string of that database from
the environment variable CUSTODIAN_ONBOARD_CONNECTION and never from the command line. --provider is sqlserver
or postgresql. Onboarding a legacy database describes the workflow.
export CUSTODIAN_ONBOARD_CONNECTION="..."
custodian onboard clients --provider sqlserver --watch 60 --output clients.md
custodian onboard scan --provider sqlserver --sample
custodian onboard report
| Command | Options | Exit code 3 means |
|---|---|---|
onboard clients |
--provider (required), --watch <minutes> (default 0, one poll), --output <file> |
The login cannot see every session, so the list is incomplete. |
onboard scan |
--provider (required), --directory <dir> (default custodian/classification), --sample, --sample-rows <n> (default 5000) |
A table still needs a person, the scan found something new or missing, a sample failed, or the login saw no table. |
onboard report |
--directory <dir>, --output <file> (default custodian/classification-report.html) |
The directory holds no classification files. |
For these commands --verbose adds the exception type and a stack trace. It never prints the exception's message,
because a driver message can hold the connection string. A failed connection prints an error code only. See
A_connection_to_a_closed_port_prints_the_error_code_only_with_and_without_verbose
and Scan_without_the_connection_variable_exits_1_and_says_which_variable_to_set.
The onboarding connection string is kept apart from your application's configuration. It does not reach
ConfigureCustodian, even though its name starts with CUSTODIAN_
(The_connection_variable_does_not_reach_the_applications_configuration).