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:
43
43
44
44
Note that using a name in DoH url may introduce a chicken-and-egg issue!
45
45
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
+
46
53
Sometimes using just one specific (possibly internal) DNS server may be
47
54
desired, with fallback in case it fails. This is possible as well:
48
55
Original file line number Diff line number Diff line change 10
10
:global GlobalFunctionsReady;
11
11
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
12
12
13
+ :global CertificateAvailable;
13
14
:global EitherOr;
14
15
:global LogPrintExit2;
15
16
:global ParseKeyValueStore;
@@ -58,6 +59,7 @@ $ScriptLock $0;
58
59
59
60
:local DohServer "";
60
61
:local DohCurrent [ /ip/dns/get use-doh-server ];
62
+ :local DohCert "";
61
63
62
64
:foreach Host in=[ /tool/netwatch/find where comment~"doh" !disabled ] do={
63
65
:local HostVal [ /tool/netwatch/get $Host ];
@@ -67,12 +69,19 @@ $ScriptLock $0;
67
69
$HostInfo->"disabled" != true && $DohServer = "") do={
68
70
:set DohServer [ $EitherOr ($HostInfo->"doh-url") \
69
71
("https://" . $HostVal->"host" . "/dns-query") ];
72
+ :set DohCert ($HostInfo->"doh-cert");
70
73
}
71
74
}
72
75
73
76
:if ($DohServer != "") do={
74
77
:if ($DohServer != $DohCurrent) do={
75
78
$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
+ }
76
85
/ip/dns/set use-doh-server=$DohServer;
77
86
/ip/dns/cache/flush;
78
87
}
You can’t perform that action at this time.
0 commit comments