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

Vehicles uses port 443 even when configured otherwise #114

Closed
Bre77 opened this issue Feb 23, 2024 · 19 comments
Closed

Vehicles uses port 443 even when configured otherwise #114

Bre77 opened this issue Feb 23, 2024 · 19 comments

Comments

@Bre77
Copy link

Bre77 commented Feb 23, 2024

This morning I received the email saying I was Fleet Telemetry ready.

I create a brand new CA cert using my private key, and issued a certificate to my fleet telemetry server. I then used the fleet_telemetry_config endpoint to install config on my Model 3. However the fleet_telemetry_errors endpoint has told me certificate signed by unknown authority

I ran ./check_server_cert.sh conf.json and it returned:

/tmp/tmp.xmvFF6Cnk1: OK
The server certificate is valid.

So it would seem my configuration and Fleet Telemetry server are configured correctly, yet my vehicle does not like my certificate authority.

@Bre77 Bre77 changed the title Fleet Telemetry Ready but Unknown CSR Fleet Telemetry Ready but certificate signed by unknown authority Feb 23, 2024
@Bre77
Copy link
Author

Bre77 commented Feb 23, 2024

I dont think the vehicle is respecting the port variable in my config...
The error says "port": "443", but my config clearly has "port": "4443",

@Bre77 Bre77 changed the title Fleet Telemetry Ready but certificate signed by unknown authority Vehicles uses port 443 even when configured otherwise Feb 24, 2024
@patrickdemers6
Copy link
Collaborator

The vehicle always uses port 443. The port you specify in config.json tells the server where to listen. You just need to make sure public port 443 gets mapped to whatever port you specify.

@patrickdemers6
Copy link
Collaborator

Hopefully at some point the port the vehicle uses will be customizable.

@Bre77
Copy link
Author

Bre77 commented Feb 24, 2024

The vehicle always uses port 443. The port you specify in config.json tells the server where to listen. You just need to make sure public port 443 gets mapped to whatever port you specify.

The check_server_cert.sh reference and uses a port configure in the proposed_config.json, not the server config. This is the reason I thought it would be possible.

@patrickdemers6
Copy link
Collaborator

That's a great point. When setting up my instance I used 443 to keep it simple so didn't think about that.

@StephenPorter
Copy link

I was messing around with check_server_cert.sh using your excellent guide here:
https://dev.to/patrickdemers6/fleet-telemetry-streaming-data-from-your-tesla-2i97

I wasn't sure if it expects the server or client config for verification? I assumed the client config is probably the payload that you use for the POST fleet_telemetry_config endpoint when you are registering a vehicle with fleet-telemetry. That seems to require a hostname, port (optional) and ca similar to what the script expects. The way I got the verification script to work was to send the entire certificate chain for my existing server's TLS certificate as a string into the ca field of the config.json file I passed to the script.

@patrickdemers6
Copy link
Collaborator

patrickdemers6 commented Feb 24, 2024

The check_server_cert.sh script expects the server's configuration file. When creating this config.json in tutorial, I instruct to add the CA field (which is cert chain) to the server configuration to make the script work out of the box.

Edit: updated the post to clarify this script expects the server's config file.

@StephenPorter
Copy link

Thanks! In that case, do you know if the actual server requires the hostname and ca fields (i.e. the full certificate chain) to be supplied in it's config file as well? I hadn't seen those in the docs, but I know things are in flux.

I think I got thrown off because your tutorial says path to full certificate chain from previous step in your example server config file (I interpreted that to be a filename), but check_server_cert.sh seemed to just expect a big json string like the client config demands in the Send configuration to vehicle section in the tutorial.

@patrickdemers6
Copy link
Collaborator

The server config file doesn't need hostname or ca. They are both used to tell the script where the web server is to validate certs.

You're right - I'll correct that. Thanks for calling out my oversights!

@bassmaster187
Copy link

The vehicle always uses port 443. The port you specify in config.json tells the server where to listen. You just need to make sure public port 443 gets mapped to whatever port you specify.

Unfortunately apache is already using port 443 on my server. How did you solve this? Are requests from cars a http request, so I can use anything like ProxyPassMatch / ProxyPassReverse

@Bre77
Copy link
Author

Bre77 commented Feb 26, 2024

Unfortunately apache is already using port 443 on my server. How did you solve this? Are requests from cars a http request, so I can use anything like ProxyPassMatch / ProxyPassReverse

Welcome to my problem. You either need a second IP address and bind each application separately, use an SNI proxy infront to do a non decrypting proxy, or like I did, run a second server.

Eventually I plan to rewrite the Fleet Telemetry server in NodeJS and terminate all SSL including the mTLS in Caddy 2.

@GaPhi
Copy link

GaPhi commented Feb 26, 2024 via email

@Bre77
Copy link
Author

Bre77 commented Feb 26, 2024

@GaPhi shameless plug, but if you want to test your vehicle with Fleet Telemetry, sign up for a free trial at https://teslemetry.com/ and you can get your fleet telemetry in the browser, over SSE, or web hooks. I suspect if you have an MCU2 or similar, your vehicle will be too old.

@GaPhi
Copy link

GaPhi commented Feb 26, 2024 via email

@patrickdemers6
Copy link
Collaborator

The vehicle always uses port 443. The port you specify in config.json tells the server where to listen. You just need to make sure public port 443 gets mapped to whatever port you specify.

Unfortunately apache is already using port 443 on my server. How did you solve this? Are requests from cars a http request, so I can use anything like ProxyPassMatch / ProxyPassReverse

@bassmaster187 @Bre77 change rolling out later today to make it so you can set the port of your fleet-telemetry server. Will let you know when it's live.

@Bre77
Copy link
Author

Bre77 commented Feb 27, 2024

@patrickdemers6 thats awesome, I'll test it as soon as its avaliable, I have a servers in the EU and US ready and waiting :)

@GaPhi if you still have concerns email me at admin@teslemetry.com, but the site did tell you to revoke with Tesla too

@patrickdemers6
Copy link
Collaborator

@Bre77 the change is deployed. I have validated in prod you can now point the car to an alternative port.

@Bre77
Copy link
Author

Bre77 commented Feb 27, 2024

@Bre77 the change is deployed. I have validated in prod you can now point the car to an alternative port.

I can confirm my Model 3 is now attempting to connect on the custom port I have specified accord it its errors.

@bassmaster187
Copy link

The vehicle always uses port 443. The port you specify in config.json tells the server where to listen. You just need to make sure public port 443 gets mapped to whatever port you specify.

Unfortunately apache is already using port 443 on my server. How did you solve this? Are requests from cars a http request, so I can use anything like ProxyPassMatch / ProxyPassReverse

@bassmaster187 @Bre77 change rolling out later today to make it so you can set the port of your fleet-telemetry server. Will let you know when it's live.

I realized this morning that port is now a required field. Such breaking changes should be announced by a mailing list or whatever.

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

5 participants