Fix expiring ACME certs
This commit is contained in:
parent
c9cf5af6cd
commit
0c7577718d
1 changed files with 7 additions and 4 deletions
|
|
@ -45,11 +45,14 @@ impl<'a, C: CommandRunner> Symbol for AcmeCert<'a, C> {
|
|||
return Ok(false);
|
||||
}
|
||||
|
||||
let stdout = try!(self.command_runner.get_output("openssl", &["x509", "-in", &self.get_cert_path(), "-noout", "-subject", "-checkend", &(30*DAYS_IN_SECONDS).to_string()]));
|
||||
if stdout != format!("subject=CN = {}\nCertificate will not expire\n", self.domain).as_bytes() {
|
||||
return Ok(false);
|
||||
let output = try!(self.command_runner.run_with_args("openssl", &["x509", "-in", &self.get_cert_path(), "-noout", "-subject", "-checkend", &(30*DAYS_IN_SECONDS).to_string()]));
|
||||
if output.status.success() && output.stdout == format!("subject=CN = {}\nCertificate will not expire\n", self.domain).as_bytes() {
|
||||
Ok(self.command_runner.run_successfully("openssl", &["verify", "--untrusted", "/home/acme/lets_encrypt_x3_cross_signed.pem", &self.get_cert_path()]).is_ok())
|
||||
} else if output.status.code() == Some(1) && output.stdout == format!("subject=CN = {}\nCertificate will expire\n", self.domain).as_bytes() {
|
||||
Ok(false)
|
||||
} else {
|
||||
Err(try!(String::from_utf8(output.stderr)).into())
|
||||
}
|
||||
Ok(self.command_runner.run_successfully("openssl", &["verify", "--untrusted", "/home/acme/lets_encrypt_x3_cross_signed.pem", &self.get_cert_path()]).is_ok())
|
||||
}
|
||||
|
||||
fn execute(&self) -> Result<(), Box<Error>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue