Cannot renew ssl certificates, notAfter never changes [closed]

Last two days I have been trying to fix ssl certificate problem in our servers.

We have two servers A and B, I was able to connect A to B but B changed ssl certificate. They shared this key and we imported that one but when I try to connect B I am getting

$  openssl s_client -CApath /etc/ssl/certs/ -connect B:443
verify error:num=10:certificate has expired
notAfter=Sep 17 12:00:00 2021 GMT

So this is still old. Then I try to understand if I couldn't import new .crt file, and if it is sill old one.

$ openssl x509 -in B.crt -noout -dates
   notBefore=Aug  4 00:00:00 2021 GMT
   notAfter=Aug  4 23:59:59 2022 GMT

No, as you see certificate is new and valid. So I tried to use it to test connection to B.

$ openssl s_client  -connect B:443 -CAfile B.crt

But it still returns

 verify error:num=10:certificate has expired
 notAfter=Sep 17 12:00:00 2021 GMT

What should I do now?


$  openssl s_client -CApath /etc/ssl/certs/ -connect B:443
verify error:num=10:certificate has expired
notAfter=Sep 17 12:00:00 2021 GMT

So B sends an expired certificate. According to comments, they send a valid certificate when you use SNI to request the certificate for name B.

The solution is obviously to use SNI, as this is what B has tested and implemented.