Apollon77 / ioBroker.tuya

ioBroker adapter to connect to several small and cheap Wifi devices that care connected to the Tuya Cloud and mostly use the Smartlife App/Alexa-Skill
MIT License
89 stars 23 forks source link

3.5.9 - ssl-proxy error #266

Closed Ilovegym66 closed 3 years ago

Ilovegym66 commented 3 years ago

Hi, I need to add a device, and I can't.. I've done this a lot of times with different smartphones and I'm sure it's not on my site.. :-) I tested it with different ports, same results. Here the debug, if I start the smartlife-app at my phone:

2021-03-30 20:00:17.657  - debug: tuya.0 (17662) bf72e9be420184d658hjd0: Ignore invalid data (Counter: 1)
2021-03-30 20:00:17.881  - debug: tuya.0 (17662) Message: {"command":"startProxy","message":{"proxyPort":"9900","proxyWebPort":"9910"},"from":"system.adapter.admin.0","callback":{"message":{"proxyPort":"9900","proxyWebPort":"9910"},"id":564,"ack":false,"time":1617127217880},"_id":67239623}
2021-03-30 20:00:17.882  - debug: tuya.0 (17662) Use first network interface (192.168.3.41)
2021-03-30 20:00:17.902  - info: tuya.0 (17662) SSL-Proxy ready to receive requests
2021-03-30 20:00:18.000  - debug: tuya.0 (17662) sendTo "startProxy" to system.adapter.admin.0 from system.adapter.tuya.0
2021-03-30 20:00:18.015  - debug: tuya.0 (17662) Message: {"command":"getProxyResult","message":null,"from":"system.adapter.admin.0","callback":{"message":null,"id":565,"ack":false,"time":1617127218014},"_id":67239624}
2021-03-30 20:00:18.335  - debug: tuya.0 (17662) Discovered encrypted device and store for later usage: 192.168.10.101:51495 - 000055aa0000000000000013000000ac00000000d09766676f3369eb10b5e9f132fd802a187a5fca73e78641aed6a9cfcabdf979b2fb90f60aae90b22c4c753baa4164d6398597ec5bb8af92ee0e075d0518f6c959bd59981c26d5958da187e096d937c840b1058c6d8cd9456f3f7e28eed4932b65c32d54ce82e7eb61c1b4c4b88fa42161a7470698fe1a2278f97348cebb2f2c0778a28846bfb37c30583fd8f2ff0c6bc4af53957785522538893f064f9d9db4988b15b00000aa55
2021-03-30 20:00:18.500  - debug: tuya.0 (17662) Discovered encrypted device and store for later usage: 192.168.2.205:53002 - 000055aa00000000000000130000009c0000000097b93fee4b69c95feeb3d33bda3529527c0cadf2abbb0333bf470ca22cc1805a8e669f4020b826578888d520210f30d59a8e86c1c6ce4fcb99957e2b3bae5ae07256f992ef0bb3c9946f6ca8e2e148532e0dbc9a92c3317286ebf238be579786f8fa11265208cabf284e595c47eccee84a9f88fc7add57f1e8b8ca569d54a70e7a23e3b2249f5adf48a714f851aaf4397465d30f0000aa55
2021-03-30 20:00:55.773  - debug: tuya.0 (17662) Message: {"command":"getDeviceInfo","message":null,"from":"system.adapter.admin.0","callback":{"message":null,"id":566,"ack":false,"time":1617127255771},"_id":67239625}
2021-03-30 20:00:55.775  - debug: tuya.0 (17662) sendTo "getDeviceInfo" to system.adapter.admin.0 from system.adapter.tuya.0
2021-03-30 20:01:32.612  - error: tuya.0 (17662) SSL-Proxy ERROR: Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:32.613  - error: tuya.0 (17662) Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:33.714  - error: tuya.0 (17662) SSL-Proxy ERROR: Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:33.714  - error: tuya.0 (17662) Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:42.539  - error: tuya.0 (17662) SSL-Proxy ERROR: Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:42.540  - error: tuya.0 (17662) Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:44.668  - error: tuya.0 (17662) SSL-Proxy ERROR: Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
2021-03-30 20:01:44.669  - error: tuya.0 (17662) Error: 139965957486464:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46
Apollon77 commented 3 years ago

