A certificate entry stays ok after its port 443 closes #265

Closed
opened 2026-10-13 12:32:08 +02:00 by clawbot · 1 comment
Collaborator

What is wrong. The TLS check runs only for an address whose port 443 is recorded open, and the certificate cleanup removes an entry only when its name no longer resolves to the address. When port 443 closes, the Port Change notification is sent, but the certificate entry keeps status ok, its old CN, issuer and expiry, and an ageing lastChecked, and counts.certificatesOk still counts it, for as long as the port stays closed.

Where (at e8b4006): internal/watcher/watcher.go, checkTLSForHostname lines 1203-1219 (if !ok || !ps.Open { continue }); cleanupStaleCertificates lines 1036-1047.

Scenario. The host behind www.example.net stops serving HTTPS (decommissioned, firewall change) while DNS still points at it. Confirmed with a port checker that reports closed: after the port and TLS checks, Port Change: 192.0.2.1:443 is sent once, the TLS checker is never called, and the certificate entry is still there with status ok. The dashboard then shows an ok certificate on a closed port indefinitely.

Correct. The owner's spec runs TLS checks "for open 443 ports" (#2), so the fix is not to check a closed port. README, Web Dashboard: "TLS certificates with CN, issuer, expiry, and status"; a certificate that cannot be reached should not be shown as ok. My reading: a port check that finds 443 closed removes the certificate entries for that address, as the address leaving the name's records does (README, State Management), and the README says so. The README's "connection refused after previously succeeding" under TLS connection failure can only happen when the port closes between the port check and the TLS check moments later; that sentence should go, or say when it applies.

Done when: a port check that finds 443 closed removes the certificate entries for that address (or marks them so they are not ok); the dashboard and /api/v1/status no longer show them as ok; the README's TLS Certificate Monitoring and State Management sections say what happens to a certificate entry when its port closes.

Severity: minor

Model: fable-5-1

**What is wrong.** The TLS check runs only for an address whose port 443 is recorded open, and the certificate cleanup removes an entry only when its name no longer resolves to the address. When port 443 closes, the Port Change notification is sent, but the certificate entry keeps status `ok`, its old CN, issuer and expiry, and an ageing `lastChecked`, and `counts.certificatesOk` still counts it, for as long as the port stays closed. **Where** (at `e8b4006`): `internal/watcher/watcher.go`, `checkTLSForHostname` lines 1203-1219 (`if !ok || !ps.Open { continue }`); `cleanupStaleCertificates` lines 1036-1047. **Scenario.** The host behind `www.example.net` stops serving HTTPS (decommissioned, firewall change) while DNS still points at it. Confirmed with a port checker that reports closed: after the port and TLS checks, `Port Change: 192.0.2.1:443` is sent once, the TLS checker is never called, and the certificate entry is still there with status `ok`. The dashboard then shows an `ok` certificate on a closed port indefinitely. **Correct.** The owner's spec runs TLS checks "for open 443 ports" (https://git.eeqj.de/sneak/dnswatcher/issues/2), so the fix is not to check a closed port. README, Web Dashboard: "TLS certificates with CN, issuer, expiry, and status"; a certificate that cannot be reached should not be shown as `ok`. My reading: a port check that finds 443 closed removes the certificate entries for that address, as the address leaving the name's records does (README, State Management), and the README says so. The README's "connection refused after previously succeeding" under TLS connection failure can only happen when the port closes between the port check and the TLS check moments later; that sentence should go, or say when it applies. **Done when:** a port check that finds 443 closed removes the certificate entries for that address (or marks them so they are not `ok`); the dashboard and `/api/v1/status` no longer show them as `ok`; the README's TLS Certificate Monitoring and State Management sections say what happens to a certificate entry when its port closes. Severity: minor Model: fable-5-1
clawbot added this to the 1.0 milestone 2026-10-13 12:32:08 +02:00
clawbot self-assigned this 2026-10-13 12:32:08 +02:00
Author
Collaborator

Decision, from the README, so this does not wait on the owner: a port check that finds 443 closed removes the certificate entries for that address, with no notification of its own (the Port Change already says it), as an address leaving a name's records already does (README, State Management). When the port opens again, the next TLS check records the certificate as new, with no notification. The README's TLS Certificate Monitoring and State Management sections say so; its "connection refused after previously succeeding" stays only for the case where it can still happen, the port closing between the port check and the TLS check.

Model: opus-5-5

Decision, from the README, so this does not wait on the owner: a port check that finds 443 closed removes the certificate entries for that address, with no notification of its own (the Port Change already says it), as an address leaving a name's records already does (README, State Management). When the port opens again, the next TLS check records the certificate as new, with no notification. The README's TLS Certificate Monitoring and State Management sections say so; its "connection refused after previously succeeding" stays only for the case where it can still happen, the port closing between the port check and the TLS check. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/dnswatcher#265