TLS Socket connection through Nodejs - facebook

Im trying to establish a TLS socket connection to chat.facebook.com port:5222 through Nodejs.
Im using the following code :
var a=require('tls');
var b=a.connect(5222,'chat.facebook.com',function(){console.log("connected");});
b.on('error',function(error){console.log(error);})
But it is not getting connected and instead giving an error :
[Error: 140089045411648:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:683:]
I have tried a similiar connection to encrypted.google.com:443 and console readily fired a "connected" .
Can someone guide me what i have been missing or what can be done to overcome this problem.

xmpp with tls uses "STARTTLS", a protocol upgrade from plaintext to encrypted. See http://xmpp.org/rfcs/rfc6120.html#tls for details.
(It means you have to send some unencrypted xml stuff first, and wait for the other end to confirm your choice to upgrade to TLS)

Related

Cannot reconnect to gRPC server after client crashed

I did a lot of research but could not find a solution for my problem with gRPC:
Summary;
After my swift gRPC client application crashes, no gRPC client can connect to my gRPC Server anymore (see errors below)
My Setup:
I have a Swift frontend application and a Rust backend.
The rust backend runs a gRPC Server (tonic) https://github.com/hyperium/tonic to which a rust client (also tonic) and a Swift client (https://github.com/grpc/grpc-swift) can connect to.
After the Swift client crashes, none of the clients can connect anymore to the server.
The rust client reports:
Error: Status { code: Cancelled, message: "h2 protocol error: protocol error: stream no longer needed" }
The swift client reports:
StreamClosed(streamID: HTTP2StreamID(1), errorCode: HTTP2ErrorCode<0x8 Cancel>, location: ".../swift-nio-http2/Sources/NIOHTTP2/HTTP2StreamChannel.swift:820")
What I've tried
I setup a http2 keepalive in the server, but that didn't do anything.
I tried to reproduce the same effect by purposefully crashing the rust client - without success.
I'm not even sure wether to look at the swift-grpc and tonic libraries or grpc itself (for me it looks like the server closes the stream on purpose)..
Has anyone an idea what i could do to fix this?
Thanks in advance!

Swift socket invalid HTTP upgrade

Good day,
I've established very simple Python server (Twisted framework) on localhost:80. It works ok with telnet - i can send and recieve simple messages. But i need to connect Swift iOS app client to this server. App running on simulator.
I'm using Socket_IO_Client_Swift framework. At this moment, i've just created socket object with "localhost:80" parameter and call connect() method on start of application.
Server can see the signal from client, but client disconnect immidietly after connection with this message:
Got event: disconnect, with items: Optional((
"Invalid HTTP upgrade"
What can i do to fix this, and what is HTTP upgrade?
Thanks

Vugen Replay Error due to certificate : SSL protocol error when attempting to connect with host

am trying to record an HTTPS application , i have recorded it with Socket level and Winlnet level data with the auto SSL detect option uncheked.Successfully created the scipt. the script was created with a default web_set_certificate_ex function. But while replaying script was failing saying "SSL protocol error when attempting to connect with host "
Also tried enabling Winlnet instead of sockets in RTS - > Preference , got an error "INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT"
GoTo Runtime settings preference and check replay in wintlet mode. it will work fine

Disconnects in FIX connections in local network

I have a FIX server and FIX client implementing FIX4.4 running on the same network. I use QuickFIX C++ engine. Altough they are on the same network, sometimes they disconnect. In the FIX server's event logs:
20140612-01:21:30.000 : Sent test request TEST
20140612-04:11:56.000 : Sent test request TEST
20140612-07:05:26.029 : Sent test request TEST
20140612-07:05:26.029 : Socket Error: An established connection was aborted by the software in your host machine.
Means HEARTBIT messages are failed to send/recv.
What can be wrong? I have a regular setup and nothing special..
Thanks
while the client connection was accepted by the server, it doesn't look like you then achieved "logon". First you connect, then you logon. You need to make a logon request after you connect. Look at the initial FIX messages sent between client and server.

how to Manipulate Handshake message in TLS/SSL in JAVA JSSE?

I want to know is if we can handle messages handshake SSL / TLS in Java code, in other words in the query ClientKeyExchange is if we can manipulate or select the key that will be sent to the server?
Yes, if you install a KeyManager that does what you want in the SSLContext you get the socket from. See the JSSE Reference Guide.