diff --git a/eccs2.py b/eccs2.py index 9cf16cca247898d21c9dbe0058d83dfafb2d2b09..bad77970f61f0af953e2f3208b7552f33cbdefbf 100755 --- a/eccs2.py +++ b/eccs2.py @@ -31,7 +31,7 @@ def getIDPfqdn(samlrequest_url): # This function checks if an IdP recognized the SP by presenting its Login page with "username" and "password" fields. # It is possible to disable the check on eccs2properties with the *denylist or by "robots.txt" file into the SAMLRequest endpoint root web dir. -# If the IdP Login page contains "username" and "password" fields, than the test is passed. +# If the IdP Login page contains "username" and "password" fields the test is passed. def checkIdP(sp,idp,test): # Disable SSL requests warning messages @@ -121,7 +121,7 @@ def checkIdP(sp,idp,test): if (robots == ""): robots = requests.get("http://%s/robots.txt" % fqdn_idp, headers=headers, verify=True, timeout=ECCS2REQUESTSTIMEOUT) - # Catch only SSL Exception. Don't block the ECCS check if other exceptions occurred + # Catch SSL Exceptions and block the ECCS check except (requests.exceptions.SSLError) as e: check_time = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S') + 'Z' @@ -133,7 +133,7 @@ def checkIdP(sp,idp,test): return (idp['entityID'],wayfless_url,check_time,"(failed)","SSL-Error") - # Pass every other exceptions on /robots.txt file. I consider only SSLError. + # Pass every other exceptions on /robots.txt file. Consider only SSL Exceptions. except Exception as e: #print("IdP '%s' HAD HAD A REQUEST ERROR: %s" % (fqdn_idp,e.__str__())) robots = "" @@ -169,33 +169,33 @@ def checkIdP(sp,idp,test): except requests.exceptions.ConnectionError as e: print ("http-code: (failed) - ConnectionError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) - #print("!!! REQUESTS STATUS CODE CONNECTION ERROR EXCEPTION !!!") + #print("!!! REQUESTS HTTP CODE CONNECTION ERROR EXCEPTION !!!") #print (e.__str__()) http_code = "(failed)" except requests.exceptions.Timeout as e: - print ("http-code: 111 - TimeoutError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) - #print("!!! REQUESTS STATUS CODE TIMEOUT EXCEPTION !!!") + print ("http-code: (failed) - TimeoutError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) + #print("!!! REQUESTS HTTP CODE TIMEOUT EXCEPTION !!!") #print (e.__str__()) - http_code = "111" + http_code = "(failed)" except requests.exceptions.TooManyRedirects as e: - print ("http-code: 222 - TooManyRedirectsError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) - #print("!!! REQUESTS TOO MANY REDIRECTS EXCEPTION !!!") + print ("http-code: (failed) - TooManyRedirectsError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) + #print("!!! REQUESTS HTTP CODE TOO MANY REDIRECTS EXCEPTION !!!") #print (e.__str__()) - http_code = "222" + http_code = "(failed)" except requests.exceptions.RequestException as e: - print ("http-code: 333 - RequestException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) + print ("http-code: (failed) - RequestException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) #print ("!!! REQUESTS EXCEPTION !!!") print (e.__str__()) - http_code = "333" + http_code = "(failed)" except Exception as e: - print ("http-code: 555 - OtherException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) + print ("http-code: (failed) - OtherException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) #print ("!!! EXCEPTION REQUESTS !!!") print (e.__str__()) - http_code = "555" + http_code = "(failed)" if(metadata_not_found): return (idp['entityID'],wayfless_url,check_time,http_code,"No-eduGAIN-Metadata") @@ -230,7 +230,7 @@ def storeECCS2result(idp,check_results,idp_status,test): if (test is not True): # IdP-DisplayName;IdP-entityID;IdP-RegAuth;IdP-tech-ctc-1,IdP-tech-ctc-2;IdP-supp-ctc-1,IdP-supp-ctc-2;IdP-ECCS-Status;SP-wayfless-url-1;SP-check-time-1;SP-http-code-1;SP-result-1;SP-wayfless-url-2;SP-check-time-2;SP-http-code-2;SP-result-2 with open("%s/%s" % (ECCS2OUTPUTDIR,ECCS2RESULTSLOG), 'a') as f: - f.write('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"}}\n' % ( + f.write('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"}}\n' % ( getDisplayName(idp['displayname']), # IdP-DisplayName idp['entityID'], # IdP-entityID idp['registrationAuthority'], # IdP-RegAuth @@ -240,14 +240,14 @@ def storeECCS2result(idp,check_results,idp_status,test): check_results[0][1], # SP-wayfless-url-1 check_results[0][2], # SP-check-time-1 check_results[0][3], # SP-http-code-1 - check_results[0][4], # SP-result-1 + check_results[0][4], # SP-check-result-1 check_results[1][1], # SP-wayfless-url-2 check_results[1][2], # SP-check-time-2 check_results[1][3], # SP-http-code-2 - check_results[1][4])) # SP-result-2 + check_results[1][4])) # SP-check-result-2 else: print("\nECCS2:") - print('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"}}\n' % ( + print('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"}}\n' % ( getDisplayName(idp['displayname']), # IdP-DisplayName idp['entityID'], # IdP-entityID idp['registrationAuthority'], # IdP-RegAuth @@ -257,11 +257,11 @@ def storeECCS2result(idp,check_results,idp_status,test): check_results[0][1], # SP-wayfless-url-1 check_results[0][2], # SP-check-time-1 check_results[0][3], # SP-http-code-1 - check_results[0][4], # SP-result-1 + check_results[0][4], # SP-check-result-1 check_results[1][1], # SP-wayfless-url-2 check_results[1][2], # SP-check-time-2 check_results[1][3], # SP-http-code-2 - check_results[1][4])) # SP-result-2 + check_results[1][4])) # SP-check-result-2 # Check an IdP with 2 SPs. diff --git a/web/eccs2.css b/web/eccs2.css index c5ecf078378e7fb9a31f45350fdf4ba5dd037f42..4bd96dfbd4f1ca86a5e0818d3cad842e4eaf7664 100644 --- a/web/eccs2.css +++ b/web/eccs2.css @@ -133,7 +133,6 @@ input[type=checkbox] { .tooltip .tooltiptext { visibility: hidden; position: absolute; - width: 300px; background-color: #555; color: #fff; text-align: center; @@ -141,7 +140,7 @@ input[type=checkbox] { border-radius: 6px; z-index: 1; opacity: 0; - transition: opacity 0.3s; + transition: opacity .6s; } .tooltip:hover .tooltiptext { @@ -149,66 +148,48 @@ input[type=checkbox] { opacity: 1; } -.tooltip-right { - top: -5px; - left: 125%; +.tooltip-top { + bottom: 125%; + left: 50%; } -.tooltip-right::after { +.tooltip-top::after { content: ""; position: absolute; - top: 50%; - right: 100%; - margin-top: -5px; + top: 100%; + left: 50%; + margin-left: -5px; border-width: 5px; border-style: solid; - border-color: transparent #555 transparent transparent; + border-color: #555 transparent transparent transparent; } -.tooltip-bottom { - top: 135%; - left: 50%; - margin-left: -60px; +.tooltip-ok { + width: 540px; + margin-left: -270px; } -.tooltip-bottom::after { - content: ""; - position: absolute; - bottom: 100%; - left: 50%; - margin-left: -5px; - border-width: 5px; - border-style: solid; - border-color: transparent transparent #555 transparent; +.tooltip-timeout { + width: 380px; + margin-left: -190px; } -.tooltip-top { - bottom: 125%; - left: 50%; - margin-left: -60px; +.tooltip-invalid-form { + width: 260px; + margin-left: -130px; } -.tooltip-top::after { - content: ""; - position: absolute; - top: 100%; - left: 50%; - margin-left: -5px; +.tooltip-no-edugain-metadata { + width: 400px; + margin-left: -200px; } -.tooltip-left { - top: auto; - bottom: -15px; - right: 128%; +.tooltip-ssl-error { + width: 280px; + margin-left: -140px; } -.tooltip-left::after { - content: ""; - position: absolute; - top: 50%; - left: 100%; - margin-top: -5px; - border-width: 5px; - border-style: solid; - border-color: transparent transparent transparent #555; +.tooltip-disabled { + width: 260px; + margin-left: -130px; } diff --git a/web/eccs2.js b/web/eccs2.js index a58ae59e08def4bd95c8d71ea15853e5f6067371..d47f65744428e2ae952add4920c8f66a26339e61 100644 --- a/web/eccs2.js +++ b/web/eccs2.js @@ -49,22 +49,22 @@ function getHostname(url) { function getCheckResult(checkResult){ if (checkResult == "OK"){ - return '<div class="tooltip">OK <span class="tooltiptext tooltip-top">The IdP is consuming correctly the eduGAIN metadata and return a valid login page</span></div>'; + return '<div class="tooltip">OK <span class="tooltiptext tooltip-top tooltip-ok">The IdP is consuming correctly the eduGAIN metadata and return a valid login page</span></div>'; } else if (checkResult == "Timeout"){ - return '<div class="tooltip">Timeout <span class="tooltiptext tooltip-top">The IdP does not load a valid login page within 60 seconds</span></div>' + return '<div class="tooltip">Timeout <span class="tooltiptext tooltip-top tooltip-timeout">The IdP does not load a valid login page within 60 seconds</span></div>' } else if (checkResult == "Invalid-Form"){ - return '<div class="tooltip">Invalid-Form <span class="tooltiptext tooltip-top">The IdP does not load a valid login page</span></div>' + return '<div class="tooltip">Invalid-Form <span class="tooltiptext tooltip-top tooltip-invalid-form">The IdP does not load a valid login page</span></div>' } else if (checkResult == "No-eduGAIN-Metadata"){ - return '<div class="tooltip">No-eduGAIN-Metadata <span class="tooltiptext tooltip-top">The IdP is not consuming correctly edugGAIN metadata stream</span></div>' + return '<div class="tooltip">No-eduGAIN-Metadata <span class="tooltiptext tooltip-top tooltip-no-edugain-metadata">The IdP is not consuming correctly edugGAIN metadata stream</span></div>' } else if (checkResult == "SSL-Error"){ - return '<div class="tooltip">SSL-Error <span class="tooltiptext tooltip-top">The IdP has a problem on its SSL certificate</span></div>' + return '<div class="tooltip">SSL-Error <span class="tooltiptext tooltip-top tooltip-ssl-error">The IdP has a problem on its SSL certificate</span></div>' } else if (checkResult == "DISABLED"){ - return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top">The check has been disabled for the IdP</span></div>' + return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top tooltip-disabled">The check has been disabled for the IdP</span></div>' } else{ return checkResult; @@ -87,7 +87,7 @@ function format ( d ) { '<td class="strong">Support Contacts:</td>'+ '<td>'+d.contacts.support+'</td>'+ '<td class="strong">Check Time</td>'+ - '<td class="strong">Result Check</td>'+ + '<td class="strong">Check Result</td>'+ '<td class="strong">HTTP Code</td>'+ '<td class="strong">Page Source</td>'+ '<td class="strong">Retry Check</td>'+ @@ -96,7 +96,7 @@ function format ( d ) { '<td class="strong">SP1:</td>'+ '<td>https://'+getHostname(d.sp1.wayflessUrl)+'</td>'+ '<td>'+d.sp1.checkTime+'</td>'+ - '<td>'+getCheckResult(d.sp1.result)+'</td>'+ + '<td>'+getCheckResult(d.sp1.checkResult)+'</td>'+ '<td>'+d.sp1.httpCode+'</td>'+ '<td><a href="/eccs2html/'+d.date+'/'+getHostname(d.entityID)+'---'+getHostname(d.sp1.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+ '<td><a href="'+d.sp1.wayflessUrl+'" target="_blank">Click to retry</a></td>'+ @@ -105,7 +105,7 @@ function format ( d ) { '<td class="strong">SP2:</td>'+ '<td>https://'+getHostname(d.sp2.wayflessUrl)+'</td>'+ '<td>'+d.sp2.checkTime+'</td>'+ - '<td>'+getCheckResult(d.sp2.result)+'</td>'+ + '<td>'+getCheckResult(d.sp2.checkResult)+'</td>'+ '<td>'+d.sp2.httpCode+'</td>'+ '<td><a href="/eccs2html/'+d.date+'/'+getHostname(d.entityID)+'---'+getHostname(d.sp2.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+ '<td><a href="'+d.sp2.wayflessUrl+'" target="_blank">Click to retry</a></td>'+