llamafilm / tesla-http-proxy-addon

Tesla HTTP Proxy Add-on for Home Assistant
Apache License 2.0
45 stars 21 forks source link

Unable to Share Vehicle: This third party isn't registered with Tesla. We can't grant them access at the time. #83

Closed chowdarygm closed 7 months ago

chowdarygm commented 7 months ago

The problem

I am having an issue with - This third party isn't registered with Tesla. We can't grant them access at the time. I checked other threads with similar issue but couldn't find a solution.

IMG_1756

I am using the cloudflare process mentioned in this blog . Setup two times but still end up with this issue and unable to figure out what's wrong. Able to access public key just fine.

Appreciate any help on this

This is the log from Tesla Proxy addon

[19:00:31] werkzeug:INFO: 172.30.32.2 - - [15/Apr/2024 19:00:31] "GET / HTTP/1.1" 200 -
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:21052: EOF
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:25722: EOF
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:29344: EOF
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:34018: tls: client requested unsupported application protocols ([http/0.9 http/1.0 spdy/1 spdy/2 spdy/3 h2c hq])
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:37348: tls: client requested unsupported application protocols ([hq h2c spdy/3 spdy/2 spdy/1 http/1.0 http/0.9])
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:41182: EOF
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:45012: tls: peer doesn't support any of the certificate's signature algorithms
2024/04/15 19:11:03 http: TLS handshake error from 212.102.40.218:49016: EOF
2024/04/15 19:11:04 http: TLS handshake error from 212.102.40.218:52962: EOF
2024/04/15 19:11:04 http: TLS handshake error from 212.102.40.218:57402: tls: peer doesn't support any of the certificate's signature algorithms
2024-04-15T19:18:38-05:00 [info ] Received GET request for /
2024-04-15T19:18:38-05:00 [error] Returning error Forbidden
2024/04/15 19:23:23 http: TLS handshake error from 206.168.34.184:57784: EOF
2024/04/15 19:23:24 http: TLS handshake error from 206.168.34.184:56518: EOF
2024/04/15 19:23:24 http: TLS handshake error from 206.168.34.184:48454: EOF
2024/04/15 19:23:24 http: TLS handshake error from 206.168.34.184:52142: tls: client requested unsupported application protocols ([http/0.9 http/1.0 spdy/1 spdy/2 spdy/3 h2c hq])
2024/04/15 19:23:24 http: TLS handshake error from 206.168.34.184:60824: tls: client requested unsupported application protocols ([hq h2c spdy/3 spdy/2 spdy/1 http/1.0 http/0.9])
2024/04/15 19:23:25 http: TLS handshake error from 206.168.34.184:36136: EOF
2024/04/15 19:23:25 http: TLS handshake error from 206.168.34.184:57922: tls: peer doesn't support any of the certificate's signature algorithms
2024/04/15 19:23:26 http: TLS handshake error from 206.168.34.184:58816: EOF
2024/04/15 19:23:26 http: TLS handshake error from 206.168.34.184:56586: EOF
2024/04/15 19:23:26 http: TLS handshake error from 206.168.34.184:34584: tls: peer doesn't support any of the certificate's signature algorithms
2024/04/15 19:33:35 http: TLS handshake error from 192.155.90.220:16750: EOF

This is the log from Apache addon

