Skip to content

Unable to establish SSL connection to windows Upsd #364

@bitmk2

Description

@bitmk2

Windows upsd.exe output

C:\Program Files (x86)\NUT\sbin>upsd -DDDDDDDDD
Network UPS Tools upsd Windows-v2.6.5-5-7-g72f380c
0.000000 listen_add: added 0.0.0.0:3493
0.000000 setuptcp: try to bind to 0.0.0.0 port 3493
0.000000 listening on 0.0.0.0 port 3493
0.125129 Connected to UPS [Apc550]: usbhid-ups-Apc550
0.125129 user_add_action: adding 'login' for slaveuser
0.125129 user_add_action: adding 'login' for masteruser
0.125129 user_add_action: adding 'master' for masteruser
0.125129 user_add_action: adding 'fsd' for masteruser
0.125129 mainloop: wait for 3 filedescriptors
0.125129 mainloop: wait for 3 filedescriptors
0.125129 mainloop: wait for 3 filedescriptors
0.141139 mainloop: wait for 3 filedescriptors
0.141139 mainloop: wait for 3 filedescriptors
0.141139 UPS [Apc550]: dump is done
0.141139 mainloop: wait for 3 filedescriptors
2.156285 mainloop: no data available
2.156285 mainloop: wait for 3 filedescriptors
4.031593 Connect from 192.168.12.8
4.031593 mainloop: wait for 4 filedescriptors
4.031593 write: [destfd=388] [len=12] [OK STARTTLS]
4.031593 Unknown return value from SSL_accept: No error [A non-blocking socket operation could not be completed immediately. ]
4.031593 ssl_error() ret=-1 SSL_ERROR_WANT_READ
4.031593 mainloop: wait for 4 filedescriptors
4.031593 Disconnect 192.168.12.8 (read failure): No error [The system cannot find the file specified. ]
4.046593 Disconnect from 192.168.12.8
4.046593 mainloop: wait for 3 filedescriptors
6.046647 mainloop: no data available
6.046647 Pinging UPS [Apc550]
6.046647 mainloop: wait for 3 filedescriptors
6.046647 Got PONG from UPS [Apc550]
6.046647 mainloop: wait for 3 filedescriptors

Windows upsmon.exe output

C:\Program Files (x86)\NUT\bin>..\sbin\upsmon.exe -D
Network UPS Tools upsmon Windows-v2.6.5-5-7-g72f380c
0.000000 UPS: Apc550@sisifos.upsd.bit.space (master) (power value 1)
0.015642 Using power down flag file C:\killpower
0.015642 debug level is '1'
0.156602 Trying to connect to UPS [Apc550@sisifos.upsd.bit.space]
Unknown return value from SSL_connect -1: No error [An established connection was aborted by the software in your host machine. ]
ssl_error() ret=-1 SSL_ERROR_SYSCALL
Can not connect to sisifos.upsd.bit.space in SSL, disconnect
0.187432 UPS [Apc550@sisifos.upsd.bit.space]: connect failed: SSL error: peer disconnected
0.187432 Communications with UPS Apc550@sisifos.upsd.bit.space lost
5.203132 Trying to connect to UPS [Apc550@sisifos.upsd.bit.space]

Linux upsmon.exe output

[root@fedora ups]# upsmon -DD
Network UPS Tools upsmon 2.7.4
0.000000 fopen /var/run/nut/upsmon.pid: No such file or directory
0.000624 Using power down flag file /etc/killpower
0.001082 UPS: Apc550@sisifos.upsd.bit.space (master) (power value 1)
0.001502 debug level is '2'
0.004422 Trying to connect to UPS [Apc550@sisifos.upsd.bit.space]
0.016949 Unknown return value from SSL_connect -1: Connection reset by peer
0.017390 ssl_error() ret=-1 SSL_ERROR_SYSCALL
0.017717 Can not connect to sisifos.upsd.bit.space in SSL, disconnect
0.018116 UPS [Apc550@sisifos.upsd.bit.space]: connect failed: SSL error: error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure
0.018461 do_notify: ntype 0x0005 (COMMBAD)
0.018790 Communications with UPS Apc550@sisifos.upsd.bit.space lost
^C 2.162006 Signal 2: exiting
2.162659 Dropping connection to UPS [Apc550@sisifos.upsd.bit.space]

ups.conf

maxretry = 1

[Apc550]
driver = usbhid-ups
port = auto
desc = "Apc 550"

nut.conf
MODE=netserver

upsd.conf

LISTEN 0.0.0.0 3493
CERTFILE "C:\\1\\upsd.pem"

upsd.pem is the standard pem file as described in http://networkupstools.org/docs/user-manual.chunked/ar01s09.html

-----BEGIN CERTIFICATE-----
.....
...
.
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
.....
...
.
-----END PRIVATE KEY-----

If I use the exact same configuration & certificate files on a linux upsd installation both linux & windows upsmon clients work fine.
If I comment-out the CERTFILE line inside the upsd.conf and the CERTVERIFY/FORCESSL in upsmon.conf then I can also connect.

So this must be a upsd SSL related bug. I used the process monitor application to investigate the "The system cannot find the file specified" error message of upsd, but could not find anything interesting.

Regards,
George

Metadata

Metadata

Assignees

No one assigned

    Labels

    SSL/NSSIssues and PRs about SSL, TLS and other crypto-related mattersWindowsimpacts-release-2.7.3-or-olderIssues reported against NUT release 2.7.3 or older, packaged or custom builds of code from that era

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions