1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

check-certificates: properly escape the name for regex

This commit is contained in:
Christian Hesse
2023-04-06 22:38:17 +02:00
parent 9617095022
commit f14788a104

View File

@ -32,6 +32,7 @@
:global CertRenewPass;
:global CertificateNameByCN;
:global EscapeForRegEx;
:global LogPrintExit2;
:global UrlEncode;
:global WaitForFile;
@ -58,7 +59,7 @@
$LogPrintExit2 warning $0 ("Decryption failed for certificate file " . $CertFileName) false;
}
:foreach CertInChain in=[ /certificate/find where name~("^" . $CertFileName . "_[0-9]+\$") \
:foreach CertInChain in=[ /certificate/find where name~("^" . [ $EscapeForRegEx $CertFileName ] . "_[0-9]+\$") \
common-name!=$Name !(subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $Name ] . "(\\W|\$)")) !(common-name=[]) ] do={
$CertificateNameByCN [ /certificate/get $CertInChain common-name ];
}