172.30.32.1 - - [15/Apr/2024:19:53:33 -0500] "GET /apple-touch-icon.png HTTP/1.1" 403 287
172.30.32.1 - - [15/Apr/2024:19:53:33 -0500] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 403 287
[Mon Apr 15 19:53:33.825383 2024] [authz_core:error] [pid 141] [client 172.30.32.1:39318] AH01630: client denied by server configuration: /share/tesla/apple-touch-icon-precomposed.png
[Mon Apr 15 19:53:33.839442 2024] [authz_core:error] [pid 141] [client 172.30.32.1:39318] AH01630: client denied by server configuration: /share/tesla/
172.30.32.1 - - [15/Apr/2024:19:53:33 -0500] "GET / HTTP/1.1" 403 287
[Mon Apr 15 19:53:33.940334 2024] [authz_core:error] [pid 141] [client 172.30.32.1:39318] AH01630: client denied by server configuration: /share/tesla/apple-touch-icon.png
172.30.32.1 - - [15/Apr/2024:19:53:33 -0500] "GET /apple-touch-icon.png HTTP/1.1" 403 287
172.30.32.1 - - [15/Apr/2024:19:53:33 -0500] "GET /favicon.ico HTTP/1.1" 403 287
[Mon Apr 15 19:53:33.978544 2024] [authz_core:error] [pid 141] [client 172.30.32.1:39318] AH01630: client denied by server configuration: /share/tesla/favicon.ico
[Mon Apr 15 19:53:34.047185 2024] [authz_core:error] [pid 141] [client 172.30.32.1:39318] AH01630: client denied by server configuration: /share/tesla/favicon.ico
172.30.32.1 - - [15/Apr/2024:19:53:34 -0500] "GET /favicon.ico HTTP/1.1" 403 287
[Mon Apr 15 20:17:49.689859 2024] [authz_core:error] [pid 139] [client 172.30.32.1:44928] AH01630: client denied by server configuration: /share/tesla/
172.30.32.1 - - [15/Apr/2024:20:17:49 -0500] "GET / HTTP/1.1" 403 287
[Mon Apr 15 20:17:49.786110 2024] [authz_core:error] [pid 139] [client 172.30.32.1:44928] AH01630: client denied by server configuration: /share/tesla/favicon.ico, referer:
172.30.32.1 - - [15/Apr/2024:20:17:49 -0500] "GET /favicon.ico HTTP/1.1" 403 287
172.30.32.1 - - [15/Apr/2024:20:19:19 -0500] "GET /.well-known/appspecific/com.tesla.3p.public-key.pem HTTP/1.1" 200 178
172.30.32.1 - - [15/Apr/2024:20:19:19 -0500] "GET /favicon.ico HTTP/1.1" 403 287
[Mon Apr 15 20:19:19.706905 2024] [authz_core:error] [pid 140] [client 172.30.32.1:37978] AH01630: client denied by server configuration: /share/tesla/favicon.ico, referer: well-known/appspecific/com.tesla.3p.public-key.pem
172.30.32.1 - - [15/Apr/2024:20:19:40 -0500] "GET /.well-known/appspecific/com.tesla.3p.public-key.pem HTTP/1.1" 206 178
172.30.32.1 - - [15/Apr/2024:20:33:19 -0500] "GET /.well-known/appspecific/com.tesla.3p.public-key.pem HTTP/1.1" 304 -
[Mon Apr 15 20:33:20.075786 2024] [authz_core:error] [pid 145] [client 172.30.32.1:48036] AH01630: client denied by server configuration: /share/tesla/favicon.ico, referer: known/appspecific/com.tesla.3p.public-key.pem
172.30.32.1 - - [15/Apr/2024:20:33:20 -0500] "GET /favicon.ico HTTP/1.1" 403 287

What version of the addon are you using?

2.2.3

What version of Home Assistant Core are you using?

core-2024.4.3

What type of installation are you running?

Home Assistant OS

What version of Tesla integration are you using?

No response

What region of Tesla API are you using?

North America, Asia-Pacific

What model and year is your vehicle?

2024 MY

What is your domain name (FQDN)?

Paste the log output from the addon here

No response

Any additional context or screenshots that help explain the issue

No response

llamafilm commented 7 months ago

The root cause of this issue is not visible in your logs because it would have occurred earlier. Please turn on the “regenerate auth” setting and restart the addon, then post the full log output.

chowdarygm commented 7 months ago

The root cause of this issue is not visible in your logs because it would have occurred earlier. Please turn on the “regenerate auth” setting and restart the addon, then post the full log output.

