mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-05-13 23:12:33 +00:00
Compare commits
21 commits
change-142
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71c190b478 | ||
|
|
a3de8aa081 | ||
|
|
2a6567135e | ||
|
|
7ad60ac704 | ||
|
|
59e0c4460e | ||
|
|
6f2eb69ee0 | ||
|
|
73f15a2df0 | ||
|
|
57385b5934 | ||
|
|
74d3fc2933 | ||
|
|
875df5da76 | ||
|
|
3aaba1f408 | ||
|
|
0ef11bf11d | ||
|
|
811df5abf2 | ||
|
|
cd4052ba6b | ||
|
|
2f5aa2f337 | ||
|
|
2f621a5981 | ||
|
|
fd956519e2 | ||
|
|
0382a368ec | ||
|
|
d54a0d541d | ||
|
|
174e16502a | ||
|
|
11dc1e2aa1 |
14 changed files with 51 additions and 28 deletions
|
|
@ -18,9 +18,9 @@ Run the complete base installation:
|
||||||
|
|
||||||
{
|
{
|
||||||
:local BaseUrl "https://rsc.eworm.de/main/";
|
:local BaseUrl "https://rsc.eworm.de/main/";
|
||||||
:local CertCommonName "Root YE";
|
:local CertCommonName "ISRG Root X2";
|
||||||
:local CertFileName "Root-YE.pem";
|
:local CertFileName "ISRG-Root-X2.pem";
|
||||||
:local CertFingerprint "e14ffcad5b0025731006caa43a121a22d8e9700f4fb9cf852f02a708aa5d5666";
|
:local CertFingerprint "69729b8e15a86efc177a57afb7171dfc64add28c2fca8cf1507e34453ccb1470";
|
||||||
|
|
||||||
:local CertSettings [ /certificate/settings/get ];
|
:local CertSettings [ /certificate/settings/get ];
|
||||||
:if (!((($CertSettings->"builtin-trust-anchors") = "trusted" || \
|
:if (!((($CertSettings->"builtin-trust-anchors") = "trusted" || \
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5 KiB |
12
README.md
12
README.md
|
|
@ -126,18 +126,18 @@ If you intend to download the scripts from a
|
||||||
different location (for example from github.com) install the corresponding
|
different location (for example from github.com) install the corresponding
|
||||||
certificate chain.
|
certificate chain.
|
||||||
|
|
||||||
/tool/fetch "https://rsc.eworm.de/main/certs/Root-YE.pem" dst-path="root-ye.pem";
|
/tool/fetch "https://rsc.eworm.de/main/certs/ISRG-Root-X2.pem" dst-path="isrg-root-x2.pem";
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
> ℹ️ **Info**: Note that the command above does *not* verify server
|
> ℹ️ **Info**: Note that the command above does *not* verify server
|
||||||
> certificate, so if you want to be safe download with your workstations's
|
> certificate, so if you want to be safe download with your workstations's
|
||||||
> browser from CA's website and transfer the file to your MikroTik device:
|
> browser from CA's website and transfer the file to your MikroTik device:
|
||||||
> *Let's Encrypt* / *ISRG* [Root YE ↗️](https://letsencrypt.org/certs/gen-y/root-ye.pem)
|
> *Let's Encrypt* / *ISRG* [ISRG Root X2 ↗️](https://letsencrypt.org/certs/isrg-root-x2.pem)
|
||||||
|
|
||||||
Then we import the certificate.
|
Then we import the certificate.
|
||||||
|
|
||||||
/certificate/import file-name="root-ye.pem" passphrase="";
|
/certificate/import file-name="isrg-root-x2.pem" passphrase="";
|
||||||
|
|
||||||
Do not worry that the command is not shown - that happens because it contains
|
Do not worry that the command is not shown - that happens because it contains
|
||||||
a sensitive property, the passphrase.
|
a sensitive property, the passphrase.
|
||||||
|
|
@ -145,11 +145,11 @@ a sensitive property, the passphrase.
|
||||||

|

|
||||||
|
|
||||||
For basic verification we rename the certificate and print it by
|
For basic verification we rename the certificate and print it by
|
||||||
fingerprint. Make sure exactly this one certificate ("*Root-YE*")
|
fingerprint. Make sure exactly this one certificate ("*ISRG-Root-X2*")
|
||||||
is shown.
|
is shown.
|
||||||
|
|
||||||
/certificate/set name="Root-YE" [ find where common-name="Root YE" ];
|
/certificate/set name="ISRG-Root-X2" [ find where common-name="ISRG Root X2" ];
|
||||||
/certificate/print proplist=name,fingerprint where fingerprint="e14ffcad5b0025731006caa43a121a22d8e9700f4fb9cf852f02a708aa5d5666";
|
/certificate/print proplist=name,fingerprint where fingerprint="69729b8e15a86efc177a57afb7171dfc64add28c2fca8cf1507e34453ccb1470";
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
|
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
|
||||||
:local ScriptName [ :jobname ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
|
:global BackupFileNameDate;
|
||||||
:global BackupPassword;
|
:global BackupPassword;
|
||||||
:global BackupRandomDelay;
|
:global BackupRandomDelay;
|
||||||
:global BackupSendBinary;
|
:global BackupSendBinary;
|
||||||
|
|
@ -73,7 +74,9 @@
|
||||||
|
|
||||||
# filename based on identity
|
# filename based on identity
|
||||||
:local DirName ("tmpfs/" . $ScriptName);
|
:local DirName ("tmpfs/" . $ScriptName);
|
||||||
:local FileName [ $CleanName ($Identity . "." . $Domain) ];
|
:local Clock [ /system/clock/get ];
|
||||||
|
:local FileName [ $CleanName ($Identity . "." . $Domain . [ $IfThenElse \
|
||||||
|
($BackupFileNameDate = true) ("-" . $Clock->"date" . "-" . $Clock->"time") "" ] ) ];
|
||||||
:local FilePath ($DirName . "/" . $FileName);
|
:local FilePath ($DirName . "/" . $FileName);
|
||||||
:local BackupFile "none";
|
:local BackupFile "none";
|
||||||
:local ExportFile "none";
|
:local ExportFile "none";
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
|
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
|
||||||
:local ScriptName [ :jobname ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
|
:global BackupFileNameDate;
|
||||||
:global BackupPassword;
|
:global BackupPassword;
|
||||||
:global BackupRandomDelay;
|
:global BackupRandomDelay;
|
||||||
:global BackupSendBinary;
|
:global BackupSendBinary;
|
||||||
|
|
@ -72,7 +73,9 @@
|
||||||
|
|
||||||
# filename based on identity
|
# filename based on identity
|
||||||
:local DirName ("tmpfs/" . $ScriptName);
|
:local DirName ("tmpfs/" . $ScriptName);
|
||||||
:local FileName [ $CleanName ($Identity . "." . $Domain) ];
|
:local Clock [ /system/clock/get ];
|
||||||
|
:local FileName [ $CleanName ($Identity . "." . $Domain . [ $IfThenElse \
|
||||||
|
($BackupFileNameDate = true) ("-" . $Clock->"date" . "-" . $Clock->"time") "" ] ) ];
|
||||||
:local FilePath ($DirName . "/" . $FileName);
|
:local FilePath ($DirName . "/" . $FileName);
|
||||||
:local BackupFile "none";
|
:local BackupFile "none";
|
||||||
:local ExportFile "none";
|
:local ExportFile "none";
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@ DOMAINS_DUAL = \
|
||||||
cloudflare-dns.com/SSL-com-Root-Certification-Authority-ECC \
|
cloudflare-dns.com/SSL-com-Root-Certification-Authority-ECC \
|
||||||
dns.google/GTS-Root-RX \
|
dns.google/GTS-Root-RX \
|
||||||
dns.quad9.net/DigiCert-Global-Root-G3 \
|
dns.quad9.net/DigiCert-Global-Root-G3 \
|
||||||
git.eworm.de/Root-YE \
|
git.eworm.de/ISRG-Root-X2 \
|
||||||
gitlab.com/USERTrust-RSA-Certification-Authority \
|
gitlab.com/USERTrust-RSA-Certification-Authority \
|
||||||
lists.blocklist.de/GTS-Root-R4 \
|
lists.blocklist.de/GTS-Root-R4 \
|
||||||
matrix.org/GTS-Root-R4 \
|
matrix.org/GTS-Root-R4 \
|
||||||
raw.githubusercontent.com/ISRG-Root-X1 \
|
raw.githubusercontent.com/ISRG-Root-X1 \
|
||||||
rsc.eworm.de/Root-YE \
|
rsc.eworm.de/ISRG-Root-X2 \
|
||||||
upgrade.mikrotik.com/ISRG-Root-X1
|
upgrade.mikrotik.com/ISRG-Root-X1
|
||||||
DOMAINS_IPV4 = \
|
DOMAINS_IPV4 = \
|
||||||
1.1.1.1/SSL-com-Root-Certification-Authority-ECC \
|
1.1.1.1/SSL-com-Root-Certification-Authority-ECC \
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ Configuration
|
||||||
|
|
||||||
The configuration goes to `global-config-overlay`, these are the parameters:
|
The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
|
|
||||||
|
* `BackupFileNameDate`: whether to add date & time in filenames
|
||||||
* `BackupSendBinary`: whether to send binary backup
|
* `BackupSendBinary`: whether to send binary backup
|
||||||
* `BackupSendExport`: whether to send configuration export
|
* `BackupSendExport`: whether to send configuration export
|
||||||
* `BackupSendGlobalConfig`: whether to send `global-config-overlay`
|
* `BackupSendGlobalConfig`: whether to send `global-config-overlay`
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ Configuration
|
||||||
|
|
||||||
The configuration goes to `global-config-overlay`, these are the parameters:
|
The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
|
|
||||||
|
* `BackupFileNameDate`: whether to add date & time in filenames
|
||||||
* `BackupSendBinary`: whether to send binary backup
|
* `BackupSendBinary`: whether to send binary backup
|
||||||
* `BackupSendExport`: whether to send configuration export
|
* `BackupSendExport`: whether to send configuration export
|
||||||
* `BackupSendGlobalConfig`: whether to send `global-config-overlay`
|
* `BackupSendGlobalConfig`: whether to send `global-config-overlay`
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,9 @@
|
||||||
# Toggle this to disable color output in terminal/cli.
|
# Toggle this to disable color output in terminal/cli.
|
||||||
:global TerminalColorOutput true;
|
:global TerminalColorOutput true;
|
||||||
|
|
||||||
# This defines what backups to generate and what password to use.
|
# This defines whether to add date & time in filenames, what backups to generate,
|
||||||
|
# the password to use, and what random delay (between 0 and given seconds) to apply.
|
||||||
|
:global BackupFileNameDate false;
|
||||||
:global BackupSendBinary false;
|
:global BackupSendBinary false;
|
||||||
:global BackupSendExport true;
|
:global BackupSendExport true;
|
||||||
:global BackupSendGlobalConfig true;
|
:global BackupSendGlobalConfig true;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
# Git commit id & info, expected configuration version
|
# Git commit id & info, expected configuration version
|
||||||
:global CommitId "unknown";
|
:global CommitId "unknown";
|
||||||
:global CommitInfo "unknown";
|
:global CommitInfo "unknown";
|
||||||
:global ExpectedConfigVersion 142;
|
:global ExpectedConfigVersion 143;
|
||||||
|
|
||||||
# global variables not to be changed by user
|
# global variables not to be changed by user
|
||||||
:global GlobalFunctionsReady false;
|
:global GlobalFunctionsReady false;
|
||||||
|
|
@ -310,7 +310,7 @@
|
||||||
|
|
||||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||||
:local Char [ :pick $Input $I ];
|
:local Char [ :pick $Input $I ];
|
||||||
:if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" $Char ] ] = "nil") do={
|
:if ([ :typeof [ :find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" $Char ] ] = "nil") do={
|
||||||
:do {
|
:do {
|
||||||
:if ([ :len $Return ] = 0) do={
|
:if ([ :len $Return ] = 0) do={
|
||||||
:error true;
|
:error true;
|
||||||
|
|
@ -812,10 +812,15 @@
|
||||||
# check if DNS is resolving
|
# check if DNS is resolving
|
||||||
:set IsDNSResolving do={
|
:set IsDNSResolving do={
|
||||||
:do {
|
:do {
|
||||||
:resolve "low-ttl.eworm.de";
|
:local I 1;
|
||||||
|
:retry {
|
||||||
|
:set I ($I ^ 1);
|
||||||
|
:resolve ("low-ttl.eworm." . ({ "de"; "net" }->$I));
|
||||||
|
} delay=50ms max=6;
|
||||||
} on-error={
|
} on-error={
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:return true;
|
:return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1200,10 +1205,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
/file/remove $DirName;
|
/file/remove [ find where name=$DirName ];
|
||||||
} do={
|
} do={
|
||||||
$LogPrint error $0 ("Removing directory '" . $DirName . "' failed: " . $Err);
|
:if (!($Err ~ "no such item")) do={
|
||||||
:return false;
|
$LogPrint error $0 ("Removing directory '" . $DirName . "' failed: " . $Err);
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
:return true;
|
:return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1229,10 +1236,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
/file/remove $FileName;
|
/file/remove [ find where name=$FileName ];
|
||||||
} do={
|
} do={
|
||||||
$LogPrint error $0 ("Removing file '" . $FileName . "' failed: " . $Err);
|
:if (!($Err ~ "no such item")) do={
|
||||||
:return false;
|
$LogPrint error $0 ("Removing file '" . $FileName . "' failed: " . $Err);
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
:return true;
|
:return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1292,7 +1301,8 @@
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global ValidateSyntax;
|
:global ValidateSyntax;
|
||||||
|
|
||||||
:if ([ $CertificateAvailable "Root YE" "fetch" ] = false) do={
|
:if ([ $CertificateAvailable "ISRG Root X2" "fetch" ] = false || \
|
||||||
|
[ $CertificateAvailable "Root YE" "fetch" ] = false) do={
|
||||||
$LogPrint warning $0 ("Downloading certificate failed, trying without.");
|
$LogPrint warning $0 ("Downloading certificate failed, trying without.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
:local Pool [ /ipv6/pool/get [ find where prefix=$PdPrefix ] name ];
|
:local Pool [ /ipv6/pool/get [ find where prefix=$PdPrefix ] name ];
|
||||||
:if ([ :len [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ] ] = 0) do={
|
:if ([ :len [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ] ] = 0) do={
|
||||||
/ipv6/firewall/address-list/add list=("ipv6-pool-" . $Pool) address=:: comment=("ipv6-pool-" . $Pool) dynamic=yes;
|
/ipv6/firewall/address-list/add list=("ipv6-pool-" . $Pool) address=:: comment=("ipv6-pool-" . $Pool) dynamic=yes;
|
||||||
$LogPrint warning $ScriptName ("Added dynamic ipv6 address list entry for ipv6-pool-" . $Pool);
|
$LogPrint info $ScriptName ("Added dynamic ipv6 address list entry for ipv6-pool-" . $Pool);
|
||||||
}
|
}
|
||||||
:local AddrList [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ];
|
:local AddrList [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ];
|
||||||
:local OldPrefix [ /ipv6/firewall/address-list/get ($AddrList->0) address ];
|
:local OldPrefix [ /ipv6/firewall/address-list/get ($AddrList->0) address ];
|
||||||
|
|
|
||||||
|
|
@ -115,13 +115,15 @@
|
||||||
|
|
||||||
:local Data false;
|
:local Data false;
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
|
:local I 1;
|
||||||
:retry {
|
:retry {
|
||||||
|
:set I ($I ^ 1);
|
||||||
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
|
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
|
||||||
http-header-field=({ "accept: application/dns-message" }) \
|
http-header-field=({ "accept: application/dns-message" }) \
|
||||||
url=(($DohServer->"doh-url") . "?dns=" . [ :convert to=base64 ([ :rndstr length=2 ] . \
|
url=(($DohServer->"doh-url") . "?dns=" . [ :convert to=base64 ([ :rndstr length=2 ] . \
|
||||||
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm\02de\00" . \
|
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm" . \
|
||||||
"\00\10" . "\00\01") ]) as-value ]->"data");
|
({ "\02de"; "\03net" }->$I) . "\00" . "\00\10" . "\00\01") ]) as-value ]->"data");
|
||||||
} delay=1s max=3;
|
} delay=500ms max=6;
|
||||||
} do={
|
} do={
|
||||||
$LogPrint warning $ScriptName ("Request to DoH server " . ($DohServer->"doh-url") . \
|
$LogPrint warning $ScriptName ("Request to DoH server " . ($DohServer->"doh-url") . \
|
||||||
" failed: " . $Err);
|
" failed: " . $Err);
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@
|
||||||
140="The scripts 'lease-script' was renamed to 'dhcpv4-server-lease', configuration was updated automatically.";
|
140="The scripts 'lease-script' was renamed to 'dhcpv4-server-lease', configuration was updated automatically.";
|
||||||
141="Introduced script 'dhcpv6-client-lease' to run several scripts on IPv6 DHCP client lease.";
|
141="Introduced script 'dhcpv6-client-lease' to run several scripts on IPv6 DHCP client lease.";
|
||||||
142="Added a setting for 'mod/notification-email' to check availability of certificate chain.";
|
142="Added a setting for 'mod/notification-email' to check availability of certificate chain.";
|
||||||
|
143="Made backup scripts 'backup-email' and 'backup-upload' support date & time in filenames.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Migration steps to be applied on script updates
|
# Migration steps to be applied on script updates
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue