HTTP thing - SSLHandshakeException

  • Platform information:
    • Hardware: Docker instance
    • OS: Debian 11
    • Java Runtime Environment: Shipped with docker image
    • openHAB version: 4.0.4
  • Issue of the topic: Sudenly I’ve notice my HTTPs thing is not updating. In logs I can see there is problem with SSL connection: failed: javax.net.ssl.SSLHandshakeException: Received fatal alert: h
    andshake_failure. It is public service and the certificate is valid. Also the call from local station, or even with curl or wget from docker image itself is working just fine.
  • Please post configurations (if applicable):
    HTTP thing configuration:
UID: http:url:solax
label: Solax inverter
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: true
  baseURL: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=<token_here>&sn=<sn_here>
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: GET
  timeout: 3000
  bufferSize: 2048
channels:
  - id: sn
    channelTypeUID: http:string
    label: Serial Number
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.sn
      escapedUrl: false
  - id: acpower
    channelTypeUID: http:number
    label: AC Power
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.acpower
      escapedUrl: false
  - id: powerdc1
    channelTypeUID: http:number
    label: DC Power
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.powerdc1
      escapedUrl: false
  - id: yieldtoday
    channelTypeUID: http:number
    label: Yield Today
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.yieldtoday
      escapedUrl: false
  - id: yieldtotal
    channelTypeUID: http:number
    label: Yield Total
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.yieldtotal
      escapedUrl: false
  - id: feedinpower
    channelTypeUID: http:number
    label: Feed In Power
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.feedinpower
      escapedUrl: false
  - id: feedinenergy
    channelTypeUID: http:number
    label: Feed In Energy
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.feedinenergy
      escapedUrl: false
  - id: consumeenergy
    channelTypeUID: http:number
    label: Feed In Energy
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.consumeenergy
      escapedUrl: false
  - id: uploadTime
    channelTypeUID: http:string
    label: Last data
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.uploadTime
      escapedUrl: false
  - id: inverterType
    channelTypeUID: http:number
    label: Iverter Type
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.inverterType
      escapedUrl: false
  - id: inverterStatus
    channelTypeUID: http:number
    label: Iverter Status
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.inverterStatus
      escapedUrl: false
  - id: batPower
    channelTypeUID: http:number
    label: Battery power
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.batPower
      escapedUrl: false
  - id: soc
    channelTypeUID: http:number
    label: Battery Charge
    description: null
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.result.soc
      escapedUrl: false

  • Logs:
2023-11-27 08:37:28.632 [WARN ] [p.internal.http.HttpResponseListener] - Requesting 'https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=<token_here>&sn=<sn_here>' (method='GET', content='null') failed: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

I’ve also perform packet capture (perhaps to see there are no common cipher or so) but no luck here - after client helo I can see FIN ACK.

I’d appreciate any advice - thank you.

Y

Hello,
exactly same problem with same solaxcloud from Nov 23th 12h00.
Probably solax changed something since at this date I had no update both on debian or openhab.
Nevertheless CURL command from debian still work properly … strange.
May-be playing with thing configuration ?
I will post again if I find something
Bye

I could not find a solution with http binding, so I switched to a exec:command with curl and then parsed the output. Not a clean solution but it works and should be more insensitive to updates

Hello @Daniele ,

thank you for your reply. Unfortunatelly I didn’t have time to go through the issue. It looks like the things configuration stopped working in the same time also on my site.
I’ll assume there is maybe smth wrong with the cipherset suit and/or some headers are now required.

Y

Hello @Daniele,

I was able to track down the problem. I start digging into solaxcloud TLS session and I figure it out where is the problem on solax site.
The resolution is clear when you compar the output of given commands:

openssl s_client -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect www.solaxcloud.com:443

and

openssl s_client -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect solaxcloud.com:443

There is specifig cipherset suit for given connection with is different for “www” service and “non-www” service. Solax just messed up the DNS vs cipherset suit strings per service - dunno if by mistace or by purpose (acctually both make sence).

To fix it up on site of OpenHab just define solax thinks without “www” and it will start just working like a charm. There is than no need to use custom script.

Y

Solax already changed the situation and now even the connection without “www” is not working. It looks like the solaxcloud enhanced its onw TLS security connection and allowing only secure TLS ciphers to be negotiated. The cipher set suite string which will allow TLS connection is: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 .

So the real question is how to increase the ability of OpenHab HTTP think to use more secure TLS ciphers?

Anyone?

Y

Cipher suites are part of the underlying java installation. As far as I understand TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 should be part of it.

What does a network trace of protocol negotiation show ? You should be able to see which ciphers and algorithms are available on client and server site. You also should be able to see an error message in the negotiation part of the network trace.

And thats the problem. The required cipher is not among offered:

Does that match with what is shown when you follow these instructions:
https://confluence.atlassian.com/stashkb/list-ciphers-used-by-jvm-679609085.html

for ZULU 17 version following the instructions I see this.