Here it is

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service webui: starting
s6-rc: info: service webui successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[08:41:27] webui:INFO: Starting Flask server for Web UI...
[08:41:27] werkzeug:INFO: WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:8099
 * Running on http://172.30.33.4:8099
[08:41:27] werkzeug:INFO: Press CTRL+C to quit
[08:41:28] INFO: Found existing keypair
[08:41:28] INFO: Testing public key...
HTTP/2 200 
date: Tue, 16 Apr 2024 13:41:29 GMT
content-length: 178
accept-ranges: bytes
etag: "b2-6162b62e1c4ca"
last-modified: Mon, 15 Apr 2024 23:57:38 GMT
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=L6xzx0iQPQUq9blziC%2BtLEyu5PYdI2A4PfGw6m%2BeSQXp1f2OpULSC4lHCM3KnFH0UjLYUPDm2%2FgP%2B3dFZRRcBX2ca44e1UurmK2%2Bh7bn93oixrfOAgciB4%2Bk9MxdhNUgHWWht1jRyT%2FQNQs%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 875497d8a877e259-ORD
alt-svc: h3=":443"; ma=86400

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgAHbFuyom91f6pQtPqWo098QwQrh
q3lF+FrviKF1Vkx7W8ATdGNLOMDNoYlg/gj+U5DeE1DQZcWch5Dgj4gUvg==
-----END PUBLIC KEY-----
[08:41:29] INFO: Running auth.py
[08:41:29] auth:INFO: Generating Partner Authentication Token
[08:41:29] urllib3.connectionpool:DEBUG: Starting new HTTPS connection (1): auth.tesla.com:443
[08:41:29] urllib3.connectionpool:DEBUG: https://auth.tesla.com:443 "POST /oauth2/v3/token HTTP/1.1" 200 762
[08:41:29] auth:DEBUG: {"access_token":"_redacted_","expires_in":28800,"token_type":"Bearer"}
[08:41:29] auth:INFO: Registering Tesla account...
[08:41:29] urllib3.connectionpool:DEBUG: Starting new HTTPS connection (1): fleet-api.prd.na.vn.cloud.tesla.com:443
[08:41:30] urllib3.connectionpool:DEBUG: https://fleet-api.prd.na.vn.cloud.tesla.com:443 "POST /api/1/partner_accounts HTTP/1.1" 200 541
[08:41:30] auth:DEBUG: {"response":{"account_id":"_redacted_","domain":"","name":"Homeassistant2","description":"created second account for Homeassistant","csr":null,"client_id":"_redacted_","ca":null,"created_at":"2024-04-15T05:41:38.552Z","updated_at":"2024-04-16T13:41:30.635Z","enterprise_tier":"free","issuer":null,"csr_updated_at":null,"public_key":"048001db16eca89bdd5fea942d3ea5a8d3df10c10ae1ab7945f85aef88a175564c7b5bc01374634b38c0cda18960fe08fe5390de1350d065c59c8790e08f8814be"}}
[08:41:30] urllib3.connectionpool:DEBUG: Starting new HTTP connection (1): supervisor:80
[08:41:30] urllib3.connectionpool:DEBUG: http://supervisor:80 "GET /addons/self/options/config HTTP/1.1" 200 230
[08:41:30] urllib3.connectionpool:DEBUG: Starting new HTTP connection (1): supervisor:80
[08:41:31] urllib3.connectionpool:DEBUG: http://supervisor:80 "POST /addons/self/options HTTP/1.1" 200 25
[08:41:31] INFO: Starting Tesla HTTP Proxy

Do not listen on a network interface without adding client authentication. Unauthorized clients may
be used to create excessive traffic from your IP address to Tesla's servers, which Tesla may respond
to by rate limiting or blocking your connections.
2024-04-16T08:41:32-05:00 [debug] Creating proxy
2024-04-16T08:41:32-05:00 [info ] Listening on 0.0.0.0:443
2024/04/16 08:42:35 http: TLS handshake error from 192.155.88.231:55780: read tcp 172.30.33.4:443->192.155.88.231:55780: read: connection reset by peer
2024/04/16 09:15:19 http: TLS handshake error from :57625: read tcp 172.30.33.4:443->45.79.168.172:57625: read: connection reset by peer
2024-04-16T09:15:57-05:00 [info ] Received GET request for /rY0a
2024-04-16T09:15:57-05:00 [error] Returning error Forbidden
llamafilm commented 7 months ago

