Skip to content

Unknown return value from SSL_accept: Success on ARM when using upsc from another ARM Linux box. #1899

Closed

Description

@Idorobots

Hi,

One of the boxes is a WD NAS runinng NUT 2.6.4 (I can't really upgrade it, and WD seems pretty conservative in terms of their updates). The other one is an RaspberryPi running ARM Linux and the latest NUT 2.8.0.
When connecting from WD NAS to the Pi with upsc -l <ip-of-pi> I'm getting:

Apr 04 10:07:58 PiWM upsd[4100]: listening on * port 3493
Apr 04 10:07:58 PiWM nut-server[4100]: Connected to UPS [usbhid]: usbhid-ups-usbhid
Apr 04 10:07:58 PiWM upsd[4100]: Connected to UPS [usbhid]: usbhid-ups-usbhid
Apr 04 10:07:58 PiWM nut-server[4100]: Running as foreground process, not saving a PID file
Apr 04 10:07:58 PiWM upsd[4100]: Running as foreground process, not saving a PID file
Apr 04 10:09:15 PiWM nut-server[4100]: Unknown return value from SSL_accept: Success
Apr 04 10:09:15 PiWM upsd[4100]: Unknown return value from SSL_accept: Success

On the WD NAS side I'm getting the following error after a considerable delay:

Error: SSL error: error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure

That's a recent-ish development as the setup used to work up to some unspecified point in the past (I'm not sure when exactly it stopped working, as I only noticed today that the NAS didn't connect anymore).
The other commands such as upscmd do work correctly, so this seems to only affect upsc to the best of my knowledge.

I tried regenerating the cert file according to the docs in case it was an expired cert, but that's not it. Similarly, fiddling with DISABLE_WEAK_SSL didn't yield any results.

I think this might be related to: #246 and #202

I'm not sure what else to try other than downgrading the server on the Pi and seeing at which point it starts working. Any pointers?

Activity

  1. added
    SSL/NSS
    on Apr 4, 2023
  2. Idorobots commented on Apr 4, 2023

    @Idorobots
    Author

    With debugging enabled it sheds some more light. With DISABLE_WEAK_SSL:

    Apr 04 10:44:48 PiWM nut-server[4180]:  386.698567        [D2] Connect from 192.168.1.247
    Apr 04 10:44:48 PiWM nut-server[4180]:  386.698797        [D2] mainloop: polling 3 filedescriptors
    Apr 04 10:44:48 PiWM nut-server[4180]:  386.699183        [D2] write: [destfd=6] [len=12] [OK STARTTLS]
    Apr 04 10:44:48 PiWM upsd[4180]: [D2] Connect from 192.168.1.247
    Apr 04 10:44:48 PiWM upsd[4180]: [D2] mainloop: polling 3 filedescriptors
    Apr 04 10:44:48 PiWM upsd[4180]: [D2] write: [destfd=6] [len=12] [OK STARTTLS]
    Apr 04 10:44:48 PiWM nut-server[4180]:  386.705333        Unknown return value from SSL_accept: Success
    Apr 04 10:44:48 PiWM nut-server[4180]:  386.705539        [D1] ssl_error() ret=-1 SSL_ERROR 1
    Apr 04 10:44:48 PiWM nut-server[4180]:  386.705697        [D1] ssl_debug: error:0A000102:SSL routines::unsupported protocol
    Apr 04 10:44:48 PiWM nut-server[4180]:  386.705820        [D2] mainloop: polling 3 filedescriptors
    Apr 04 10:44:48 PiWM upsd[4180]: Unknown return value from SSL_accept: Success
    Apr 04 10:44:48 PiWM upsd[4180]: [D1] ssl_error() ret=-1 SSL_ERROR 1
    Apr 04 10:44:48 PiWM upsd[4180]: [D1] ssl_debug: error:0A000102:SSL routines::unsupported protocol
    

    With weak SSL enabled:

    Apr 04 10:49:14 PiWM nut-server[4241]:    4.165800        [D2] Connect from 192.168.1.247
    Apr 04 10:49:14 PiWM nut-server[4241]:    4.166029        [D2] mainloop: polling 3 filedescriptors
    Apr 04 10:49:14 PiWM nut-server[4241]:    4.166383        [D2] write: [destfd=6] [len=12] [OK STARTTLS]
    Apr 04 10:49:14 PiWM upsd[4241]: [D2] Connect from 192.168.1.247
    Apr 04 10:49:15 PiWM nut-server[4241]:    4.173485        Unknown return value from SSL_accept: Success
    Apr 04 10:49:15 PiWM nut-server[4241]:    4.173813        [D1] ssl_error() ret=-1 SSL_ERROR 1
    Apr 04 10:49:15 PiWM nut-server[4241]:    4.173964        [D1] ssl_debug: error:0A000076:SSL routines::no suitable signature algorithm
    Apr 04 10:49:15 PiWM nut-server[4241]:    4.174076        [D2] mainloop: polling 3 filedescriptors
    Apr 04 10:49:14 PiWM upsd[4241]: [D2] mainloop: polling 3 filedescriptors
    Apr 04 10:49:14 PiWM upsd[4241]: [D2] write: [destfd=6] [len=12] [OK STARTTLS]
    Apr 04 10:49:14 PiWM upsd[4241]: Unknown return value from SSL_accept: Success
    Apr 04 10:49:14 PiWM upsd[4241]: [D1] ssl_error() ret=-1 SSL_ERROR 1
    Apr 04 10:49:14 PiWM upsd[4241]: [D1] ssl_debug: error:0A000076:SSL routines::no suitable signature algorithm
    

    Seems like it was the cert after all, but it's odd, since both the new and the old cert used SHA256, which should be supported on the old client no problem:

    # find -name '*.crt' | while read line; do openssl x509 -in $line -noout -text; done | grep 'Signature Algorithm'
            Signature Algorithm: sha256WithRSAEncryption
        Signature Algorithm: sha256WithRSAEncryption
            Signature Algorithm: sha256WithRSAEncryption
        Signature Algorithm: sha256WithRSAEncryption
    
  3. jimklimov commented on Apr 4, 2023

    @jimklimov
    Member

    I wonder if it is a similar issue as with older SSH clients not connecting to newer servers unless you enable obsoleted KEX algorithms on one or both sides... at least, the SSL library versions do provide default lists of algorithms etc. and remove insecure options over time at least from what is offered (implementations may still exist, just have to be enabled somehow).

    Potentially, you can try building custom NUT (in an RPi container? on another PC for the sake of test?) against an older openssl release (0.9.x maybe?) to see if the sides would magically begin to talk. If yes, that's the culprit and we'd need to find a way (possibly create and PR one) to enable old security protocols on demand...

  4. jimklimov commented on Apr 4, 2023

    @jimklimov
    Member

    Alternatively, if this is in a trusted LAN, you might forgo SSL... not a generally good idea (better discover and fix what is broken), but at least a fallback option...

  5. Idorobots commented on Apr 4, 2023

    @Idorobots
    Author

    Thank's for the tips!
    I dug way deeper into OpenSSL than I ever wanted to, but I managed to "fix" this.
    This comment contains the requisite changes for OpenSSL that allow using weaker ciphers in TLS1. For posterity:

    --- a/etc/ssl/openssl.cnf
    +++ b/etc/ssl/openssl.cnf
    @@ -52,13 +52,6 @@ tsa_policy3 = 1.2.3.4.5.7
     
     [openssl_init]
     providers = provider_sect
    +ssl_conf = ssl_sect
    +
    +[ssl_sect]
    +system_default = system_default_sect
    +
    +[system_default_sect]
    +CipherString = DEFAULT@SECLEVEL=0
     
     # List of providers to load
     [provider_sect]

    Do note that this is a bad idea as these weaker ciphers were disabled for a reason. If you can manage, do update the older client to a more recent version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SSL/NSSdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions