mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-18 15:09:33 +00:00
netwatch-dns: support multiple certificates
Some services use certificates issued by differnt CA certificates,
depending on geolocation. One example is dns.google, which may require
either of 'GTS Root R1' or 'GTS Root R4'.
/tool/netwatch/add comment="doh, dns, name=google-dns-ipv4, doh-cert=GTS Root R1:GTS Root R4" host=8.8.8.8 type=simple;
This commit is contained in:
parent
330a616406
commit
0fffb5198e
1 changed files with 7 additions and 4 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
:local ScriptName [ :jobname ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global CertificateAvailable;
|
:global CertificateAvailable;
|
||||||
|
:global CharacterReplace;
|
||||||
:global EitherOr;
|
:global EitherOr;
|
||||||
:global IsDNSResolving;
|
:global IsDNSResolving;
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
|
|
@ -103,10 +104,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach DohServer in=$DohServers do={
|
:foreach DohServer in=$DohServers do={
|
||||||
:if ([ :len ($DohServer->"doh-cert") ] > 0) do={
|
:foreach DohCert in=[ :toarray [ $CharacterReplace ($DohServer->"doh-cert") ":" "," ] ] do={
|
||||||
:if ([ $CertificateAvailable ($DohServer->"doh-cert") "fetch" ] = false || \
|
:if ([ :len $DohCert ] > 0) do={
|
||||||
[ $CertificateAvailable ($DohServer->"doh-cert") "dns" ] = false) do={
|
:if ([ $CertificateAvailable $DohCert "fetch" ] = false || \
|
||||||
$LogPrint warning $ScriptName ("Downloading certificate failed, trying without.");
|
[ $CertificateAvailable $DohCert "dns" ] = false) do={
|
||||||
|
$LogPrint warning $ScriptName ("Downloading certificate '" . $DohCert . "' failed, trying without.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue