aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-04-06 22:38:17 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-04-07 23:36:09 +0200
commitf14788a10444022ae0f7d0bea7839facf36128f1 (patch)
tree1e6fea3b44feda3c7b086f3bf20e6c5838c19e4d
parent96170950222dd4e63b7bd01c3db3298b902c4c87 (diff)
check-certificates: properly escape the name for regex
-rw-r--r--check-certificates.rsc3
1 files changed, 2 insertions, 1 deletions
diff --git a/check-certificates.rsc b/check-certificates.rsc
index 1a984bc..98a6cab 100644
--- a/check-certificates.rsc
+++ b/check-certificates.rsc
@@ -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 ];
}