Add SKS keyserver monitor

This commit is contained in:
Klaus-Uwe Mitterer 2017-06-22 17:16:13 +02:00
parent af06c5af6f
commit f09cb30772
2 changed files with 24 additions and 0 deletions

12
skstools/__init__.py Normal file
View File

@ -0,0 +1,12 @@
import urllib.request, urllib.error
def getStatus(server):
try:
source = str(urllib.request.urlopen("https://sks-keyservers.net/status/ks-status.php?server=%s" % server).read())
if "No data found for keyserver" in source:
return False
if "Reason" in source:
return False
return True
except urllib.error.URLError:
return None

12
sksup.py Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/python3
import time, setuptools, skstools, twitools
def check(server, recipient, two = twitools.twObject()):
if skstools.getStatus(server) == False:
two.tweet("@%s Something seems to be wrong with the %s keyserver!" % (recipient, site))
if __name__ == "__main__":
servers = setuptools.getListSetting("SKS", "servers")
for s in servers:
check(s[0], s[1])