I’m using the speed test platform to do a speed test, but it hasn’t worked in some time. It was initially working, but stopped. It seemed to be related to a speedtest-cli and secure connections bug, so I sat tight… But still not working.
Does anyone have this working at this point? If so, where to start troubleshooting this? My configuration.yaml entry…
Even if I use the interface to manually call the service, nothing happens. The errors in the logs are…
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/speedtestdotnet/__init__.py", line 73, in update
speed = speedtest.Speedtest()
File "/mnt/deps/lib/python3.7/site-packages/speedtest.py", line 1053, in __init__
self.get_config()
File "/mnt/deps/lib/python3.7/site-packages/speedtest.py", line 1085, in get_config
raise ConfigRetrievalError(e)
speedtest.ConfigRetrievalError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>
This is possibly due to Python 3.7 as it more restrictive on SSL verification than previous Python versions. Did you notice if your speedtest stopped working about the same time you upgraded to Python 3.7?
I was able to look up to see that the SSL certificate that is used by your OOKLA server was issued by an intermediate CA. It appears that Python is complaining it can not get the certificate of the intermediate CA…but when I run openssh (which I understand Python3.7 uses), it does not complain of any issues…so not sure why you’re getting the error
If you have access to openssl on the same machine running HA, run the following: openssl s_client -connect was.speedtest.sbcglobal.net:8080
I never use ssh as I have direct access to the shell of the FreeBSD Jail’s shell on my NAS box. Should I run some other variant of what you have there…?
That’s the example from the docs.
I can see the sensors in entities, but their state remains unknown. Service call speedtestdotnet.speedtest does nothing, not even a string in the log… :\
Gives an error about being “unable to get local issuer certificate”. Is there something specific you need from all the output? I can’t copy/paste from the shell since I access it from over the network remotely…
When I run $ openssl s_client -connect was.speedtest.sbcglobal.net:8080
I get:
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA
verify return:1
depth=0 C = US, ST = Michigan, L = Southfield, O = "AT&T Services, Inc.", OU = ecommerce, CN = dfw.speedtest.sbcglobal.net
verify return:1
This is what I would expect to see when everything is working properly.
However the error you are getting should show up here as well, and reveal which issuer is failing.
depth=1 C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA
verify error:num=20:unable to get local issuer certificate
Then it spits out a bunch more that I can’t figure how to copy/paste, but it looks like it prints a “chain” with “0” as “AT&T” and “1” as “Digicert” and then it prints out a certificate and the next line says “No client certificate CA names sent”… It just goes on like that, and ends with the error I mentioned.
I can’t remember exactly when I noticed it stop, but it was after a Home Assistant upgrade. I opened a ticket on GitHub at the time. Perhaps you can make sense of the back and forth here…
It appears the “Root” Certificate is either not installed or not being pointed to correctly on your system.
Do the following: $ openssl version -d
Should get something like: OPENSSLDIR: "/usr/lib/ssl"
You may not get that exact directory, but whatever directory it returns, go to it.
then $ cd certs
look for file DigiCert_Global_Root_CA.pem
If it is not there, then see if any other certificates are there. If there are several other certificates present, then this one is simply missing. If there are not any, then some installation scenario didn’t work out…
Mine returned /etc/ssl as the directory, but it only has one file… openssl.cnf There is no certs directory or anything else in it… I am running these commands from the shell of the jail if that makes a difference.
Odd thing is worked up to a point… Unless the certs got removed during an upgrade somehow?