Elastic agent startup fails with SSLHandshakeException

Hi,

I created an custom elastic agent based on this guide: [1]

But during startup the agent fails with an SSLHandshakeException "Remote host closed connection during handshake".

I've added the HTTPS-Certificate to java cacerts [2], but that didn't help. Maybe I just used the wrong one?

I'm using VPC. The port 26224 [3] is open on local (not AWS) firewall and the Bamboo Server is able to connect to Elastic Instance on that port.

Here the error-log from /home/bamboo/bamboo-elastic-agent.out:

2014-05-19 14:33:02,112 INFO [main] [AgentContext] Requesting fingerprint, url: httpst://127.0.0.1:46593/bamboo/agentServer/GetFingerprint.action?hostName=ip-10-207-130-98&agentType=elastic&instanceId=i-b414d5f7&version=3&agentUuid=c4541acb-0ee9-4c92-bb34-45a99800a216
2014-05-19 14:33:02,159 INFO [tunnellogger-thread] [LocalAcceptor] [tunnelserver:26224-1-thread-3] Accepted a local connection on port 46593, tunnel age: 0s
2014-05-19 14:33:02,159 INFO [tunnellogger-thread] [LocklessLogger] [tunnellogger-thread] Logging system is operating in a lockless mode
Exiting due to fatal exception.
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:702)
        at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
        at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
        at com.atlassian.bamboo.agent.bootstrap.AgentContext.initFingerprint(AgentContext.java:113)
        at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:98)
        at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:89)
        at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:93)
        at com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap.run(ElasticAgentBootstrap.java:89)
        at com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap.main(ElasticAgentBootstrap.java:56)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
        at sun.security.ssl.InputRecord.read(InputRecord.java:482)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
        ... 19 more
2014-05-19 14:33:02,334 FATAL [main] [AgentBootstrap] Exiting due to fatal exception.
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
        at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:702)
        at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
        at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
        at com.atlassian.bamboo.agent.bootstrap.AgentContext.initFingerprint(AgentContext.java:113)
        at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:98)
        at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:89)
        at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:93)
        at com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap.run(ElasticAgentBootstrap.java:89)
        at com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap.main(ElasticAgentBootstrap.java:56)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
        at sun.security.ssl.InputRecord.read(InputRecord.java:482)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
        ... 19 more

How do I get the Elastic Agent to run?

Thanx in advance

Fabian

[1] https://confluence.atlassian.com/display/BAMBOO043/Creating+a+custom+elastic+image+-+Linux

[2] /usr/bin/keytool -import -trustcacerts -keystore /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/lib/security/cacerts -alias some_alias -file /path/to/cert

[3] https://confluence.atlassian.com/display/BAMBOO/Elastic+Bamboo+Security

2 answers

I just tested the Stock AMI from Atlassian. Got the same error.

Maybe a workarround will help. Is it possible to disable the certificate check?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

40 views 2 3
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you