This error happends when the Proxy Certificate is not correctly setup or enabled OR a wron App version is used

Ilovegym66 commented 3 years ago

app verion 3.12.6, proxy.. here I found this fault: `

smartmeter.0 2021-03-30 23:48:35.660 info (23635) Received 7 values, 3 updated
tuya.0 2021-03-30 23:48:35.556 info (3875) Listen for encrypted local Tuya devices on port 6667
tuya.0 2021-03-30 23:48:35.556 info (3875) Listen for local Tuya devices on port 6666
tuya.0 2021-03-30 23:48:35.553 info (3875) Existing devices initialized
tuya.0 2021-03-30 23:48:35.552 info (3875) 037071752462ab4bdced Init with IP=192.168.7.28, Key=8e99c65cc9094f9a, Version=3.3
tuya.0 2021-03-30 23:48:35.543 info (3875) 0020097260019455f173 Init with IP=192.168.7.27, Key=292937b7be903f69, Version=3.1
tuya.0 2021-03-30 23:48:35.542 info (3875) 05047501d8f15be05792 Init with IP=192.168.7.31, Key=582f11ae9a89ef76, Version=3.3
tuya.0 2021-03-30 23:48:35.535 info (3875) 80270017bcddc2379ee4 Init with IP=192.168.2.203, Key=4caf51baf99c2b4e, Version=3.3
tuya.0 2021-03-30 23:48:35.521 info (3875) 012002512c3ae844f84b Init with IP=192.168.2.204, Key=fa40afabd793ba3b, Version=3.1
tuya.0 2021-03-30 23:48:35.520 info (3875) bf72e9be420184d658hjd0 Init with IP=192.168.10.101, Key=011fad449177a791, Version=3.3
tuya.0 2021-03-30 23:48:35.517 info (3875) 184558222462ab5366ef Init with IP=192.168.7.23, Key=f1c8377151a9d793, Version=3.3
tuya.0 2021-03-30 23:48:34.716 info (3875) starting. Version 3.5.9 in /opt/iobroker/node_modules/iobroker.tuya, node: v14.16.0, js-controller: 3.2.16
tuya.0 2021-03-30 23:48:28.582 info (54877) Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason
tuya.0 2021-03-30 23:48:28.579 info (54877) terminating
tuya.0 2021-03-30 23:48:25.569 info (54877) Got terminate signal TERMINATE_YOURSELF
tuya.0 2021-03-30 23:48:06.148 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
tuya.0 2021-03-30 23:48:06.148 error (54877) Error: connect ECONNREFUSED 192.168.3.41:8801
tuya.0 2021-03-30 23:48:06.146 error (54877) SSL-Proxy ERROR: Error: connect ECONNREFUSED 192.168.3.41:8801
tuya.0 2021-03-30 23:47:32.586 error at processTicksAndRejections (internal/process/task_queues.js:75:11)
tuya.0 2021-03-30 23:47:32.586 error at net.js:1009:9
tuya.0 2021-03-30 23:47:32.586 error at defaultTriggerAsyncIdScope (internal/async_hooks.js:430:12)
tuya.0 2021-03-30 23:47:32.586 error at internalConnect (net.js:921:16)
tuya.0 2021-03-30 23:47:32.586 error (54877) Error: connect EADDRNOTAVAIL 192.168.3.41:8801 - Local (192.168.3.41:0)
tuya.0 2021-03-30 23:47:32.583 error (54877) SSL-Proxy ERROR: Error: connect EADDRNOTAVAIL 192.168.3.41:8801 - Local (192.168.3.41:0)
tuya.0 2021-03-30 23:45:18.924 error at processTicksAndRejections (internal/process/task_queues.js:75:11)
tuya.0 2021-03-30 23:45:18.924 error at net.js:1009:9
tuya.0 2021-03-30 23:45:18.924 error at defaultTriggerAsyncIdScope (internal/async_hooks.js:430:12)
tuya.0 2021-03-30 23:45:18.924 error at internalConnect (net.js:921:16)
tuya.0 2021-03-30 23:45:18.924 error (54877) Error: connect EADDRNOTAVAIL 192.168.3.41:8801 - Local (192.168.3.41:0)
tuya.0 2021-03-30 23:45:18.923 error (54877) SSL-Proxy ERROR: Error: connect EADDRNOTAVAIL 192.168.3.41:8801 - Local (192.168.3.41:0)
tuya.0 2021-03-30 23:43:58.404 info (54877) SSL-Proxy ready to receive requests
tuya.0 2021-03-30 23:43:55.602 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
tuya.0 2021-03-30 23:43:55.602 error (54877) Error: connect ECONNREFUSED 192.168.3.41:8801
tuya.0 2021-03-30 23:43:55.598 error (54877) SSL-Proxy ERROR: Error: connect ECONNREFUSED 192.168.3.41:8801
tuya.0 2021-03-30 23:42:35.184 info (54877) SSL-Proxy ready to receive requests
tuya.0 2021-03-30 23:42:31.316 error at TCP. (net.js:673:12)
tuya.0 2021-03-30 23:42:31.316 error at Socket.EventEmitter.emit (domain.js:467:12)
tuya.0 2021-03-30 23:42:31.316 error at Socket.emit (events.js:327:22)
tuya.0 2021-03-30 23:42:31.316 error at Socket.socketCloseListener (_http_client.js:443:25)
tuya.0 2021-03-30 23:42:31.316 error at connResetException (internal/errors.js:607:14)
tuya.0 2021-03-30 23:42:31.316 error (54877) Error: socket hang up
tuya.0 2021-03-30 23:42:31.310 error (54877) SSL-Proxy ERROR: Error: socket hang up
tuya.0 2021-03-30 23:42:26.249 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
tuya.0 2021-03-30 23:42:26.249 error (54877) Error: connect ECONNRESET 192.168.3.41:8801
tuya.0 2021-03-30 23:42:26.246 error (54877) SSL-Proxy ERROR: Error: connect ECONNRESET 192.168.3.41:8801
tuya.0 2021-03-30 23:41:49.077 info (54877) SSL-Proxy ready to receive requests
tuya.0 2021-03-30 23:39:16.535 info (54877) Listen for encrypted local Tuya devices on port 6667
tuya.0 2021-03-30 23:39:16.535 info (54877) Listen for local Tuya devices on port 6666
tuya.0 2021-03-30 23:39:16.527 info (54877) Existing devices initialized
tuya.0 2021-03-30 23:39:16.526 info (54877) 80270017bcddc2379ee4 Init with IP=192.168.2.203, Key=4caf51baf99c2b4e, Version=3.3
tuya.0 2021-03-30 23:39:16.519 info (54877) 012002512c3ae844f84b Init with IP=192.168.2.204, Key=fa40afabd793ba3b, Version=3.1
tuya.0 2021-03-30 23:39:16.518 info (54877) bf72e9be420184d658hjd0 Init with IP=192.168.10.101, Key=011fad449177a791, Version=3.3
tuya.0 2021-03-30 23:39:16.500 info (54877) 037071752462ab4bdced Init with IP=192.168.7.28, Key=8e99c65cc9094f9a, Version=3.3
tuya.0 2021-03-30 23:39:16.497 info (54877) 184558222462ab5366ef Init with IP=192.168.7.23, Key=f1c8377151a9d793, Version=3.3
tuya.0 2021-03-30 23:39:16.487 info (54877) 0020097260019455f173 Init with IP=192.168.7.27, Key=292937b7be903f69, Version=3.1
tuya.0 2021-03-30 23:39:16.480 info (54877) 05047501d8f15be05792 Init with IP=192.168.7.31, Key=582f11ae9a89ef76, Version=3.3
tuya.0 2021-03-30 23:39:15.815 info (54877) starting. Version 3.5.9 in /opt/iobroker/node_modules/iobroker.tuya, node: v14.16.0, js-controller: 3.2.16
tuya.0 2021-03-30 23:39:09.724 info (39492) Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason
tuya.0 2021-03-30 23:39:09.721 info (39492) terminating
tuya.0 2021-03-30 23:39:06.711 info (39492) Got terminate signal TERMINATE_YOURSELF
tuya.0 2021-03-30 23:38:47.331 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
tuya.0 2021-03-30 23:38:47.331 error (39492) Error: connect ECONNREFUSED 192.168.3.41:8888
tuya.0 2021-03-30 23:38:47.330 error (39492) SSL-Proxy ERROR: Error: connect ECONNREFUSED 192.168.3.41:8888
tuya.0 2021-03-30 23:38:46.314 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
tuya.0 2021-03-30 23:38:46.314 error (39492) Error: connect ECONNRESET 192.168.3.41:8888
tuya.0 2021-03-30 23:38:46.313 error (39492) SSL-Proxy ERROR: Error: connect ECONNRESET 192.168.3.41:8888
tuya.0 2021-03-30 23:37:43.581 error at processTicksAndRejections (internal/process/task_queues.js:75:11)
tuya.0 2021-03-30 23:37:43.581 error at net.js:1009:9
tuya.0 2021-03-30 23:37:43.581 error at defaultTriggerAsyncIdScope (internal/async_hooks.js:430:12)
tuya.0 2021-03-30 23:37:43.581 error at internalConnect (net.js:921:16)
tuya.0 2021-03-30 23:37:43.581 error (39492) Error: connect EADDRNOTAVAIL 192.168.3.41:8888 - Local (192.168.3.41:0)
tuya.0 2021-03-30 23:37:43.578 error (39492) SSL-Proxy ERROR: Error: connect EADDRNOTAVAIL 192.168.3.41:8888 - Local (192.168.3.41:0)
tuya.0 2021-03-30 23:36:20.050 info (39492) SSL-Proxy ready to receive requests

`

