2018-12-17 22:15:23 +00:00
#!rsc
# RouterOS script: initial-commands
2020-01-01 16:00:39 +00:00
# Copyright (c) 2018-2020 Christian Hesse <mail@eworm.de>
2018-12-17 22:15:23 +00:00
{
2019-08-30 11:28:14 +00:00
/ tool fetch "https://git.eworm.de/cgit/routeros-scripts/plain/certs/Let%27s%20Encrypt%20Authority%20X3.pem" dst-path="letsencrypt.pem";
2018-12-17 22:15:23 +00:00
:delay 1s;
2019-01-12 14:48:48 +00:00
/ certificate {
import file-name=letsencrypt.pem passphrase="";
set name="ISRG-Root-X1" [ find where fingerprint="96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6" ];
set name="Let-s-Encrypt-Authority-X3" [ find where fingerprint="731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568" ];
set name="DST-Root-CA-X3" [ find where fingerprint="0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739" ];
}
2018-12-20 16:25:23 +00:00
:if ([ / certificate print count-only where fingerprint="96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6" or fingerprint="731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568" or fingerprint="0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739" ] != 3) do={
2019-11-04 23:28:30 +00:00
:error "Something is wrong with your certificates!";
2018-12-17 22:15:23 +00:00
}
2019-04-30 14:11:47 +00:00
/ file remove "letsencrypt.pem";
2019-09-03 18:59:00 +00:00
:foreach Script in={ "global-config"; "global-config-overlay"; "global-functions"; "script-updates" } do={
2019-08-30 11:28:14 +00:00
/ system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script) output=user as-value]->"data");
2018-12-17 22:15:23 +00:00
}
2019-09-03 18:59:00 +00:00
/ system script { run global-config; run global-config-overlay; run global-functions; }
/ system scheduler add name="global-scripts" start-time=startup on-event="/ system script { run global-config; run global-config-overlay; run global-functions; }"
2018-12-17 22:15:23 +00:00
}