Joining realm failed: libcurl failed to execute the HTTP POST transaction, explaining: Unable to communicate securely with peer: requested domain name does not match the server's certificate.
that's your problem right there, your server certificate does not match the server dnsname.
Why are you not using autodiscovery and forcing to use this server?