mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
check-certificates: try to fetch PEM and P12 file
This commit is contained in:
@@ -34,11 +34,17 @@
|
||||
:error "No CertRenewUrl given.";
|
||||
}
|
||||
|
||||
/ tool fetch check-certificate=yes-without-crl ($CertRenewUrl . $CommonName . ".pem");
|
||||
:foreach PassPhrase in=$CertRenewPass do={
|
||||
/ certificate import file-name=($CommonName . ".pem") passphrase=$PassPhrase;
|
||||
:foreach Type in={ ".pem"; ".p12" } do={
|
||||
:do {
|
||||
/ tool fetch check-certificate=yes-without-crl ($CertRenewUrl . $CommonName . $Type);
|
||||
:foreach PassPhrase in=$CertRenewPass do={
|
||||
/ certificate import file-name=($CommonName . $Type) passphrase=$PassPhrase;
|
||||
}
|
||||
/ file remove [ find where name=($CommonName . $Type) ];
|
||||
} on-error={
|
||||
:log debug ("Could not download certificate file " . $CommonName . $Type);
|
||||
}
|
||||
}
|
||||
/ file remove [ find where name=($CommonName . ".pem") ];
|
||||
|
||||
:local CertNew [ / certificate find where common-name=$CommonName fingerprint!=$FingerPrint expires-after>3w ];
|
||||
:local CertNameNew [ / certificate get $CertNew name ];
|
||||
|
Reference in New Issue
Block a user