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

Retrying setup: OpenWrt communication error: #6

Open
yousaf465 opened this issue Aug 2, 2022 · 8 comments
Open

Retrying setup: OpenWrt communication error: #6

yousaf465 opened this issue Aug 2, 2022 · 8 comments

Comments

@yousaf465
Copy link

I followed the tutorial, but I can't understand this line, where, and how to do it.

Change password: passwd hass

Is default password "hass"
https://github.com/kvj/hass_openwrt#ubus-configuration

@kvj
Copy link
Owner

kvj commented Aug 2, 2022

Nope.
The command passwd hass changes a password of user hass. There's no default password (if you manually add lines to the /etc/passwd)

@kvj
Copy link
Owner

kvj commented Aug 2, 2022

and answering your question, passwd hass is a shell command. So you execute it from the command line

@yousaf465
Copy link
Author

Nope. The command passwd hass changes a password of user hass. There's no default password (if you manually add lines to the /etc/passwd)

I added those line via Winscp.

@yousaf465
Copy link
Author

and answering your question, passwd hass is a shell command. So you execute it from the command line

so to set topsecertpassword I have to issue following command from ssh

passwd hass topsecertpasswor

@yousaf465
Copy link
Author

I ran the command as following

root@OpenWrt:~# passwd hass
Changing password for hass
New password:
Retype password:
passwd: password for hass changed by root
root@OpenWrt:~#

and used the following configuration
image
but
image

@yousaf465
Copy link
Author

yousaf465 commented Aug 5, 2022

The issue seems to be the SSL certificate, how to fix that? On chrome I download the certificate and followed the official method mentioned in OpenWrt wiki, but how to get that certificate for HA?

This error originated from a custom integration.

Logger: custom_components.openwrt.coordinator
Source: custom_components/openwrt/ubus.py:93
Integration: OpenWrt (documentation, issues)
First occurred: 10:24:08 PM (10 occurrences)
Last logged: 10:33:24 PM

Device [OpenWrt] async_update_data error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "/usr/local/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.11.1', port=443): Max retries exceeded with url: /ubus (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/openwrt/ubus.py", line 90, in _api_call
    response = await self.executor_job(post)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/openwrt/ubus.py", line 84, in post
    return requests.post(
  File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 723, in send
    history = [resp for resp in gen]
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 723, in <listcomp>
    history = [resp for resp in gen]
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 266, in resolve_redirects
    resp = self.send(
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 563, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.11.1', port=443): Max retries exceeded with url: /ubus (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)')))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/openwrt/coordinator.py", line 243, in async_update_data
    self._apis = await self.load_ubus()
  File "/config/custom_components/openwrt/coordinator.py", line 232, in load_ubus
    return await self._ubus.api_call("*", None, None, "list")
  File "/config/custom_components/openwrt/ubus.py", line 44, in api_call
    await self._login()
  File "/config/custom_components/openwrt/ubus.py", line 48, in _login
    result = await self._api_call(
  File "/config/custom_components/openwrt/ubus.py", line 93, in _api_call
    raise ConnectionError from err
ConnectionError

@kvj
Copy link
Owner

kvj commented Aug 19, 2022

I can skip the certificate validation step probably, but out of curiosity, why do you need ssl/https with self-signed certificates in your setups?

@yousaf465
Copy link
Author

I can skip the certificate validation step probably, but out of curiosity, why do you need ssl/https with self-signed certificates in your setups?

it was recommended for remote access of LUCI.

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

2 participants