Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue during password receiving #63

Closed
freekode opened this issue Mar 11, 2021 · 12 comments
Closed

Issue during password receiving #63

freekode opened this issue Mar 11, 2021 · 12 comments

Comments

@freekode
Copy link
Collaborator

freekode commented Mar 11, 2021

I checked forums, people have problems when they try to get password for Roomba

(homeassistant) [user@localhost]/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy% roomba-password <ROOMBA IP>
Roomba have to be on Home Base powered on.
Press and hold HOME button until you hear series of tones.
Release button, Wi-Fi LED should be flashing
Press Enter to continue...
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant/bin/roomba-password", line 8, in <module>
    sys.exit(password())
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/entry_points.py", line 30, in password
    roomba_password = RoombaPassword(roomba_ip)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/getpassword.py", line 17, in __init__
    self.server_socket = _get_socket()
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/getpassword.py", line 76, in _get_socket
    ssl_socket = ssl.wrap_socket(
  File "/usr/local/lib/python3.8/ssl.py", line 1404, in wrap_socket
    context.set_ciphers(ciphers)
ssl.SSLError: ('No cipher can be selected.',)

Any idea what it means?

@pschmitt
Copy link
Owner

Hard to tell w/o more info. I've responded to the OP on the forums.

We'd need some more info from you to debug this:

  • Roomba firmware version
  • the exact command run
  • what environment are you using? HASS OS? Home Assistant container? Python & venv?
  • do you get a similar error when using dorita980 for example to retrieve your credentials?

https://community.home-assistant.io/t/error-attempting-to-add-roomba-integration/282897/5?u=pschmitt

@freekode
Copy link
Collaborator Author

According to documentation

If no cipher can be selected (because compile-time options or other configuration forbids use of all the specified ciphers), an SSLError will be raised.
Also guys from dorita980 added user selected cipher option here

I don't know how it works at al, just tried to get password with different ciphers:
ciphers="DEFAULT@SECLEVEL=1,AES128-SHA" - works
ciphers="DEFAULT:!DH" - works, actually we are using it in remote_client.py
ciphers="DEFAULT@SECLEVEL=3" - doesn't work

So I will respond on forum, and ask the guy to change this line.

@ngrusz1
Copy link

ngrusz1 commented Mar 13, 2021

Thanks so much for helping out with this! To answer the original questions:

  • Roomba firmware version: 3.10.8
  • The exact command was "roomba-password 192.168.2.174"
  • For my Home Assistant system, I am using python and a venv. I am using Python version 3.8. If I attempt to add the iRobot integration via the Integration control panel, it is able to automatically detect the IP address of the Roomba, but it fails to complete the setup with similar errors in the log.

Per the suggestion from @freekode, I tried changing the line referenced in getpassword.py. The following changes did not work and produced the same error as before:

ciphers="DEFAULT@SECLEVEL=1,AES128-SHA"
ciphers="DEFAULT@SECLEVEL=3"

The change below does work:

ciphers="DEFAULT:!DH"

It returns numerous specs regarding the Roomba, including the password. One note: the comment from @freekode lists the line number as 84, but in my getpassword.py file it was line 79.

I was also able to get the Home Assistant integration working as well (it required restarting the server; I guess it must cache the integrations after first load). But I assume a package update will reverse this change; what are the next steps?

@pschmitt
Copy link
Owner

Thanks for the update.
@freekode maybe we should try a bunch of ciphers instead of hardcoding a set.

@pschmitt
Copy link
Owner

@ngrusz1 What OS are you on btw?

@ngrusz1
Copy link

ngrusz1 commented Mar 13, 2021

@ngrusz1 What OS are you on btw?

CentOS Linux release 7.9.2009

@pschmitt
Copy link
Owner

CentOS Linux release 7.9.2009

I was expecting Fedora, but close enough.
The RH guys are always one step ahead in regard to security. I got bit by the RSA key depreciation (SSH) on Fedora recently ;)

Can you give #64 a try?

@ngrusz1
Copy link

ngrusz1 commented Mar 14, 2021

Can you give #64 a try?

I pulled the new entry_points.py and getpassword.py files from #64 and gave them a try. I'm getting the new error below, but I'm guessing this might be unrelated:

(homeassistant) [homeassistant@localhost roombapy]$ roomba-password 192.168.2.174
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant/bin/roomba-password", line 5, in <module>
    from roombapy.entry_points import password
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/entry_points.py", line 4, in <module>
    from roombapy import RoombaFactory
ImportError: cannot import name 'RoombaFactory' from 'roombapy' (/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/__init__.py)

I wonder if Home Assistant makes its own modifications to the roombapy module? I currently have version 1.6.2 of the roombapy module.

@pschmitt
Copy link
Owner

Yeah that's indeed unrelated. You'll need to grab the whole branch, cherry-picking a few files won't work.

Home Assistant uses verbatim roombapy. No patches applied.

@ngrusz1
Copy link

ngrusz1 commented Mar 14, 2021

Yeah that's indeed unrelated. You'll need to grab the whole branch, cherry-picking a few files won't work.

Home Assistant uses verbatim roombapy. No patches applied.

Wishful thinking on my part :)

I pulled the multi-cipher branch and copied it into my Home Assistant venv. Running roomba-password, roomba-connect, and roomba-discovery from the command line appears to work just fine now.

I ran into a problem when I restarted my Home Assistant instance, however. I get the following error in my log when HA attempts to fire up the integration upon restart:

Logger: homeassistant.config_entries
Source: components/roomba/__init__.py:35 
First occurred: 10:30:19 AM (1 occurrences) 
Last logged: 10:30:19 AM

Error setting up entry MyRoomba for roomba
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/config_entries.py", line 248, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/roomba/__init__.py", line 35, in async_setup_entry
    roomba = Roomba(
TypeError: __init__() got an unexpected keyword argument 'address'

HA isn't able to communicate with my Roomba using the configuration I previously created; not sure it this is expected or not. I will try to remove my Roomba and add it again.

UPDATE: I removed the integration in my HA config and attempted to re-add it; this did not work. The integration setup is able to find my Roomba via discovery, but it fails again when it attempts to automatically determine the password. The errors are below. The cipher error is back, although the specific errors are different. So it seems the changes work for the command line but not within HA?

Logger: aiohttp.server
Source: components/roomba/config_flow.py:202 
First occurred: 10:50:05 AM (2 occurrences) 
Last logged: 10:50:06 AM

Error handling request
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 129, in auth_middleware
    return await handler(request)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 150, in post
    return await super().post(request, flow_id)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 106, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 158, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 216, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/roomba/config_flow.py", line 202, in async_step_link
    RoombaPassword(self.host).get_password
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/getpassword.py", line 21, in __init__
    self.server_socket = _get_socket(ciphers=ciphers)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/getpassword.py", line 81, in _get_socket
    ssl_socket = ssl.wrap_socket(
  File "/usr/local/lib/python3.8/ssl.py", line 1404, in wrap_socket
    context.set_ciphers(ciphers)
ssl.SSLError: ('No cipher can be selected.',)

@ngrusz1
Copy link

ngrusz1 commented Apr 25, 2021

Just thought I'd check in and see if there were any updates (or if this fix had been committed) :)
I still get the config_flow error above when I attempt to add a Roomba via the Integrations control panel.

@Orhideous
Copy link
Collaborator

Closed by #228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants