Commit dd9e60fb authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

portsopen.py: Take list of ports per host to test

sslexpiry.py: Handle unreachable port
parent 79ac25dd
......@@ -7,7 +7,8 @@ retry = int(setuptools.getSetting("Ports", "retry"))
two = twitools.twObject()
for h in hosts:
if not porttools.isPortOpen(h[0], h[1]):
time.sleep(retry)
if not porttools.isPortOpen(h[0], h[1]):
two.tweet("@%s Port %s is not open on host %s!" % (h[2], h[1], h[0]))
for p in h[1]:
if not porttools.isPortOpen(h[0], p):
time.sleep(retry)
if not porttools.isPortOpen(h[0], p):
two.tweet("@%s Port %s is not open on host %s!" % (h[2], p, h[0]))
......@@ -8,10 +8,13 @@ pafter = int(setuptools.getSetting("SSL", "pafter"))
two = twitools.twObject()
for h in hosts:
expiry = ssltools.getRemoteExpiry(h[0], h[1])
diff = expiry - datetime.datetime.now()
if diff < datetime.timedelta(days=pbefore):
if expiry > datetime.datetime.now():
two.tweet("@%s %s certificate expiring soon (%s). Please renew." % (h[2], h[0], expiry))
elif expiry + datetime.timedelta(days=pafter) < datetime.datetime.now():
two.tweet("@%s %s certificate has expired! (%s) Please renew ASAP!" % (h[2], h[0], expiry))
try:
expiry = ssltools.getRemoteExpiry(h[0], h[1])
diff = expiry - datetime.datetime.now()
if diff < datetime.timedelta(days=pbefore):
if expiry > datetime.datetime.now():
two.tweet("@%s %s certificate expiring soon (%s). Please renew." % (h[2], h[0], expiry))
elif expiry + datetime.timedelta(days=pafter) < datetime.datetime.now():
two.tweet("@%s %s certificate has expired! (%s) Please renew ASAP!" % (h[2], h[0], expiry))
except:
two.tweet("@%s Could not verify SSL certificate on %s:%i. Is the server down?" % (h[2], h[0], h[1]))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment