11 posts / 0 new
Last post
Alenux
Server v3 Guide Issues

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.

Alenux
One part fixed

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?

markwj
markwj's picture
The issue seems to be on the

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?

Alenux
I was hoping to use the

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?

markwj
markwj's picture
Most likely version of drupal

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:

sub Authenticate
  {
  my ($user,$password) = @_;
  return (($user eq 'myuser')&&($password eq 'mypassword'))?'*':'';
  }

Alenux
No, at most two people would

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:

2024-06-12 01:38:07.355346 -0700 info  OVMS::Server::ApiV2: #10 - - new TLS connection from 154.43.164.63:50234
2024-06-12 01:38:07.359713 -0700 info  OVMS::Server::Core: #10 - - ConnStart
2024-06-12 01:38:07.359813 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: handle: AnyEvent::Handle=HASH(0x5866f297cd30)
2024-06-12 01:38:07.359891 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: proto: v2/6870/tls
2024-06-12 01:38:07.359966 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: host: 154.43.164.63
2024-06-12 01:38:07.360037 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: port: 50234
2024-06-12 01:38:07.360112 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: callback_tx: CODE(0x5866f1dc9050)
2024-06-12 01:38:07.360188 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: callback_shutdown: CODE(0x5866f1ddf7a8)
2024-06-12 01:38:07.360261 -0700 info  OVMS::Server::Core: #10 - - TEMPORARY DEBUG: fh: GLOB(0x5866f2a26638)
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 215.
2024-06-12 01:38:52.158459 -0700 info  OVMS::Server::ApiV2: #10 TEMPORARY DEBUG: Vehicle ID: - |  Owner:   | Client Type:  -
Use of uninitialized value $owner in concatenation (.) or string at plugins/system/OVMS/Server/ApiV2.pm line 744.
Use of uninitialized value $owner in concatenation (.) or string at plugins/system/OVMS/Server/ApiV2.pm line 164.
2024-06-12 01:38:52.158843 -0700 error OVMS::Server::ApiV2: #10 - /- timeout due to no initial welcome exchange
2024-06-12 01:38:52.159111 -0700 info  OVMS::Server::Core: #10 - - ConnFinish

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:

I (935796097) ovms-server-v3: Connection is <server_name>:<port> <Vehicle ID>/<User> topic ovms/<User>/<Vehicle ID>

I (935796097) ovms-server-v3: Status : Connecting

I (935799347) ovms-server-v3: Connection successful

I (935829467) ovms-server-v3: Status: Disconnected from OVMS Server V3

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. 

markwj
markwj's picture
Have you setup the owners and

Have you setup the owners and cars in the database itself? Please provide the output here:

  • select owner,name,status,deleted,changed from ovms_owners;
  • select vehicleid,vehiclename,owner,deleted,changed,v_lastupdate from ovms_cars;

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:

+-----------+-------------+-------+---------+---------------------+---------------------+
| vehicleid | vehiclename | owner | deleted | changed             | v_lastupdate        |
+-----------+-------------+-------+---------+---------------------+---------------------+
| TESTCAR   | TESTCAR     |     1 |       0 | 2012-10-10 14:39:27 | 2018-03-05 05:25:38 |
+-----------+-------------+-------+---------+---------------------+---------------------+

+-------+--------+--------+---------+---------------------+
| owner | name   | status | deleted | changed             |
+-------+--------+--------+---------+---------------------+
|     1 | tester |      1 |       0 | 2013-11-07 08:54:39 |
+-------+--------+--------+---------+---------------------+

Alenux
I've sent the output of those

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.

Alenux
Check in

Just wanted to check in and see if you had an opportunity to check the database file I sent.

markwj
markwj's picture
The two tables look correct.

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.

Alenux
Knowing that the data in the

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.

Log in or register to post comments
randomness