From your screenshot, I thought the partner registration request had failed. But your log shows that succeeded, so I’m not sure. Are you the legal owner of this vehicle? I remember seeing some similar issue in vehicle-command for leases.

The TLS error might be a separate issue. I only tested this with the tesla_custom integration from HACS. Are you using something else? This request does not look like a normal URI: Received GET request for /rY0a

chowdarygm commented 7 months ago

This is my brand new car and I am the first owner. Something weird happened. Out of nowhere, the key got accepted in the subsequent trial by the App and said it was successful. Now I took that authentication code and put it in the Tesla custom integration under Fleet API settings, I am getting 'failed to setup' error and no devices are shown. Here is the log from debugging mode of Tesla custom integration and I know this is different integration but any suggestions ?

2024-04-16 11:38:53.780 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19830 days, 12:21:07
2024-04-16 11:38:53.780 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
2024-04-16 11:38:53.780 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
2024-04-16 11:38:54.032 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token
2024-04-16 11:38:54.032 DEBUG (MainThread) [teslajsonpy.connection] Auth returned {'error': 'login_required', 'error_description': 'Login required', 'referenceID': '4ec0e81e-9315-403e-9dcd-8ffaf04f35c6-1713285533978'}
2024-04-16 11:38:58.063 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19830 days, 12:21:02
2024-04-16 11:38:58.064 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
2024-04-16 11:38:58.064 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
2024-04-16 11:39:00.278 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token
2024-04-16 11:39:00.278 DEBUG (MainThread) [teslajsonpy.connection] Auth returned {'error': 'login_required', 'error_description': 'Login required', 'referenceID': '3d146338-e44e-4334-a241-b02fd818a07b-1713285540232'}
2024-04-16 11:39:04.096 DEBUG (MainThread) [teslajsonpy.connection] Token expiration in -19830 days, 12:20:56
2024-04-16 11:39:04.096 DEBUG (MainThread) [teslajsonpy.connection] Oauth expiration detected
2024-04-16 11:39:04.096 DEBUG (MainThread) [teslajsonpy.connection] Refreshing access token with refresh_token
2024-04-16 11:39:04.295 DEBUG (MainThread) [teslajsonpy.connection] Unable to refresh sso oauth token
2024-04-16 11:39:04.295 DEBUG (MainThread) [teslajsonpy.connection] Auth returned {'error': 'login_required', 'error_description': 'Login required', 'referenceID': '52b703bc-9e85-43e4-ba42-fa4ddc087c10-1713285544252'}
2024-04-16 11:39:04.295 WARNING (MainThread) [homeassistant.config_entries] Config entry 'xxx@gmail.com' for tesla_custom integration could not authenticate
baylanger commented 7 months ago

@chowdarygm this seems quite odd:

Token expiration in -19830 days

That's 54y ago ... 1970, that's the year "clock" started. Proper date is required for encryption to work. Make sure the date is properly set.

baylanger commented 7 months ago

Second thought... maybe your computer's date is ok and perhaps it's the token that has wrong date of creation. I'm not sure but something related to date seems wrong somewhere.

chowdarygm commented 7 months ago

Second thought... maybe your computer's date is ok and perhaps it's the token that has wrong date of creation. I'm not sure but something related to date seems wrong somewhere.

But I am not setting the token expiration date anywhere right?

chowdarygm commented 7 months ago

I deleted the Tesla custom integration again and restarted the whole process and now I was able to successfully add the vehicle key and vehicle to the integration. Don't know what happened till now as I did not change anything in the steps this time.