loblab / noip-renew

Auto renew (confirm) noip.com free hosts
Apache License 2.0
435 stars 138 forks source link

Selenium/webdriver/chrome seems to be broken, possibly DNS or certificate-related #59

Closed Pajkastare closed 2 years ago

Pajkastare commented 3 years ago

I have been using this software for about a year, and it has worked fine. Until recently. I cloned the latest master and ran the setup script (including the "apt get" parts), so I know I have the latest version. First I got this error message: Message: unknown error: net::ERR_NAME_NOT_RESOLVED (Session info: headless chrome=88.0.4324.150)

Thinking it was DNS-related, I substituted LOGIN_URL = "https://www.noip.com/login" with LOGIN_URL = "https://8.23.224.107/login" in the python file, but even though there was no raised exception this time, it did not work: print(self.browser.page_source) (added for debugging reasons) resulted in <html><head></head><body></body></html>

I can't determine if it is the selenium package that is broken, if the selenium package has changed its syntax or default values and the noip-renew scripts have not been updated to match, or if the noip.com webpage has changed its coding. Or if it is DNS- and/or certificate-related. Something that could be the cause is if the headless browser could not verify the certificate of www.noip.com, but I don't know how to troubleshoot this. (The IP address URL gave me a certificate warning in a desktop Firefox session, since the certificate is only valid for the noip.com domain, and that could be the reason. So perhaps the root cause is DNS-related after all.)

Do others have the same problems? Any ideas?

(I have tried this on Ubuntu 20.04 and Ubuntu 20.10, both up-to-date to within a week or so, both running a local dnsmasq instance which works for all other DNS lookups. Python version 3.8.6 (20.10) or 3.8.5 (20.04). Selenium version (according to pip3 list) is 3.141.0 in both cases.)

Pajkastare commented 3 years ago

I could add that selenium/chrome is not completely broken, since I could get a non-empty browser.page_source output from a HTTP server (not HTTPS), when I entered an IP address. I could not access the same server using the DNS name. (Try http://neverssl.com/)

Pajkastare commented 2 years ago

A bit late to update this issue, but I solved the problem. It might have been selenium, it might have been chrome, but it was DNS-related and unrelated to the noip-renew code. Possibly certificate-related, but I could not reproduce that after getting DNS to work. So I'm closing this.

For future reference: The problem was caused by Chrome under Ubuntu, at least when installed as a snap instead of the older (pre-19.10) apt variant, as it did not access DNS the same way as my other installed programs do. Chrome tried to query port 53 (for DNS), but not on 127.0.0.1 (where I did have a local dnsmasq instance handling and caching DNS queries), it instead tried to access port 53 on 127.0.0.53 (which dnsmasq happily ignored, despite that that too should resolve to localhost).

The solution, or at least workaround, was to create this crontab job: @reboot root sleep 80; ip addr add 127.0.0.53 dev lo; sleep 10; systemctl restart dnsmasq

Pajkastare commented 2 years ago

Explanation in last comment