mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
netwatch-dns: enable DoH certificate verification...
... if a certificate is named in configuration.
This commit is contained in:
parent
44a8195c37
commit
80db12a3e9
1 changed files with 3 additions and 1 deletions
|
@ -59,6 +59,7 @@ $ScriptLock $0;
|
|||
|
||||
:local DohServer "";
|
||||
:local DohCert "";
|
||||
:local DohCertVerify [ /ip/dns/get verify-doh-cert ];
|
||||
:local DohCurrent [ /ip/dns/get use-doh-server ];
|
||||
|
||||
:foreach Host in=[ /tool/netwatch/find where comment~"\\bdoh\\b" status="up" ] do={
|
||||
|
@ -81,12 +82,13 @@ $ScriptLock $0;
|
|||
:if ($DohServer != $DohCurrent) do={
|
||||
$LogPrintExit2 info $0 ("Updating DoH server: " . $DohServer) false;
|
||||
:if ([ :len $DohCert ] > 0) do={
|
||||
:set DohCertVerify true;
|
||||
/ip/dns/set use-doh-server="";
|
||||
:if ([ $CertificateAvailable $DohCert ] = false) do={
|
||||
$LogPrintExit2 warning $0 ("Downloading certificate failed, trying without.") false;
|
||||
}
|
||||
}
|
||||
/ip/dns/set use-doh-server=$DohServer;
|
||||
/ip/dns/set use-doh-server=$DohServer verify-doh-cert=$DohCertVerify;
|
||||
/ip/dns/cache/flush;
|
||||
}
|
||||
} else={
|
||||
|
|
Loading…
Reference in a new issue