Implement a self-contained Bash automation that mimics a subset of the Lets Encrypt DNS-01 validation flow using a local mock DNS database.
All operations must run entirely from local files (offline) to enable benchmarking of CLI agents without network access.
Create a scaffold that provides a mock-DIG interface and a small DNS-01 workflow suitable for benchmarking.
What needs to be changed / added / fixed
Add a self-contained Bash-based automation that mimics the DNS-01 validation flow against a local mock DNS database.
Introduce a local mock DNS store and a “mock dig” utility:
A JSON or simple flat-file database that stores domain → TXT value mappings for the _acme-challenge.* DNS TXT records.
A mock that implements a limited subset of dig TXT behavior to read from the local store and return values in a DNS-like TXT response format.
Provide a small orchestration layer (CLI) to simulate the DNS-01 flow end-to-end:
Add a setup script to seed/update the mock DNS store with domain/challenge tokens.
Add a validation/benchmark script that reads a domain, queries the mock dig, and verifies that the expected TXT value is present.
Ensure the flow is fully offline and idempotent (seeded data persists in the local store).
Ensure the solution is self-contained (no external networking, no external dependencies beyond Bash).
Expose a minimal, documented CLI interface for benchmarks:
How to add/seed values for a domain.
How to run a “validation” against a domain to confirm the TXT record matches the expected token.
How to run a simple benchmark against multiple domains.
Include basic logging for traceability (stdout/stderr) to help bench agents understand success/failure.
Provide a clean, approachable directory layout under /app/ that contains:
A mock DNS database (e.g., mock_dns_db.json or a simple flat file).
A mock-dig script (to emulate a DNS TXT query against the mock DB).
A setup/seed script to populate the mock DB.
A benchmarking/validation script that ties the pieces together and reports results.
Pre-commit file contents (starting state)
The repository currently contains a placeholder file with a pass statement. Use the following as the starting state to understand what you begin with (this block is provided as Python code to indicate the before state):
python
# Placeholder — original code before the change
pass
Files to modify / add in /app/
Add new scripts and data under /app to realize the offline DNS-01 scaffold:
/app/bin/mock_dig.sh
A lightweight Bash script that accepts a domain (and optionally a record name like _acme-challenge.domain) and returns a TXT value by consulting the local mock DNS store.
It should mimic essential parts of “dig TXT” output enough for benchmarking CLI agents.
/app/bin/setup_mock_dns.sh
A setup script that initializes and seeds the local mock DNS database with domain -> TXT value mappings.
Should support adding or updating entries, and persisting them to disk.
/app/mock_dns_store.json (or a similarly named file)
The local DNS database storing mappings for DNS TXT records, e.g. domain -> { record: "_acme-challenge.domain", value: "" }.
This file must be readable/writable by the Bash scripts and persist between runs.
/app/bin/benchmark_dns01.sh
A high-level script that takes a domain (or a list of domains) and a token, uses mock_dig.sh to fetch the TXT value, and validates it against the expected token.
Outputs a short, parse-friendly report indicating pass/fail per domain and an overall score.
Optional: /app/lib/dns_validation_helpers.sh
A small collection of helper functions (e.g., normalize_domain, extract_txt_value, format_output) to keep the Bash scripts modular and readable.
Ensure file permissions make the scripts executable (e.g., chmod +x on the script files).
Documentation (README.md) can be added or updated under /app/ to describe:
How to seed the mock DNS, how to query, and how to run the benchmark.
Expected input formats and example runs.
What the agent should implement (behavior / outcome)
The agent should implement a self-contained offline DNS-01 scaffold that:
Maintains a local mock DNS database of TXT records for domain validation challenges.
Provides a mock dig utility that queries this local store and returns a TXT value for _acme-challenge.domain.
Enables seeding/updating the mock database with domain tokens via a setup script.
Allows running a validation/benchmark against one or more domains, verifying that the returned TXT value matches the expected token.
Outputs human-readable and machine-parseable results suitable for benchmarking CLI agents (e.g., per-domain pass/fail, total score, and any mismatch details).
Runs entirely offline with no network access; relies only on local files under /app/.
Expected user workflow (example, not code):
Initialize the mock store and seed a domain:
Run a setup script to add domain "example.test" with token "abc123".
Validate a domain:
Run the mock dig script to query _acme-challenge.example.test and verify the TXT value is "abc123".
Benchmark across multiple domains:
Run the benchmark script with a list of domains and their tokens; receive a summary of which domains passed or failed and why.
Acceptance criteria (what success looks like)
All necessary scripts exist under /app/ with executable permissions:
mock_dig.sh, setup_mock_dns.sh, benchmark_dns01.sh, and optional dns_validation_helpers.sh.
A local mock DNS store (mock_dns_store.json) persists domain -> TXT value mappings and can be seeded/updated by the setup script.
The mock_dig.sh script returns TXT values for _acme-challenge.domain using the local store, in a format that the benchmark script can parse.
The benchmark script outputs per-domain results and an overall summary, suitable for benchmarking CLI agents.
The solution works entirely offline, with no external network calls required.
Documentation or usage examples exist to guide users on seeding data, querying, and benchmarking.
Notes and constraints
Do not reveal the exact code changes or patch content here; describe the intended behavior and outcomes so the agent can implement the changes correctly.
The agent should place and operate all files under /app/ and should not rely on external dependencies beyond Bash.
Keep the design modular so additional features (e.g., more record types, richer mock DNS behavior) can be added later without breaking the core flow.