1
votes

When attempting to login to the TeamCity server via the Visual Studio plugin (running on Visual Studio 2015), I'm getting the following error:

Failed to connect to the server https://10.91.5.44: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

I have imported a self-signed certificate into the Java certificate store.

I can connect fine to the TeamCity admin portal as well as via the Windows tray tool and I'm looking for some direction.

Thanks.

1

1 Answers

1
votes

Ok I got this working as such:

I asked the network guy to map the TeamCity IP internally as a URL, ie: xxx-TeamCity

Then I recreated the self-signed certificate, using Portecle, setting:

CN: xxx-TeamCity

Then, I did the certificate import using keytool:

keytool -importcert -file xxx-teamcity.cer -alias teamcity -keystore c:\teamcity\jre\lib\security\cacerts

Then edited the server.xml file:

<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
    SSLEnabled="true"
    scheme="https"
    secure="true"
    connectionTimeout="60000"
    redirectPort="8543"
    clientAuth="false"
    sslProtocol="TLS"
    useBodyEncodingForURI="true"
    keystoreFile="c:\TeamCity\conf\xxx-teamcity.pfx"
    keystorePass="password123"
    socket.txBufSize="64000"
    socket.rxBufSize="64000"
    tcpNoDelay="1"
    /> 

Then I added the certificate to the trusted store on my local box, and it worked.

So the issues were: the CN didn't match the DNS entry, and the certificate was not in the trusted store (as it is a self-signed certificate).

Hope that helps somebody.