Apollon77 commented 3 years ago

what fault you mean? This log just states that the proxy gets some requests to hosts he can not connect to e.g. 192.168.3.41 on port 8888 or 8801

Ilovegym66 commented 3 years ago

that's the problem.. I tested other ports, and everytime the same.. in the past I use 8010 and 8012 and this works fine. Last test was in february, as I assigned the doorbell. Now I have a air purifier and it doesn t work any more. I test the hole night.. Mysterios is, that I can only download the certificate via qr-code, with http://iobroker-io:8012/ca.pem ( or other ports, but I see the download link after using the qr-code ) it dont work. I installed another instance on a second iobroker-slave, and the same effect was happened...

I'll reboot now the complete system... make tests yesterday in the late night.. hopefully its a fault on my system.. but pff.. I had never problems with this adapter and the proxy.. I use the smartlife-app 3.12.6 .. but if the proxy not work, its clear, that this is not the problem.

Apollon77 commented 3 years ago

It seems that you already activated the the ssl proxy before even installing the certificate AND it seems that your host can not connect to himself on the other port ... maybe a network issue? or docker and missing port forwards or such?

Ideally install certificate FIRST and THEN enable the proxy.

Nothing was changed in that regard since veeery long time

Ilovegym66 commented 3 years ago

hmpff I've tested every thing.. no chance.. than I take another new smartphone Samsung S20 complete resetted to factory defaults, installed the certi and the smartlife app 3.12.6. Same Error: 2021-03-31 18:41:05.605 - error: tuya.0 (58997) Error: 140049830627200:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 46 I have the feeling, that something with the creation of the Certificate is not okay.. can this be..?? I make now a try with a older tablet with Android 7 or 8.. and give feedback. Have you a chance to test the actual function?

Apollon77 commented 3 years ago

yes try older androids ... see readme .. I got reports that some newer andreoid versions do not allow self signed root CAs at all to be registered ... so success was mostly with androdi simulators. Thats why I like iOS ... straight forward, the same in all versions ;-)))

Ilovegym66 commented 3 years ago

Yeah, well done... but don't ask, what a nighmare.. I must go back to Android 5 in the Emulator, with 7 it s not possible any more, too.. looks like google update after installation asap the policys... I found the correct pdf docu in the folder /opt/iobroker/node_modules/iobroker.tuya, can you make a link to this from the Adapter, please..? The Link there dont work or take me to the github page, and there are other docus..