File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ Giving a specific query url for DoH is possible:
4343
4444Note that using a name in DoH url may introduce a chicken-and-egg issue!
4545
46+ Importing a certificate automatically is possible, at least if available in
47+ the repository (see ` certs ` sub directory).
48+
49+ /tool/netwatch/add comment="doh, doh-cert=DigiCert TLS Hybrid ECC SHA384 2020 CA1" host=1.1.1.1;
50+ /tool/netwatch/add comment="doh, doh-cert=DigiCert TLS Hybrid ECC SHA384 2020 CA1" host=9.9.9.9;
51+ /tool/netwatch/add comment="doh, doh-cert=GTS CA 1C3" host=8.8.8.8;
52+
4653Sometimes using just one specific (possibly internal) DNS server may be
4754desired, with fallback in case it fails. This is possible as well:
4855
Original file line number Diff line number Diff line change 1010:global GlobalFunctionsReady;
1111:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
1212
13+ :global CertificateAvailable;
1314:global EitherOr;
1415:global LogPrintExit2;
1516:global ParseKeyValueStore;
@@ -58,6 +59,7 @@ $ScriptLock $0;
5859
5960:local DohServer "";
6061:local DohCurrent [ /ip/dns/get use-doh-server ];
62+ :local DohCert;
6163
6264:foreach Host in=[ /tool/netwatch/find where comment~"doh" !disabled ] do={
6365 :local HostVal [ /tool/netwatch/get $Host ];
@@ -67,12 +69,19 @@ $ScriptLock $0;
6769 $HostInfo->"disabled" != true && $DohServer = "") do={
6870 :set DohServer [ $EitherOr ($HostInfo->"doh-url") \
6971 ("https://" . $HostVal->"host" . "/dns-query") ];
72+ :set DohCert ($HostInfo->"doh-cert");
7073 }
7174}
7275
7376:if ($DohServer != "") do={
7477 :if ($DohServer != $DohCurrent) do={
7578 $LogPrintExit2 info $0 ("Updating DoH server: " . $DohServer) false;
79+ :if ([ :len $DohCert ] > 0) do={
80+ /ip/dns/set use-doh-server="";
81+ :if ([ $CertificateAvailable $DohCert ] = false) do={
82+ $LogPrintExit2 warning $0 ("Downloading certificate failed, trying without.") false;
83+ }
84+ }
7685 /ip/dns/set use-doh-server=$DohServer;
7786 /ip/dns/cache/flush;
7887 }
You can’t perform that action at this time.
0 commit comments