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

does not work this is the response I get #119

Open
trentjw opened this issue Aug 13, 2020 · 8 comments
Open

does not work this is the response I get #119

trentjw opened this issue Aug 13, 2020 · 8 comments

Comments

@trentjw
Copy link

trentjw commented Aug 13, 2020

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 453, in wrap_socket
cnx.do_handshake()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1915, in do_handsha ke
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl _error
_raise_current_error()
File "/usr/lib/python3/dist-packages/OpenSSL/util.py", line 54, in exception from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl_choose_client_version', 'unsupported p rotocol')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 344, in conn ect
ssl_context=context)
File "/usr/lib/python3/dist-packages/urllib3/util/ssl
.py", line 344, in ssl_w rap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 459, in wrap_socket
raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'ssl_choose_client_versio n', 'unsupported protocol')])",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
**response_kw)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
**response_kw)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
**response_kw)
[Previous line repeated 2 more times]
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in incr ement
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='aic.lgthinq.com', po rt=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError( SSLError("bad handshake: Error([('SSL routines', 'ssl_choose_client_version', 'u nsupported protocol')])")))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "example.py", line 296, in
main()
File "example.py", line 292, in main
example(args.country, args.language, args.verbose, args.cmd, args.args)
File "example.py", line 233, in example
example_command(client, cmd, args)
File "example.py", line 202, in example_command
func(client, *args)
File "example.py", line 33, in ls
for device in client.devices:
File "/home/pi/wideq/wideq/client.py", line 126, in devices
self._devices = self.session.get_devices()
File "/home/pi/wideq/wideq/client.py", line 117, in session
self._session, self._devices = self.auth.start_session()
File "/home/pi/wideq/wideq/core.py", line 362, in start_session
self.gateway.country, self.gateway.language)
File "/home/pi/wideq/wideq/core.py", line 258, in login
return lgedm_post(url, data)
File "/home/pi/wideq/wideq/core.py", line 202, in lgedm_post
res = session.post(url, json={DATA_ROOT: data}, headers=headers)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in reque st
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='aic.lgthinq.com', port=4 6030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLE rror("bad handshake: Error([('SSL routines', 'ssl_choose_client_version', 'unsup ported protocol')])")))

@cinadr
Copy link

cinadr commented Aug 13, 2020

Same here:

Log in here:
https://hu.m.lgaccount.com/login/sign_in?country=HU&language=hu-HU&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password
Then paste the URL where the browser is redirected:
https://hu.m.lgaccount.com/login/iabClose?access_token=XXXXXXXXXXXXXXXXXXXXXXXX&refresh_token=XXXXXXXXXXXXXXXXXXXXXXXXXX&oauth2_backend_url=https://gb.lgeapi.com/
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 344, in connect
    ssl_context=context)
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 344, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 853, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
    **response_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
    **response_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
    **response_kw)
  [Previous line repeated 2 more times]
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='eic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/example.py", line 296, in <module>
    main()
  File "/usr/local/bin/example.py", line 292, in main
    example(args.country, args.language, args.verbose, args.cmd, args.args)
  File "/usr/local/bin/example.py", line 233, in example
    example_command(client, cmd, args)
  File "/usr/local/bin/example.py", line 202, in example_command
    func(client, *args)
  File "/usr/local/bin/example.py", line 33, in ls
    for device in client.devices:
  File "/usr/local/lib/python3.7/dist-packages/wideq/client.py", line 126, in devices
    self._devices = self.session.get_devices()
  File "/usr/local/lib/python3.7/dist-packages/wideq/client.py", line 117, in session
    self._session, self._devices = self.auth.start_session()
  File "/usr/local/lib/python3.7/dist-packages/wideq/core.py", line 362, in start_session
    self.gateway.country, self.gateway.language)
  File "/usr/local/lib/python3.7/dist-packages/wideq/core.py", line 258, in login
    return lgedm_post(url, data)
  File "/usr/local/lib/python3.7/dist-packages/wideq/core.py", line 202, in lgedm_post
    res = session.post(url, json={DATA_ROOT: data}, headers=headers)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='eic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)')))

@cinadr
Copy link

cinadr commented Aug 13, 2020

I've got this relevant:

https://askubuntu.com/a/1263098

@alpe12
Copy link

alpe12 commented Aug 15, 2020

Same.

@pifou25
Copy link
Contributor

pifou25 commented Aug 28, 2020

Hi,
same error than this issue #104 and I proposed a workaround, by fixing TLS version

I had several SSL errors, this one and also another ( DH key too small ) on debian 10 buster, seems related to this OS. I added this proc to fix the TLS version and other SSL context:
https://gist.github.com/pifou25/dff5f64979d4d07bd1a05c310e35c792

Do you use Raspbian or Debian Buster too ?

@sliwkacz
Copy link

@pifou25 what should be done with the code you've shared?

@trentjw
Copy link
Author

trentjw commented Sep 8, 2020

so this is just a garbage add in then?

@Flip76
Copy link

Flip76 commented Sep 10, 2020

You can try to edit your openssl.cnf (on debian usually it is /etc/ssl/openssl.cnf). Search for:

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2

Replace
CipherString = DEFAULT@SECLEVEL=2

by
CipherString = DEFAULT@SECLEVEL=1

But please be in mind that this might be a security risk...

@swamplynx
Copy link

I've tried changing the min TLS and Cipher levels, but still get the same error too. I think node has its own TLS minimums, but not sure how to work around them.

MinProtocol = TLSv1.0
CipherString = DEFAULT@SECLEVEL=1

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

7 participants