Nice password ;)
Did you try restarting the agent service? (inedo.agent.exe)?
I looked again (feel free to request access as well), and compared this against the messaging protocol that we use. The error is happening during the handshake.
Now I'm starting to think that Otter isn't actually connecting to the Inedo Agent... but that other thing is sending back a different response? Normally the other thing would just disconnect, but I guess maybe not? Anyways Wireshark should tell you...
Here's the full handshake, where you can see that Otter assumes the first byte received is a valid encryption mode (0,1,2).
internal async Task SendHandshakeAsync(AgentEndpoint endpoint)
{
if (this.disposed)
throw new ObjectDisposedException(nameof(ServerConnection));
var buffer = new MemoryStream();
var writer = new BinaryWriter(buffer);
writer.Write(ProtocolGuid.ToByteArray());
writer.Write(AgentProtocolVerisons.Agent1);
writer.Write(AgentProtocolVerisons.Agent2);
try
{
var initialIV = new byte[16];
using (var cts = new CancellationTokenSource(30 * 1000))
{
await this.Stream.WriteAsync(buffer.GetBuffer(), 0, (int)buffer.Length, cts.Token).ConfigureAwait(false);
await this.Stream.FlushAsync(cts.Token).ConfigureAwait(false);
var mode = (AgentEncryptionMode)this.Stream.ReadByte();
if (mode == AgentEncryptionMode.Ssl)
{
var stream = new SslStream(this.Stream, false);
try
{
await stream.AuthenticateAsClientAsync(endpoint.HostName).ConfigureAwait(false);
}
catch (Exception ex)
{
throw new AgentConnectionException(AgentConnectionError.BadCertificate, ex.Message, ex);
}
this.Stream = stream;
}
else if (mode == AgentEncryptionMode.Aes)
{
if (endpoint.EncryptionKey == null)
throw new AgentConnectionException(AgentConnectionError.BadEncryptionKey, "The server requires an encryption key, but a key has not been configured.");
int count = await this.Stream.ReadBlockAsync(initialIV, 0, 16).ConfigureAwait(false);
if (count != 16)
throw new AgentConnectionException(AgentConnectionError.BadHandshake);
this.messageFormatter = new MessageFormatter.AesMessageFormatter(endpoint.EncryptionKey, initialIV);
}
else if (mode != AgentEncryptionMode.None)
{
throw new AgentConnectionException(AgentConnectionError.BadHandshake, "The server requires an encryption mode that is not supported by this client.");
}