Open cmorozcogmailcom opened 8 months ago
so I can this this url to post with postman and even on the hoobs box with curl. not sure what to do here , openssl -s_client -connect api.telematics.hyundaiusa.com:443 does connect but returns with a Secure Renegotiation IS NOT supported message. not really sure if this is an error. the bug the plugin fails at this point.
Server certificate -----BEGIN CERTIFICATE----- MIIHEzCCBfugAwIBAgIQLXFPdRFkymPD02GFSxdvljANBgkqhkiG9w0BAQsFADCB lTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G A1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMT0wOwYDVQQD EzRTZWN0aWdvIFJTQSBPcmdhbml6YXRpb24gVmFsaWRhdGlvbiBTZWN1cmUgU2Vy dmVyIENBMB4XDTIzMDYwMjAwMDAwMFoXDTI0MDcwMTIzNTk1OVowbTELMAkGA1UE BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExITAfBgNVBAoTGEh5dW5kYWkgQXV0 b0V2ZXIgQW1lcmljYTEmMCQGA1UEAxMdYXBpLnRlbGVtYXRpY3MuaHl1bmRhaXVz YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCkkqudlsL1hsLG T6+7iNmbmtwkyH1mAL8CmUHibw1tDuSE5fKgl4urXVlPlk0V/dciCYWMTlDXRPnP ihYIwAAYvOUgs5rkGzWayvLRYR0WN799CqJbKC622oJ650YD58r0ctbypVcGjNRM H4YThCFK3hoWKSZXkpjnji1JRs2VrloASiN2dJ6/MaHUWztfhgEiykU0qS2RtbOM Hm64sCWeRaytji6jFR0DdSsh9d5C6dQaSZQs8w0qpo/b+JR9QAJgZm6vjL2atm++ afpYlU7YJqp8SpkI8tX6dBWyPcwv8fIK1izZbh6c0MsKNObk9LusYyYjg+F4ASFe UMLtmD3jAgMBAAGjggOEMIIDgDAfBgNVHSMEGDAWgBQX2dYlJ2f5McJJQ9kwNkSM bKlP6zAdBgNVHQ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gh1hcGkudGVsZW1hdGlj cy5oeXVuZGFpdXNhLmNvbYIhd3d3LmFwaS50ZWxlbWF0aWNzLmh5dW5kYWl1c2Eu Y29tMA0GCSqGSIb3DQEBCwUAA4IBAQAeXFkJAbpgFNYC6X1C+/rJaOnzBvVBHWnV 97n8YggMCHE4h2ZMVlky+ytzyIweADS2T01eDtKH0PQ88oIVWX2b729UQUfMaiyg 00yiEtxdhgI9PvAb4J97uR73WuNtYj4WUIfnpqxQlkxuCifOpCGeW001jYZnjAhw lBxmrVJGIMnMOupmwxdsKqplY6ssTCrS02wEsYOM76NleEyQxm/5rBLBoPrPXH2a Zuwa6LAN4Q6oM7eqHbYb2OfBn/5j5dOBoy6hiob3D419urGiRNcblvzQaYc1pY9x h456sM7IPWCawJ4EM9TnS4SBVdbxgip34geC5uLmvxlnpkreNFG9 -----END CERTIFICATE----- subject=C = US, ST = California, O = Hyundai AutoEver America, CN = api.telematics.hyundaiusa.com
issuer=C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Organization Validation Secure Server CA
same thing doing this with no tls1.3 openssl s_client -no_tls1_3 -connect api.telematics.hyundaiusa.com:443
this is the curl that works curl --location 'https://api.telematics.hyundaiusa.com/v2/ac/oauth/token' \ --header 'Content-Type: application/json' \ --header 'user-agent: PostmanRuntime/7.26.10' \ --header 'client_id: mxxxxxxx-exxx-Sxxxxx-bxxx-axxxxxxxxxxxx' \ --header 'client_secret: vxxxxxxx-xxxx-xxxx-xxxx' \ --header 'accept: application/json' \ --header 'Accept-Encoding: gzip,deflate' \ --header 'Content-Type: application/json' \ --header 'Content-Length: 57' \ --d '{"username":"xxxxxxxxx","password":"xxxxxxx"}'
doing the following openssl command openssl s_client -connect cloud.oracle.com:443 -no_tls1_3 -bugs gets me a result that looks encouraging . New, TLSv1.2, Cipher is ECDHE-ECDSA-AES256-GCM-SHA384 Server public key is 256 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated
So i surmise that the telematics site is not allowing older protocols since the return message states unsafe legacy renegotiation disabled
i found a fix and a work around. I edited request-as-event-emitter.js. I added to the top const crypto = require('node:crypto'); const tls = require('tls');
then after const currentUrl = redirectString || requestUrl; I added the following. options.secureOptions=crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT;
then restart the plugin.
Worked for me! Thanks for your help! I was using "homebridge-hyundai-bluelink-next" plugin and for raspbean users the file is located at /var/lib/homebridge/node_modules/homebridge-hyundai-bluelink-next/node_modules/got/source/request-as-event-emitter.js
Describe The Bug: bug in autentication phase in plugin
To Reproduce:
run the plug in via the home bridge Expected behavior:
3/29/2024, 9:52:26 PMHyundai Bluelink BridgeHyundaiERRORClient Error GotError [RequestError]: write EPROTO 2005FBB6:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:922:
c Logs: 3/29/2024, 9:52:24 PMHyundai Bluelink BridgeLoaded plugin 'homebridge-hyundai-bluelink' 3/29/2024, 9:52:24 PMHyundai Bluelink BridgeLoading 1 platforms... 3/29/2024, 9:52:24 PMHyundai Bluelink BridgeHyundaiLoading accessory from cache: 2019 SONATA PLUGIN HYBRID 3/29/2024, 9:52:25 PMHyundai Bluelink BridgeBridge is running on port 51916. 3/29/2024, 9:52:26 PMHyundai Bluelink BridgeHyundaiERRORClient Error GotError [RequestError]: write EPROTO 2005FBB6:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:922:
code: 'EPROTO', host: 'api.telematics.hyundaiusa.com', hostname: 'api.telematics.hyundaiusa.com', method: 'POST', path: '/v2/ac/oauth/token', socketPath: undefined, protocol: 'https:', url: 'https://api.telematics.hyundaiusa.com/v2/ac/oauth/token', gotOptions: { path: '/v2/ac/oauth/token', protocol: 'https:', slashes: true, auth: null, host: 'api.telematics.hyundaiusa.com', port: null, hostname: 'api.telematics.hyundaiusa.com', hash: null, search: null, query: null, pathname: '/v2/ac/oauth/token', href: 'https://api.telematics.hyundaiusa.com/v2/ac/oauth/token', retry: { retries: [Function (anonymous)], methods: [Set], statusCodes: [Set], errorCodes: [Set] }, headers: { 'user-agent': 'PostmanRuntime/7.26.10', client_id: 'xxxx', client_secret: 'xxxx', accept: 'application/json', 'accept-encoding': 'gzip, deflate', 'content-type': 'application/json', 'content-length': 57 }, hooks: { beforeRequest: [], beforeRedirect: [], beforeRetry: [], afterResponse: [], beforeError: [], init: [] }, decompress: true, throwHttpErrors: true, followRedirect: true, stream: false, form: false, json: true, cache: false, useElectronNet: false, method: 'POST', body: '{"username":"xxxxxx@gmail.com","password":"xxxxxxxx$"}' }
not sure where to find this on the hoobs starter kit distro .
Screenshots:
Environment: hoobs starter box