mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-04-19 03:29:36 +00:00
Compare commits
14 commits
58014a0128
...
ec899ea06d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec899ea06d | ||
|
|
83b3c6075a | ||
|
|
4f1a439cd6 | ||
|
|
1199a6580c | ||
|
|
25f6070a09 | ||
|
|
94cabf449b | ||
|
|
9c12676f73 | ||
|
|
92759fcca5 | ||
|
|
ad310e6573 | ||
|
|
c0c1c5521e | ||
|
|
0fffb5198e | ||
|
|
330a616406 | ||
|
|
0fee5cea3c | ||
|
|
d673f0956c |
4 changed files with 63 additions and 11 deletions
37
certs/Root-YR.pem
Normal file
37
certs/Root-YR.pem
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# Issuer: C=US, O=ISRG, CN=Root YR
|
||||
# Subject: C=US, O=ISRG, CN=Root YR
|
||||
# Label: "Root YR"
|
||||
# Serial: EC46349360CF4B0FF8A982D93AA9CA3D
|
||||
# MD5 Fingerprint: B7:C3:9E:B2:5C:FA:D6:0D:0B:F8:7F:A6:D8:A0:95:F7
|
||||
# SHA1 Fingerprint: C5:F1:11:DA:84:F7:DE:F8:E6:F3:F9:9F:8F:5F:36:FF:85:BA:B1:B1
|
||||
# SHA256 Fingerprint: E5:7B:7E:6F:15:0C:41:91:02:E8:D5:C0:55:72:9F:F9:67:B9:D1:A8:29:BF:00:CE:C8:9C:A6:04:EB:F4:A8:6F
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFKTCCAxGgAwIBAgIRAOxGNJNgz0sP+KmC2Tqpyj0wDQYJKoZIhvcNAQELBQAw
|
||||
LjELMAkGA1UEBhMCVVMxDTALBgNVBAoTBElTUkcxEDAOBgNVBAMTB1Jvb3QgWVIw
|
||||
HhcNMjUwOTAzMDAwMDAwWhcNNDUwOTAyMjM1OTU5WjAuMQswCQYDVQQGEwJVUzEN
|
||||
MAsGA1UEChMESVNSRzEQMA4GA1UEAxMHUm9vdCBZUjCCAiIwDQYJKoZI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2NNmdb5fd0WGVGsCdoAJ3N8ozo7ajE8t6vfxStZb4BQ9WYJGHUDrv2N
|
||||
i5tJF6CNiPnlzs3BUfECRbE4JSk+jvy8+VoGiFE8qsH/j78x2fjgQhAQFV7P7Zxy
|
||||
dBTZ1wEkNpZNW2qnaK1SKBLa+xf6E06YRIq5uaI+HWH8SY1y5VbRgzq40EKg3yxP
|
||||
06fz+uYAUIFJoLNfhwRCc3Q6pQVuMX3yAjHAes4gk4moGcLQ5p7HAh39yeylZc1J
|
||||
41sx/jKwLIkPE6Rr1Nf4pxdsxf9SA4yOEiAkDgq04DVxn8hgYFdUtBCuiuVC2heA
|
||||
EiqVEa+8QZjuw8Gj0EbHXcRd1nInvGqRS1o9Is7YBdQN57X1AYveGBNNqjICSb7c
|
||||
awuw1EawTDrs13VUlJVEsbQ0/O/1aaV73mCdOQ8azqL2KTv1Ewu1xbquE2S+kdQU
|
||||
To9TUwat3wUA6cwXh1EfpS/3fJ0aGah5hdpRyoCLDlsSn8tkrjMfFFX0viC+GxHc
|
||||
sI1ANRYvqSFC2X1VRZfDg+wD6E21BccmifG4yWc=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -194,11 +194,13 @@
|
|||
|
||||
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
|
||||
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
|
||||
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>$CertRenewTime ];
|
||||
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] ];
|
||||
:local CertNewVal [ /certificate/get $CertNew ];
|
||||
|
||||
:if ([ $CertificateAvailable ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") "fetch" ] = false) do={
|
||||
$LogPrint warning $ScriptName ("The certificate chain is not available!");
|
||||
:if (($CertVal->"expires-after") > ($CertNewVal->"expires-after")) do={
|
||||
/certificate/remove $CertNew;
|
||||
$LogPrint warning $ScriptName ("Old certificate is newer than the new one. Aborting renew.");
|
||||
:error false;
|
||||
}
|
||||
|
||||
:if (($CertVal->"private-key") = true && ($CertVal->"private-key") != ($CertNewVal->"private-key")) do={
|
||||
|
|
@ -207,6 +209,10 @@
|
|||
:error false;
|
||||
}
|
||||
|
||||
:if ([ $CertificateAvailable ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") "fetch" ] = false) do={
|
||||
$LogPrint warning $ScriptName ("The certificate chain is not available!");
|
||||
}
|
||||
|
||||
/ip/service/set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ];
|
||||
|
||||
/ip/ipsec/identity/set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ];
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ The DNS and DoH servers to be checked have to be added to netwatch with
|
|||
specific comment:
|
||||
|
||||
/tool/netwatch/add comment="doh" host=1.1.1.1;
|
||||
/tool/netwatch/add comment="dns" host=8.8.8.8;
|
||||
/tool/netwatch/add comment="doh, dns" host=9.9.9.9;
|
||||
/tool/netwatch/add comment="dns" host=8.8.8.8;
|
||||
|
||||
This will configure *cloudflare-dns* for DoH (`https://1.1.1.1/dnsquery`), and
|
||||
*google-dns* and *quad-nine* for regular DNS (`8.8.8.8,9.9.9.9`) if up.
|
||||
*quad-nine* and *google-dns* for regular DNS (`9.9.9.9,8.8.8.8`) if up.
|
||||
If *cloudflare-dns* is down the script will fall back to *quad-nine* for DoH.
|
||||
|
||||
Giving a specific query url for DoH is possible:
|
||||
|
|
@ -55,16 +55,22 @@ resolves to the same address.
|
|||
|
||||
/ip/dns/static/add name="cloudflare-dns.com" address=1.1.1.1;
|
||||
/tool/netwatch/add comment="doh" host=1.1.1.1;
|
||||
/ip dns static add name=dns.quad9.net address=9.9.9.9;
|
||||
/tool/netwatch/add comment="doh" host=9.9.9.9;
|
||||
/ip/dns/static/add name=dns.google address=8.8.8.8;
|
||||
/tool/netwatch/add comment="doh" host=8.8.8.8;
|
||||
|
||||
Be aware that you have to keep the ip address in sync with real world
|
||||
manually!
|
||||
|
||||
Importing a certificate automatically is possible. You may want to find the
|
||||
[certificate name from browser](../CERTIFICATES.md).
|
||||
[certificate name from browser](../CERTIFICATES.md). Sometimes a service
|
||||
randomly switches the CA used to issue the certificate, or it just depends
|
||||
geolocation - give several certificate delimited with colon (`:`) then.
|
||||
|
||||
/tool/netwatch/add comment="doh, doh-cert=SSL.com Root Certification Authority ECC" host=1.1.1.1;
|
||||
/tool/netwatch/add comment="doh, doh-cert=DigiCert Global Root G3" host=9.9.9.9;
|
||||
/tool/netwatch/add comment="doh, doh-cert=GTS Root R1" host=8.8.8.8;
|
||||
/tool/netwatch/add comment="doh, doh-cert=GTS Root R1:GTS Root R4" host=8.8.8.8;
|
||||
|
||||
> ⚠️ **Warning**: Combining these techniques can cause some confusion and
|
||||
> troubles! Chances are that a service uses different certificates based
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
:local ScriptName [ :jobname ];
|
||||
|
||||
:global CertificateAvailable;
|
||||
:global CharacterReplace;
|
||||
:global EitherOr;
|
||||
:global IsDNSResolving;
|
||||
:global LogPrint;
|
||||
|
|
@ -103,10 +104,12 @@
|
|||
}
|
||||
|
||||
:foreach DohServer in=$DohServers do={
|
||||
:if ([ :len ($DohServer->"doh-cert") ] > 0) do={
|
||||
:if ([ $CertificateAvailable ($DohServer->"doh-cert") "fetch" ] = false || \
|
||||
[ $CertificateAvailable ($DohServer->"doh-cert") "dns" ] = false) do={
|
||||
$LogPrint warning $ScriptName ("Downloading certificate failed, trying without.");
|
||||
:foreach DohCert in=[ :toarray [ $CharacterReplace ($DohServer->"doh-cert") ":" "," ] ] do={
|
||||
:if ([ :len $DohCert ] > 0) do={
|
||||
:if ([ $CertificateAvailable $DohCert "fetch" ] = false || \
|
||||
[ $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