I've been following the Server v3 installation guide and think I've found a couple issues:
- On line 29 of ovms_server.conf.default, the variable is called apikey, but PushGCM.pm is looking for api_key_file; I think this needs to be updated in the default config file
- There's a typo in the SSL section of the guide: for the CA instructions, command chmod 0600 conf/vms_server.pem should be chmod 0600 conf/ovms_server.pem
I've been having some trouble setting up the server as well. I've been trying to use the TLS authentication on port 6870 by setting up a self-signed certificate and checking off the TLS checkbox in the car's web server, but the server is giving me the following error upon connection:
tlsv1 alert unknown ca
and the car is giving me this one:
E (115144767) mongoose: mg_ssl_if_mbed_err 0x3f8bdcd0 SSL error: -9984
My read on this is that the car is trying to connect to the server, but because it's using a self-signed certificate the car won't connect because it doesn't recognize the CA. If that's the case, how do I allow my car to recognize the server's CA to allow a TLS connection? I might try Let's Encrypt as well, but I was curious what I might be doing wrong.
I was able to add my server's CA to the car module with this guide, so it is now making a connection to my server. However, after it connects, I'm now getting the following set of errors on the server:
2024-06-02 20:51:30.722645 -0700 info OVMS::Server::ApiV2: #10 - - new TLS connection from 24.114.36.165:52814
2024-06-02 20:51:30.727216 -0700 info OVMS::Server::Core: #10 - - ConnStart
Use of uninitialized value $owner in concatenation (.) or string at plugins/system/OVMS/Server/ApiV2.pm line 211.
Use of uninitialized value $owner in concatenation (.) or string at plugins/system/OVMS/Server/ApiV2.pm line 740.
Use of uninitialized value $owner in concatenation (.) or string at plugins/system/OVMS/Server/ApiV2.pm line 164.
2024-06-02 20:52:03.941951 -0700 error OVMS::Server::ApiV2: #10 - /- timeout due to no initial welcome exchange
2024-06-02 20:52:03.942507 -0700 info OVMS::Server::Core: #10 - - ConnFinish
Looking into this a bit further, it seems like none of the values are being sent ($owner, $clienttype, or $vehicleid). Clearly my car's module has some ability to connect to my server, but it isn't sending any other data along with the connection. I've filled out all of the data on the OVMS web server for the Server v3; what else could I be missing?
The issue seems to be on the server side. How are you handling authentication, and can you provide a link (or the code) to the authentication module you are using?
I was hoping to use the default Drupal authentication, but clearly I don't have it set up correctly. I set up Drupal using this guide and used MySQL rather than mariaDB and used the same Drupal username and password that I intended to use for my OVMS owner; that way I could just copy the hashed password from the Drupal database and paste it into the ovms_owners table. Based on the error code above, I'm guessing that AuthDrupal.pm is looking for table $user in the openvehicles database rather than in the drupal database.
I also copied openvehicles.info and openvehicles.module into my Drupal site at /var/www/html/drupal/sites/all/modules. When I open the Drupal webpage, I see "Open Vehicles" show up in the Modules tab, but once I enable it I don't really see anything happen?
Most likely version of drupal, etc. Probably far too complex for what you need - unless you are trying to host a server for many users to use?
If it is just for yourself, you can use AuthNone as an example. You just need to implement that one Authenticate function. Something like this:
No, at most two people would be using this for one car, maybe a second in the future; not a huge deal if we share logins. I'll probably just get rid of Drupal in that case.
I've made a copy of AuthNone.pm called AuthBasic.pm and changed the authenticate function as you suggested, replacing 'myuser' and 'mypassword' with the same one in my ovms_owners table and on the car's web interface. I changed the ovms_server.conf file to use the new plugin, but I'm still running into the same issue:
Note that I added some debug outputs to ApiV2.pm and Core.pm to see some more detail on the connection information. It shows that both $vehicleid and $clienttype are set to '-' since they're blank and $owner isn't initialized because there's no line setting it to '-' when it's blank.
In the shell on the car side, I see the following:
Where "Vehicle ID" is the same as the one in table ovms_cars and "User" is the same as the one I used in my authenticate function and in ovms_owners. Further, for simplicity I'm using the same authentication password as I am using for the car password in the ovms_cars table and the owner password in the ovms_owners table.
Hoping this is all clear, I'm very tired today so I wouldn't be surprised if some of this wasn't coherent. TL;DR: I'm getting the same error where none of the $vehicleid, $owner, or $clienttype are getting set when the car connects to the server.
Have you setup the owners and cars in the database itself? Please provide the output here:
If you are concerned about privacy posting here, you can instead email to mark (at) openvehicles (dot) com.
Note that the 'owner' field is the relationship link between ovms_cars and ovms_owners. An example of what it should look like is:
I've sent the output of those table entries to the email you specified. I think it looks okay, but let me know if anything looks incorrect. I did notice initially that my owner status was set to 0, but I've since changed that to 1 and I'm still seeing the same behaviour.
Just wanted to check in and see if you had an opportunity to check the database file I sent.
The two tables look correct.
Not sure how to debug/support this from the forums here.The issue could be any of a number, and it would require stepping through the connection, checking each stage.
Knowing that the data in the tables looks correct is a good start, thank you. I'll try to do some more debugging on my end and see if I can make any progress.