From 8b2407ed4b3be6ef0baf6acd5ff3f01a0879ef9e Mon Sep 17 00:00:00 2001 From: Solene Rapenne Date: Sun, 21 Oct 2018 21:39:30 +0200 Subject: [PATCH] Add an option for using starttls to probe ssl-expiration Original code from Denis Fondras --- probes.lisp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/probes.lisp b/probes.lisp index edb2a85..d1a0a21 100644 --- a/probes.lisp +++ b/probes.lisp @@ -53,10 +53,10 @@ (defun system-load(time) (read-from-string - (let ((command (concatenate 'string - "uptime | awk '{ print $(NF-" - (princ-to-string time) - ") }'"))) + (let ((command (strcat + "uptime | awk '{ print $(NF-" + (princ-to-string time) + ") }'"))) (uiop:run-program command :output :string)))) (create-probe @@ -124,11 +124,13 @@ (create-probe ssl-expiration (command-return-code - (concatenate 'string - "echo | openssl s_client -showcerts -servername " - (getf params :host) " -connect " - (getf params :host) ":" (princ-to-string - (getf params :port 443)) - " 2>/dev/null | openssl x509 -inform pem -noout -checkend " - (princ-to-string - (getf params :seconds))))) + (let ((host (getf params :host)) + (port (princ-to-string (getf params :port 443))) + (seconds (princ-to-string (getf params :seconds))) + (starttls (getf params :starttls))) + (strcat + "echo | openssl s_client -showcerts -servername " host + " -connect " host ":" port " 2>/dev/null |" + "openssl x509 -inform pem -noout " + (when starttls (strcat " -starttls " starttls)) + " -checkend " seconds))))