I have ansible installed in a host with Ubuntu 22.04, from which I try to connect to a host with Windows Server 2012 R2 using winrm. The problem is that I get a connection error.
After chasing the error for several hours I found the reason:
- Using sslscan (with the
--show-sigs
option) I found that the windows host only accepts the rsa_pkcs1-sha1
Server Signature Algorithm (as far as I have investigated I understand that this algorithm is used during the key exchange and has nothing to do with the signing algorithms related to the certificate). I'm tempted to say that this is the normal behavior of Windows Server 2012 R2 but I'm not a windows expert to be certain about that.
- Ubuntu 22.04 comes with openssl 3.0.2 configured by default at seclevel 2. As far as I understand, openssl with that version and at that seclevel does not make use of any algorithm that uses SHA1. This means that, during the TLS handshake with the windows host, openssl never presents the
rsa_pkcs1-sha1
algorithm as a supported algorithm in the signature_algorithms list of the Client Hello (I confirmed this with Wireshark).
- Since the Windows Server 2012 R2 host only understands
rsa_pkcs1-sha1
, but it is not presented in the Client Hello then the only thing the host can do is to terminate the connection, leaving the following message in the Event Viewer: An TLS 1.2 connection request was received from a remote client application, but none of the cipher suites supported by the client application are supported by the server. Note that the message is kind of misleading because there is no problem with the cipher suites at all. The problem lies in the signature algorithms for the key exchange.
With this information at hand I decided to downgrade the seclevel of openssl from 2 to 0. Seclevel 0 means that openssl will behave like previous versions of openssl (which in particular allowed SHA1). I was able to confirm, using the openssl s_client
command and Wireshark, that this change allowed openssl to connect to the windows host because, at seclevel 0, openssl does in fact includes the rsa_pkcs1-sha1
algorithm in the list of signature_algorithms of the Client Hello.
The problem now is that, even with /etc/ssl/openssl.cnf
being configured at seclevel 0, ansible is still not capable of connecting to the windows host. My guess is that ansible makes use of some python wrapper of openssl that bypasses the /etc/ssl/openssl.cnf
configuration file altogether. So the question is: how can I force ansible (or python for that matter) to use openssl at seclevel 0?