Secure Configuration and Audit Automation

Compare evidence with explicit policy; keep unknowns and changes visible.

Policy comes before judgment

The private-report fixture requires a regular file owned by the current user with mode 600.

That is not a universal policy for a team share or public web content. Mode bits, directory access, ACLs, account privilege, and trust context answer different questions.

The helper uses tested Linux/macOS stat spellings. A passing mode check does not prove confidentiality.

Scope discovery and check the producer

find scope -type f \( -perm -0020 -o -perm -0002 \) -print0 > candidates.nul

Use the complete lesson guard and owned fixture tree. Read results with a NUL-aware loop after find succeeds.

A writable-path result is evidence for policy review, not permission to chmod every matching host path. The default search does not follow symlinks.

Unknown is not compliant

Outcome Meaning in this fixture
Pass Observed property meets the stated policy
Fail Observed property violates that policy
Unknown Required evidence was not collected or is unavailable
Review Policy/context needs a human decision

A missing input or denied observation must not become a clean pass because the result set is empty.

Text configuration is not always effective configuration

PasswordAuthentication no
Include fixture_extra.conf

One desired SSH line does not resolve includes or Match context. Syntax checking and context-aware effective-state inspection are different checks.

The lesson records unknown until complete context is reviewed; it does not modify a live daemon.

Account and service context matter

The Linux example captures only the current account with id and getent. A name alone does not prove login authorization or actor identity.

Service activity and enablement remain separate observations from Chapter 15. An unfamiliar active service may be legitimate for the host's role.

Review executable trust, account, writable paths, dependencies, credentials, and restart policy before proposing a correction.

Find cues without disclosing values

grep -El 'TOKEN|PASSWORD' scope/settings.txt scope/plain.txt

With synthetic fixture values, the result is a candidate filename. Values are omitted.

A name match is not a verified secret inventory. Integrity mismatches likewise require comparison with approved change evidence rather than automatic attribution.

Verify a bounded correction and rollback

The owned fixture begins at mode 644; policy requires 600.

record mode + content -> change only fixture mode -> verify 600 and unchanged bytes
                      -> restore old mode -> verify rollback

No real SSH, service, account, or unrelated path changes. A production change needs its own authorization, dependency checks, access-preservation plan, and recovery.

Preserve every run

The fixture report retains one pass, one fail, and one unknown. A later correction changes the private-mode outcome but keeps SSH-effective unknown.

Keep stable check IDs, evidence, policy version, scope, time, rationale, and limitations. Do not overwrite an earlier finding to make the current report appear clean.

Automatic remediation is false in the supplied report contract.

Sources: earlier verified ThinkBash modules, Linuxize Bash, and OpenSSH configuration references linked in the lessons. All data and policy changes are synthetic/owned.