Software /
code /
prosody-modules
Changeset
943:a8203db13ca2
mod_checkcerts: Modify wording a bit.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 29 Mar 2013 15:16:00 +0100 |
parents | 942:4fdcb5c35021 |
children | 944:21e81fcb8896 |
files | mod_checkcerts/mod_checkcerts.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_checkcerts/mod_checkcerts.lua Thu Mar 28 08:22:06 2013 +0100 +++ b/mod_checkcerts/mod_checkcerts.lua Fri Mar 29 15:16:00 2013 +0100 @@ -41,18 +41,19 @@ -- This might be wrong if the certificate has NotBefore in the future. -- However this is unlikely to happen with CA-issued certs in the wild. + local notafter = cert.notafter and cert:notafter(); if not valid_at(cert, now) then module:log("error", "The certificate %s has expired", certfile); module:send(st.message({from=module.host,to=admin,type="chat"},("Certificate for host %s has expired!"):format(module.host))); elseif not valid_at(cert, now+86400*7) then - module:log("warn", "The certificate %s will expire this week", certfile); + module:log("warn", "The certificate %s will expire %s", certfile, notafter or "this week"); for _,admin in ipairs(module:get_option_array("admins", {})) do - module:send(st.message({from=module.host,to=admin,type="chat"},("Certificate for host %s is about to expire!"):format(module.host))); + module:send(st.message({from=module.host,to=admin,type="chat"},("Certificate for host %s will expire %s!"):format(module.host, notafter or "this week"))); end elseif not valid_at(cert, now+86400*30) then module:log("warn", "The certificate %s will expire later this month", certfile); else - module:log("info", "The certificate %s is valid until %s", certfile, cert.notafter and cert:notafter() or "later"); + module:log("info", "The certificate %s is valid until %s", certfile, notafter or "later"); end end end