Adds option/arg to allow minimal devices to make TLS insecure requests if needed, also adds compile.go build driver

This commit is contained in:
markmental 2026-09-08 20:14:46 -04:00
commit ced950004a
7 changed files with 378 additions and 33 deletions

View file

@ -30,14 +30,15 @@ dns.ValidSyntax("no-dot") // =&gt; false</pre></td></tr></table>
<hr>
<a name="CheckDNS"></a>
<font color="#859900"><h2>CheckDNS</h2></font>
<table border="0" cellpadding="8" width="100%"><tr><td bgcolor="#073642"><pre>func CheckDNS(ctx context.Context, domain string) error</pre></td></tr></table>
<table border="0" cellpadding="8" width="100%"><tr><td bgcolor="#073642"><pre>func CheckDNS(ctx context.Context, domain string, timeout time.Duration) error</pre></td></tr></table>
<p>Aborts early on NXDOMAIN or unresolvable names via
<tt>net.DefaultResolver.LookupIP</tt> with a 5 second deadline. Returns
<tt>net.DefaultResolver.LookupIP</tt> with the given deadline. Returns
<tt>nil</tt> when at least one IPv4 address resolves, an error otherwise.</p>
<table border="1" cellpadding="4">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td><tt>ctx</tt></td><td>Parent context; the global 15 second budget.</td></tr>
<tr><td><tt>domain</tt></td><td>Already-normalized domain to resolve.</td></tr>
<tr><td><tt>timeout</tt></td><td>Per-call deadline (the CLI --timeout value).</td></tr>
</table>
</body>
</html>

View file

@ -12,17 +12,20 @@ symbols; this page documents behavior.</p>
<font color="#859900"><h2>Arguments</h2></font>
<p>Syntax: <tt>isthislegit [FLAGS] &lt;legit_domain&gt;
&lt;suspect_domain&gt;</tt>. Flags <tt>-v/--verbose</tt>,
<tt>-j/--json</tt>, <tt>--scale</tt>, <tt>-h/--help</tt>, plus a
<tt>-j/--json</tt>, <tt>-k/--insecure</tt> (skips RDAP TLS verification with
a warning), <tt>--timeout=DUR</tt> (Go duration, default 5s),
<tt>--scale</tt>, <tt>-h/--help</tt>, plus a
<tt>--</tt> separator. Unknown flags and anything other than exactly two
positional domains exit 1 with a usage message. Domains are normalized with
<a href="dns.html#NormalizeDomain">dns.NormalizeDomain</a> and validated
with <a href="dns.html#ValidSyntax">dns.ValidSyntax</a>.</p>
with <a href="dns.html#ValidSyntax">dns.ValidSyntax</a>. Fail-closed errors
include the underlying fetch cause(s).</p>
<font color="#859900"><h2>Budgets</h2></font>
<table border="1" cellpadding="4">
<tr><th>Budget</th><th>Value</th></tr>
<tr><td>Global deadline (both domains)</td><td>15 seconds</td></tr>
<tr><td>Per-call deadline (DNS, TLS, RDAP)</td><td>5 seconds</td></tr>
<tr><td>Per-call deadline (DNS, TLS, RDAP)</td><td>5 seconds, adjustable with --timeout</td></tr>
<tr><td>Attempts per call</td><td>3, with 1 second between retries</td></tr>
</table>

View file

@ -23,6 +23,8 @@ go test ./...</pre></td></tr></table>
<tr><th>Flag</th><th>Description</th></tr>
<tr><td><tt>-v, --verbose</tt></td><td>Append raw cert policy OIDs, TLS details, and RDAP JSON.</td></tr>
<tr><td><tt>-j, --json</tt></td><td>Output the result summary as JSON for scripting.</td></tr>
<tr><td><tt>-k, --insecure</tt></td><td>Skip TLS verification for RDAP (weakens results; last resort for devices without CA certificates).</td></tr>
<tr><td><tt>--timeout=DUR</tt></td><td>Per-call deadline for DNS/TLS/RDAP; Go duration, default 5s.</td></tr>
<tr><td><tt>--scale</tt></td><td>Print the scoring scale table and exit.</td></tr>
<tr><td><tt>-h, --help</tt></td><td>Display usage and exit.</td></tr>
</table>
@ -30,8 +32,10 @@ go test ./...</pre></td></tr></table>
<font color="#859900"><h2>Fetch Pipeline</h2></font>
<p>Both domains are fetched concurrently with
<tt>golang.org/x/sync/errgroup</tt> under a 15 second global deadline; each
DNS, TLS, and RDAP call carries a 5 second deadline and is retried up to 3
times. Total run time equals the slower of the two domains.</p>
DNS, TLS, and RDAP call carries a 5 second deadline (adjustable with
<tt>--timeout</tt>) and is retried up to 3 times. Total run time equals the
slower of the two domains. Fail-closed errors name the underlying
cause(s).</p>
<table border="0" cellpadding="8" width="100%"><tr><td bgcolor="#073642"><pre>parse args --&gt; DNS pre-flight (target + suspect, parallel)
--&gt; fetch target = RDAP + TLS in parallel
--&gt; fetch suspect = RDAP + TLS in parallel
@ -40,6 +44,14 @@ times. Total run time equals the slower of the two domains.</p>
<tt>--help</tt>), <tt>1</tt> on bad flags, invalid domains, DNS failure, or
failed data-quality verification.</p>
<font color="#859900"><h2>Embedded Systems</h2></font>
<p>The tool runs on embedded ARM devices (verified on a Miyoo Mini Plus),
but minimal firmware often ships without a CA certificate store. DNS and
certificate inspection still work there, while verified HTTPS (RDAP) fails;
the fail-closed error names the cause (<tt>x509: certificate signed by
unknown authority</tt>). Install <tt>ca-certificates</tt> and fix the clock
where possible, otherwise use <tt>-k/--insecure</tt> as a last resort.</p>
<font color="#859900"><h2>Scoring Scale</h2></font>
<table border="1" cellpadding="4">
<tr><th>Signal</th><th>Points</th></tr>