feat: manage TLSA records
This commit is contained in:
1 parent
9c2fb9d15b
commit
a67183b646
14 files changed
+141
-15
No files matched your search
@@ -47,7 +47,7 @@ In scope:
|
||||
- User management from the web UI for admins: create, change role, set password, delete. Deletion only sets `deleted_at`; the row stays in the database for the audit.
|
||||
- Zone list with record counts, SOA serial and problem counts.
|
||||
- Zone creation (SOA and NS records in one transaction) and zone deletion, by admins.
|
||||
- Creation, editing and deletion of records of every type the plugin serves: `A`, `AAAA`, `CNAME`, `NS`, `MX`, `TXT`, `SRV`, `CAA`, `SOA`. Wildcard names are supported.
|
||||
- Creation, editing and deletion of records of every type the plugin serves: `A`, `AAAA`, `CNAME`, `NS`, `MX`, `TXT`, `SRV`, `CAA`, `TLSA`, `SOA`. Wildcard names are supported.
|
||||
- Bulk deletion of records.
|
||||
- Automatic SOA serial management.
|
||||
- Zone checks that report every row the plugin cannot serve correctly.
|
||||
@@ -94,7 +94,7 @@ The table belongs to the operator and is shared with CoreDNS and possibly with o
|
||||
- `name`: the owner name relative to the zone, without trailing dot; the empty string is the apex. `*` as the complete leftmost label is a wildcard (`*`, `*.dev`). Names are matched through the column collation, so case does not affect lookups, but the application stores them lowercase.
|
||||
- `ttl`: seconds. `0` is served as 360 seconds (the plugin's built-in default). The plugin scans the column into an unsigned integer, so a `NULL` or a negative value makes every query that reads the row fail with SERVFAIL. The application never writes `NULL` or negative values.
|
||||
- `content`: a JSON object whose shape depends on the type (below). A `NULL` or a value that is not valid JSON makes every query that reads the row fail with SERVFAIL.
|
||||
- `record_type`: one of the nine uppercase type names. The plugin selects rows with a case-insensitive `IN (...)` and then dispatches on the exact string, so a lowercase `a` or an unknown type makes queries of that type answer NOTIMP. The application only writes the nine uppercase names.
|
||||
- `record_type`: one of the ten uppercase type names. The plugin selects rows with a case-insensitive `IN (...)` and then dispatches on the exact string, so a lowercase `a` or an unknown type makes queries of that type answer NOTIMP. The application only writes the ten uppercase names.
|
||||
|
||||
### Content JSON per type
|
||||
|
||||
@@ -110,6 +110,7 @@ The keys are those of the plugin source (`types.go`). In particular the MX key i
|
||||
| `TXT` | `{"text": "v=spf1 -all"}` | the plugin splits the text into 255-byte strings |
|
||||
| `SRV` | `{"priority": 10, "weight": 5, "port": 443, "target": "host.example.org."}` | 0 to 65535 each, FQDN |
|
||||
| `CAA` | `{"flag": 0, "tag": "issue", "value": "ca.example.net"}` | |
|
||||
| `TLSA` | `{"usage": 3, "selector": 1, "matching_type": 1, "certificate": "0123...cdef"}` | 0 to 255 each, lowercase hex |
|
||||
| `SOA` | `{"ns": "ns1.example.org.", "MBox": "hostmaster.example.org.", "refresh": 3600, "retry": 600, "expire": 604800, "minttl": 300, "serial": 2026111700}` | only at the apex |
|
||||
|
||||
The application writes content in a canonical form: the keys above in the order above, numbers as JSON numbers, no other keys. Rows written by other writers are read tolerantly (any key order, extra keys ignored) and rewritten in canonical form only when edited.
|
||||
@@ -329,6 +330,7 @@ The CoreDNS user keeps `SELECT` on `coredns_records` only, so it cannot read pas
|
||||
| `TXT` | 1 to 4096 bytes of printable ASCII without backslash |
|
||||
| `SRV` | owner name starts with `_service._proto`; priority, weight, port 0 to 65535; target host or `.` |
|
||||
| `CAA` | flag `0` or `128`; tag 1 to 15 lowercase letters or digits (`issue`, `issuewild`, `iodef` suggested); value 1 to 1024 bytes of printable ASCII without backslash |
|
||||
| `TLSA` | usage, selector, matching type 0 to 255; certificate association data 1 to 65532 bytes as even-length hex, stored lowercase; matching type `1` needs 32 bytes, `2` needs 64 bytes |
|
||||
| `SOA` | apex only; `ns` and `MBox` FQDN; refresh, retry, expire, minttl 0 to 2147483647 |
|
||||
|
||||
After field validation every record is converted to the `miekg/dns` RR the plugin would build from it and packed into a message; a record that does not pack is refused. This catches anything the field rules miss.
|
||||
@@ -586,7 +588,7 @@ Errors (the plugin fails or serves something different):
|
||||
| `ttl_negative` | `ttl` below 0 |
|
||||
| `content_null` | `content` is `NULL` |
|
||||
| `content_json` | `content` is not a JSON object |
|
||||
| `type_unknown` | `record_type` not one of the nine uppercase names |
|
||||
| `type_unknown` | `record_type` not one of the ten uppercase names |
|
||||
| `field_invalid` | a field missing or outside the per-type rules (the plugin skips or misserves the record) |
|
||||
| `name_not_fqdn` | host, target, `ns` or `MBox` without trailing dot |
|
||||
| `mx_priority_key` | MX content with `priority` and no `preference` |
|
||||
@@ -783,7 +785,7 @@ Core flow:
|
||||
1. Start the stack and wait for `/health`.
|
||||
2. The login page shows the bootstrap command; create the first admin through `docker exec ... /app user add <username> admin`, log in.
|
||||
3. Create a zone, wait for the plugin's zone reload, verify SOA and NS answers.
|
||||
4. Create, edit and delete records of all nine types, including wildcards, CNAME chains, null MX and SRV `.` targets, verifying each change with `dig` and the SOA serial bump.
|
||||
4. Create, edit and delete records of all ten types, including wildcards, CNAME chains, null MX and SRV `.` targets, verifying each change with `dig` and the SOA serial bump.
|
||||
5. Bulk delete; export; replace-import of the export produces no changes; merge and replace imports with diffs verified.
|
||||
6. Check panel and `check` CLI against rows broken on purpose through direct SQL (each error code), and the UI's repair of those rows.
|
||||
7. Users and delegation: the admin creates two users with role `user` and a second admin from the Users page and delegates two zones to the first user. The first user sees and edits only those zones, verified with `dig`; the second sees no zone; both get `404` on every other zone and `403` on admin routes. Revoking a delegation takes effect on the next request of an open session; promotion and demotion likewise. Deleting a user ends their sessions and refuses their login; the row is still in MySQL with `deleted_at` set and its delegations and audit rows intact; creating a user with the same username is refused. The last active admin cannot be demoted or deleted.
|
||||
@@ -831,7 +833,7 @@ Each phase ends with all tests green and its commits.
|
||||
|
||||
- The binary starts the HTTP server with no arguments and provides `help`, `version`, `healthcheck`, `user list|add|passwd|role|delete`, `check [zone]` and `audit [n]` with the documented output and exit codes.
|
||||
- The application never creates or alters the records table, verifies its contract at startup and works with the least-privilege grants of section 6.
|
||||
- Zones and records of all nine types can be created, edited and deleted from the UI; every write is validated, serialized per zone, protected by ETags, bumps a managed SOA serial once and is audited in the same transaction.
|
||||
- Zones and records of all ten types can be created, edited and deleted from the UI; every write is validated, serialized per zone, protected by ETags, bumps a managed SOA serial once and is audited in the same transaction.
|
||||
- Admins see and do everything; users see and operate only on the zones delegated to them, on every page and API route. Admins create users, change roles, set passwords, delete users and delegate zones from the web UI. Usernames are unique across all users, deleted ones included; deleting a user only sets `deleted_at`; at least one active admin always remains.
|
||||
- Every operation of section 9 has exactly one audit row with the specified columns, reads and refused requests included, and the audit table is append-only.
|
||||
- Every row written by the application is served by CoreDNS with exactly the entered data, verified end to end with `dig`.
|
||||
|
||||
Reference in new issue
Block a user