nbuchwitz / check_ssllabs

Icinga check command for SSLLabs score
GNU General Public License v2.0
8 stars 3 forks source link

KeyError 'grade' #1

Open MrSingingClub opened 2 years ago

MrSingingClub commented 2 years ago

Hi, thank you for providing this nice check, it is exactly what I was looking for. However, when I try to execute the program I get the following error:

Traceback (most recent call last): File "./check_ssllabs.py", line 192, in <module> ssllabs.check() File "./check_ssllabs.py", line 132, in check if self.is_worse(worst_grade, endpoint['grade']): KeyError: 'grade'

I guess that "grade" is not initialized but I am not very familiar with python. I tried parameters according to your examples. No matter, with or without -w/-c the error remains the same. My installation is on ubuntu server 20.04.3 LTS. I also had to python3 instead of python, maybe this is connected? Thanks for your help.

MrSingingClub commented 2 years ago

By poking in the code I found out that, when the test is not yet done, there is no key 'grade'. In my case the server is unreachable for IPv6. { "ipAddress": "2001:..........:9d49", "statusMessage": "Unable to connect to the server", "statusDetails": "TESTING_PROTO_2_0", "statusDetailsMessage": "Testing SSL 2.0", "progress": -1, "duration": 15019, "eta": -1, "delegation": 1 }

The IP4 test results in: { "ipAddress": "94.........109", "serverName": "i5E86386D.versanet.de", "statusMessage": "Ready", "grade": "A+", "gradeTrustIgnored": "A+", "hasWarnings": false, "isExceptional": true, "progress": 100, "duration": 63494, "eta": 163, "delegation": 1 }

my hack is to check if statusMessage is "Ready". As first step in the for loop where endpoints are checked: if endpoint['statusMessage'] != "Ready": continue It appears to work.

                                                                                                                                                            `