ha-asusrouter icon indicating copy to clipboard operation
ha-asusrouter copied to clipboard

[Bug] Config issues with XT8

Open Vaskivskyi opened this issue 2 years ago • 7 comments

Discussed in https://github.com/Vaskivskyi/ha-asusrouter/discussions/166

Originally posted by w0lf3h July 27, 2022 Hey there :)

Trying to get this integration setup with my XT8. First off, the config flow doesn't allow me to enter the SSL certificate path till after going through the config flow at least once. Then I have to go back to "configure" the integration to add it.

Then, when I do try adding the cert file, I get this error in the config flow.

Screenshot 2022-07-27 122651

I think I'm doing something wrong 😅 I assume it's probably path related, but I can't figure out how to fix it. I am supposed to be using the certificate exported from my admin panel within the router, right?

Thanks 😄

Vaskivskyi avatar Jul 30 '22 20:07 Vaskivskyi

Hey, @w0lf3h,

Thanks for your feedback! 👍🏻

It seems more like a bug, so I created an issue - this way I will not lose the info in the discussion section.

Did you try entering the absolute path for the certificate?

Vaskivskyi avatar Jul 30 '22 20:07 Vaskivskyi

I did try dropping it into /config/www/ and using the http://ip:port/local/filename path as well, and I just get a "CA certificate is missing" error. Either way, the config flow doesn't prompt to enter a certificate path when the integration is being setup, and you can't enter one till you "configure" to go through the flow a second time.

w0lf3h avatar Aug 01 '22 18:08 w0lf3h

You might try /home/homeassistant/.homeassistant/config/... to see if it works (or your own correct path to the HA directory).

A proper way of handling SSL certificates is in work

Vaskivskyi avatar Aug 01 '22 22:08 Vaskivskyi

Still getting the same errors. 2022-08-02 20:37:40 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry router.asus.com for asusrouter File "/config/custom_components/asusrouter/bridge.py", line 130, in async_get_connected_devices File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 731, in async_get_devices File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 585, in async_monitor_devices File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 296, in async_hook File "/usr/local/lib/python3.10/site-packages/asusrouter/asusrouter.py", line 291, in async_hook File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 114, in async_run_command File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 111, in async_run_command File "/usr/local/lib/python3.10/site-packages/asusrouter/connection.py", line 191, in async_request raise AsusRouter404() asusrouter.error.AsusRouter404: None File "/config/custom_components/asusrouter/__init__.py", line 40, in async_setup_entry File "/config/custom_components/asusrouter/router.py", line 371, in setup File "/config/custom_components/asusrouter/router.py", line 398, in update_devices File "/config/custom_components/asusrouter/bridge.py", line 132, in async_get_connected_devices 2022-08-02 20:37:52 ERROR (MainThread) [asusrouter.connection] CA certificate is missing

I tried both router.asus.com (port 8443), which is how I generally login to the router as well as the default IP address.

w0lf3h avatar Aug 03 '22 03:08 w0lf3h

Does your certificate file have proper permissions? It should belong to the homeassistant/homeassistant with 644 permissions, exactly the same way as configuration.yaml. Or your user name/group.

The only way certificate file is checked - by the pathlib using pathlib.Path(path_to_file).is_file()

You may check it directly. Just use this python code from the HA venv:

from pathlib import Path
path = Path("/home/homeassistant/.homeassistant/cert.crt") # <- CHANGE to your path
print("Yey!") if path.is_file() else print("Nope")

Vaskivskyi avatar Aug 04 '22 12:08 Vaskivskyi

Yeah looks like 644 permissions.

w0lf3h avatar Aug 04 '22 23:08 w0lf3h

644 is -rw-r--r--

Vaskivskyi avatar Aug 05 '22 05:08 Vaskivskyi

With the next release, the certification path and check is removed from AsusRouter, since it never worked too well with HA. Since the feature in the question is removed, I am closing the issue.

Vaskivskyi avatar Jan 21 '23 11:01 Vaskivskyi