|
|
|
@ -37,6 +37,8 @@ def monitor_DomainExpiry(targets):
|
|
|
|
|
try:
|
|
|
|
|
if expire_year - current_year <= 1:
|
|
|
|
|
responseTable[domain] = "Domain expiring in < 1 year, please rectify."
|
|
|
|
|
else:
|
|
|
|
|
responseTable[domain] = "Domain is healthy."
|
|
|
|
|
except:
|
|
|
|
|
responseTable[domain] = "Failed to query domain info"
|
|
|
|
|
|
|
|
|
@ -54,6 +56,8 @@ def monitor_TlsExpiry(targets):
|
|
|
|
|
try:
|
|
|
|
|
if expiration - current_year <= 1:
|
|
|
|
|
responseTable[site] = "TLS expiring in < 30 days, please rectify."
|
|
|
|
|
else:
|
|
|
|
|
responseTable[site] = "cert is healthy."
|
|
|
|
|
except:
|
|
|
|
|
responseTable[site] = "Failed to query cert info"
|
|
|
|
|
|
|
|
|
@ -81,11 +85,8 @@ while is_on:
|
|
|
|
|
# write new results to file
|
|
|
|
|
file = open("/shared/results.json", "a+")
|
|
|
|
|
file.write(json_string)
|
|
|
|
|
file.write("\n")
|
|
|
|
|
file.write(cert_json)
|
|
|
|
|
file.write("\n")
|
|
|
|
|
file.write(domain_json)
|
|
|
|
|
file.write("\n")
|
|
|
|
|
file.close()
|
|
|
|
|
|
|
|
|
|
# track state
|
|
|
|
@ -93,7 +94,7 @@ while is_on:
|
|
|
|
|
stateFile = open("/shared/state.log", "r")
|
|
|
|
|
|
|
|
|
|
oldData = stateFile.read()
|
|
|
|
|
if oldData != json_string:
|
|
|
|
|
if oldData != file.read():
|
|
|
|
|
stateChanged = True
|
|
|
|
|
else:
|
|
|
|
|
stateChanged = False
|
|
|
|
|