Default Cipher
*       TLS_AES_128_GCM_SHA256
*       TLS_AES_256_GCM_SHA384
*       TLS_CHACHA20_POLY1305_SHA256
*       TLS_DHE_DSS_WITH_AES_128_CBC_SHA
*       TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
*       TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
*       TLS_DHE_DSS_WITH_AES_256_CBC_SHA
*       TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
*       TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
*       TLS_DHE_RSA_WITH_AES_128_CBC_SHA
*       TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
*       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
*       TLS_DHE_RSA_WITH_AES_256_CBC_SHA
*       TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
*       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
*       TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
*       TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
*       TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
*       TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
*       TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
*       TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
*       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
*       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
*       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
*       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
*       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
*       TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
*       TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
*       TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
*       TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
*       TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
*       TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
*      TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
*       TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
*       TLS_EMPTY_RENEGOTIATION_INFO_SCSV
*       TLS_RSA_WITH_AES_128_CBC_SHA
*       TLS_RSA_WITH_AES_128_CBC_SHA256
*       TLS_RSA_WITH_AES_128_GCM_SHA256
*       TLS_RSA_WITH_AES_256_CBC_SHA
*       TLS_RSA_WITH_AES_256_CBC_SHA256
*       TLS_RSA_WITH_AES_256_GCM_SHA384

So for normal installs that install Java based on the methods listed on OpenHab for recommended version it seems we should be ok. Not sure about docker install.
Confirmed for Both windows version of Java install and Linux version on Debian 12 (bookworm)

But thats exactly the list I’ve got from my instance:

root@MeanMachine:/tmp# java Ciphers.java 
Default Cipher
*       TLS_AES_128_GCM_SHA256
*       TLS_DHE_DSS_WITH_AES_128_CBC_SHA
*       TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
*       TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
*       TLS_DHE_RSA_WITH_AES_128_CBC_SHA
*       TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
*       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
*       TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
*       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
*       TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
*       TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
*       TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
*       TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
*       TLS_EMPTY_RENEGOTIATION_INFO_SCSV
*       TLS_RSA_WITH_AES_128_CBC_SHA
*       TLS_RSA_WITH_AES_128_CBC_SHA256
*       TLS_RSA_WITH_AES_128_GCM_SHA256
root@MeanMachine:/tmp# java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb11u1, mixed mode, sharing)

looks like it is not the case for the docker installation on debian 11

Here I have

TLS_AES_128_GCM_SHA256
* TLS_AES_256_GCM_SHA384
* TLS_CHACHA20_POLY1305_SHA256
* TLS_DHE_DSS_WITH_AES_128_CBC_SHA
* TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
* TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
* TLS_DHE_DSS_WITH_AES_256_CBC_SHA
* TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
* TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
* TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
* TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
* TLS_DHE_RSA_WITH_AES_256_CBC_SHA
* TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
* TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
* TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
* TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
* TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
* TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
* TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
* TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
* TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
* TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
* TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
* TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
* TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
* TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
* TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
* TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
* TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
* TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
* TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
* TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
* TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
* TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
* TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
* TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV
* TLS_RSA_WITH_AES_128_CBC_SHA
* TLS_RSA_WITH_AES_128_CBC_SHA256
* TLS_RSA_WITH_AES_128_GCM_SHA256
* TLS_RSA_WITH_AES_256_CBC_SHA
* TLS_RSA_WITH_AES_256_CBC_SHA256
* TLS_RSA_WITH_AES_256_GCM_SHA384

nothing like that in my system. So the question is how to update given list in docker installation?

Yes it appears you are missing all of the AES_256 cyphers
Where are you located ?
Is this the official openhab docker image or is it something you created custom?

Not sure how this might help, but I’m EU based. I’ve pulled the official openhab docker image from official repo on hub.docker.com.

Because of this is why I asked.
https://hub.docker.com/r/openhab/openhab/#java-cryptographic-strength-policy

Java cryptographic strength policy

Due to local laws and export restrictions the containers use Java with a limited cryptographic strength policy. Some openHAB functionality may depend on unlimited strength which can be enabled by configuring the environment variable CRYPTO_POLICY=unlimited

Before enabling this make sure this is allowed by local laws and you agree with the applicable license and terms (see OpenJDK (Cryptographic Cautions)).

The following functionality depends on the unlimited cryptographic strength policy:

  • KM200 Binding
  • Linky Binding
  • Loxone Binding
  • MQTT Binding
  • openHAB Marketplace

Parameters

1 Like

Thank you for pointing me for given detail - I was totaly unaware of such restriction. I’ve recreated the docker image with setup the env CRYPTO_POLICY=unlimited and it looks like it solved the problem.

Solution I’ve posted above worked for only for limited time where solax didn’t alight their services accordingly.

Funny is that http biding is not mention among the ones which depends on cryptographis strenght policy.

Thank you once more time.

Y

I would assume that there are more bindings. Depending on the server side all bindings that make use of encryption are potentially affected.

I would guess so too - like every single one using TLS connection :slight_smile: