sap-labs-france / ev-server

The Open e-Mobility Charging Station management backend server (check also ev-dashboard and ev-mobile)
https://open-e-mobility.fr/
Apache License 2.0
148 stars 137 forks source link

Can't establish a WSS connection #4212

Closed samarasdelta closed 1 year ago

samarasdelta commented 1 year ago

Hello,

i have a problem trying to connect with wss protocol, ws is working fine.

wss url:

wss://ev-dashboard.test:8010/OCPP16/649c24f8ddd779235c77e4b4/649ee7de2a3afe43702bc9d7
wss://ev-dashboard.test:8010/REST/649c24f8ddd779235c77e4b4/649ee7de2a3afe43702bc9d7

Postman response: (same on both cases)

Error: write EPROTO 66960904:error:10000410:SSL routines:OPENSSL_internal:SSLV3_ALERT_HANDSHAKE_FAILURE:../../../../src/third_party/boringssl/src/ssl/tls_record.cc:594:SSL alert number 40
66960904:error:1000009a:SSL routines:OPENSSL_internal:HANDSHAKE_FAILURE_ON_CLIENT_HELLO:../../../../src/third_party/boringssl/src/ssl/handshake.cc:644:

The version I'm using is 2.4.66 (ev-dashboard & ev-server) for corporate reasons.

I will try to describe the actions I have taken so far.

Below is a part of config.json file

 "CentralSystems": [
    {
      "type": "ocpp",
      "implementation": "soap",
      "protocol": "https",
      "host": "ev-dashboard.test",
      "port": 8000,
      "debug": true
    },
    {
      "type": "ocpp",
      "implementation": "json",
      "protocol": "wss",
      "host": "ev-dashboard.test",
      "port": 8010,
      "debug": true
    }
  ],
  "CentralSystemRestService": {
    "protocol": "https",
    "host": "ev-dashboard.test",
    "port": 443,
    "sslKey": "/ssl/key.pem",
    "sslCert": "/ssl/cert.pem",
    "sslCa": [],
    "userTokenKey": "YourSecretKey",
    "socketIO": true,
    "userTokenLifetimeHours": 12,
    "userDemoTokenLifetimeDays": 365,
    "userTechnicalTokenLifetimeDays": 365,
    "socketIOListNotificationIntervalSecs": 5,
    "socketIOSingleNotificationIntervalSecs": 1,
    "passwordWrongNumberOfTrial": 3,
    "passwordBlockedWaitTimeMin": 5,
    "captchaSecretKey": "removed for security reasons",
    "debug": true
  },
  "CentralSystemFrontEnd": {
    "protocol": "https",
    "host": "ev-dashboard.test",
    "port": 443
  },
  "OCPIService": {
    "protocol": "https",
    "host": "ev-dashboard.test",
    "port": 9090,
    "sslKey": "/ssl/key.pem",
    "sslCert": "/ssl/cert.pem",
    "sslCa": [],
    "debug": true
  },
  "OICPService": {
    "protocol": "https",
    "host": "ev-dashboard.test",
    "port": 8443,
    "sslKey": "/ssl/key.pem",
    "sslCert": "/ssl/cert.pem",
    "sslCa": [],
    "debug": true
  },
  "CentralSystemServer": {
    "protocol": "https",
    "host": "ev-dashboard.test",
    "port": 443
  },
  "ODataService": {
    "protocol": "https",
    "host": "ev-dashboard.test",
    "port": 9292,
    "sslKey": "/ssl/key.pem",
    "sslCert": "/ssl/cert.pem",
    "sslCa": [],
    "debug": true
  },
  "WSDLEndpoint": {
    "baseUrl": "https://ev-dashboard.test:8000"
  },
  "JsonEndpoint": {
    "baseUrl": "wss://ev-dashboard.test:8010"
  },
  "OCPIEndpoint": {
    "baseUrl": "https://ev-dashboard.test:9090"
  },

Also here is a part of my hosts file. (test is an organization that I have created)

127.0.0.1 localhost
::1 localhost

127.0.0.1   ev-dashboard.test
::1 ev-dashboard.test

127.0.0.1   test.ev-dashboard.test
::1 test.ev-dashboard.test

192.168.1.132   ev-dashboard.test
192.168.1.132   test.ev-dashboard.test

If you need further information from the changes I have done, I will be happy to provide it.

samarasdelta commented 1 year ago

The problem was my ssl certificates. In my case, self-signed certificates didn't work so i used certbot for a test domain that i own. After that, and some changes to the code (I'm using version 2.4.66), I was finally able to establish a wss connection. If anyone needs any help, feel free to contact.