which side will initiate the version negotiation in the SSH transport layer protocol? - ssh

In the SSH transport layer protocol specification, http://www.ietf.org/rfc/rfc4253.txt, section "4.2. Protocol Version Exchange", it says, "When the connection has been established, both sides MUST send an identification string.".
but it doesn't define which side shall initiate this process, the server side or the client side?
here are some observations,
In http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_12-4/124_ssh.html, "Figure 2: SSH Transport Layer Protocol Packet Exchanges", the client side initiate the exchange process.
I tried using JSCH as client to connect server, and here is the snapshot. the server side send the SSH Protocol version first.
And here is one issue, both JSCH and SSH server doesn't send Protocol version.
The TCP connection is setup in package 93, 94, 95. And after 5 seconds, the server side close the connection in package 99.
can you help figure out why both client and server doesn't send out the protocol version? thanks a lot!
Regards,
Joey

Yes, we had found that some cisco box does not send its version string
without receiving the client's version string.
The recent jsch version will send it immediately.

but it doesn't define which side shall initiate this process, the server side or the client side?
Correct. As both sides must send it, and neither is defined as a response to the other, it is irrelevant who does so first.

Related

Mule error "Remote host closed connection. Possible SSL/TLS handshake issue." on HTTP request

I would like to seek for your advice if you have any idea or you have already encountered this issue “SSL/TLS handshake Issue” ?
To give you a summary, we’re getting an error the error below when connecting to Coupa (ERP) through HTTP.
Remote host closed connection. Possible SSL/TLS handshake issue. Check protocols, cipher suites and certificate set up. Use -Djavax.net.debug=ssl for further debugging.
We have several HTTP requests using the same HTTP config, but there’s this only one specific request that gives the said error. Also, this HTTP request works in postman. This occurs only in one Mule environment (UAT Environment). It works fine in our sandbox environment.
We are not sure whether the SSL connection/Handshake is closed on our end or server end.
If ever its on our end, how do we identify the fix for that?
If it’s on the server end, what should be the proof that we need to provide to them to say that the issue is on their end.
The server -Coupa in this case- is closing the connection just after it was opened by the client -a Mule application- probably before the client can send the HTTP request. The server could do this by any of a number of causes and the client does not receive any error messages or codes to indicate a reason. You will need to learn the reason from the server side.
Usual reasons are because an HTTPS connection doesn't match thee required ciphers suites or protocol versions accepted by the server, or because the client IP is not whitelisted. In those situations documentation from what's acceptable to the server side is useful. There could some other reasons that are known only to the server side.
A method to troubleshoot TLS connection issues is to do a traffic capture of the TCP packets, ideally from both sides, but if you don't control the server it will be only possible from the client. Another option if you are using HTTPS is to enable Java SSL Debug log in the Mule runtime to print the HTTPS connection information. You need to understand how to troubleshoot TLS to use these tools.

Does SSH protocol version exchange order matter?

I understand that the server will send its SSH version and the client will do the same. What I am wonder is if the order matters.
Additionally, I'm wondering if I could make an SSH server receive an SSH version from a client before sending its own version?
The order of the SSH protocol version exchange is unspecified; it says:
When the connection has been established, both sides MUST send an
identification string. This identification string MUST be
SSH-protoversion-softwareversion SP comments CR LF
The RFC is likely silent on the protocol version exchange order because, practically speaking, it's a race and the order should not matter. When the client's TCP connect is accepted by the server, the client and server send their version information...who gets to the other first is just a matter of speed, traffic, etc.
As a client, you cannot (or should not be able to...) "make" the server wait; it's certainly possible that a particular server implementation waits for client before sending its own information but that's a server implementation detail.
You can Wireshark the SSH connection and see the communication at the TCP level. The SSH client will send its Protocol version first before the server.
I don't think you have the flexibility to change the order of communication. With my SSH client (OpenSSH_8.1p1, LibreSSL 2.7.3) I could see that once SYN-ACK is done, the server is waiting for the SSH client to send it's supported protocol version.
You cannot change the order of the protocol in this case; it's fixed in the RFC, and the order does indeed matter. The server sends its version as part of the opening request, and then the client sends its version. Afterward, the two sides exchange a list of algorithms supported by both sides, and the selected algorithm is generally the first one the client supports that's also supported by the server.
While you cannot change the protocol version number announcement, you can, based on the version that the client has sent, choose to offer different algorithms. For example, some versions of OpenSSH incorrectly implemented curve25519-sha256#libssh.org, so a server which knows about this may choose not to offer that algorithm to a broken version of OpenSSH. Similarly, the client can announce different algorithms to the server based on the server's version announcement.

FTPS client procedure for data connection

I am developping a FTPS client in a Embedded system with LWIP and mbedTLS stacks.
For now, what I do is :
Get an IP adress with DHCP
Get IP address of the server with DNS
Start a TCP connection to the server ( the control connection)
Telling the FTP server that I want to work with the TLS protocol with the command AUTH TLS
Handshake of the TLS protocol with the server
Validate the x509 certificate that the server sends
Telling the client that I want to work in passive mode and that i want to read a file with the command RETR.
Now, I need to open a data connection to read my file. So what I wanted to know is does the data connection is secured in the same way the control connection is ? That means do I have a certificate to validate ? Is the handshake the same ?
If this isn't clear let me know i'm not an expert at all in this area.
Thank you for your future responses
In explicit FTPS connection after you send AUTH command, the data connection is secured all the way. Depending on Active/Passive connection the data connection is opened through port 20(Active) or some random port negotiated(Passive).
You don't need any extra handshakes as far as I know.
You might or might not be able to configure if you want to reuse the same session ID created in opening the control channel. This is related for server to know that data connection has been established by the same client which opened the control channel. Some server require this, some servers allow this, some servers does not support this.

Enable TLS1.2 communication for webapplication and database server calls

We have an application running on windows 2012 R2 OS with 4.6 framework and database as SQL server 2012. Due to security concerns we were asked to enable TLS1.2 protocol for the calls made between application server to database server and vice versa. I have followed below URL and we have all patches installed.
https://support.microsoft.com/en-us/help/3135244/tls-1-2-support-for-microsoft-sql-server.
Our front end application doesnt directly call the database instead we have WCF service in between front end application (asp.net) and SQL server. I read in an article we can achieve this without making changes to the code and change the providername ="SQLNCI11". When i change the provider name like below i am getting error. saying that "Unable to find the requested .Net Framework Data Provider"
Data Source=servername;Initial Catalog=DBname;uid=XXX;pwd=XXXX;Connect Timeout=200;MultipleActiveResultSets=True;Current Language=us_english; providername="SQLNCI11"
I have verified machine.config and i dont find DBproviderfactory for SQL native client.Am i missing anything here?
As an alternative, Without changing provider name in connection string i have added Encrypt=true;TrustServerCertificate=true in connection string
Data Source=servername;Initial Catalog=DBname;uid=XXX;pwd=XXXX;Connect Timeout=200;MultipleActiveResultSets=True;Current Language=us_english; Encrypt=true;TrustServerCertificate=true providername="System.Data.SqlClient"
After making above changes in connection string database call was success and when i see Ethernet communication using wireshark tool, database to WCF service communication is made with TDS protocol and TLS is involved according to wireshark tool. If i remove "Encrypt=true;TrustServerCertificate=true" from connection string then i dont see "TLS Exchange" message.
What steps should I need to take to ensure the application use TLS 1.2 protocol to communicate with the database? and also please suggest how to prove this communication.
One year later, I wanted to assess the same thing - knowing exactly what TLS version is in use for my MS SQL traffic.
Actually TLS is encapsulated in TDS when it comes to MS SQL traffic.
You can see TDS header (starting by 0x12 - higlighted in yellow in the picture).
After this header begins the TLS packets and you can check version by looking at 2nd and 3rd TLS packets.
In my example, 0x03 0x03 stands for TLS 1.2 (3rd version of TLS protocol)

Testing TLS security in WCF-netTCPBinding

I'm developing a client/server Winforms application. Clients connect to server using internet and use WCF's netTCPBinding to talk to server.
Communicating in a secure channel is very important for me and since NetTCP binding is secured by default with TLS, it seems like I don't have to do anything. Do I?
How can I monitor the encrypted data sent/received between my client/server in localhost? I used RawCap to capture data and opened the dump file in Wireshark. But I don't know how I should check for TLS security in packets. dump file is full of unkown TCP packets (not from my software) with vcom=tunnel info for most of them.
TCP binding security element is set to Transport by default. This indicates requirement that transport session must be encypted. If you cannot establish TLS session service will reject the call.
You can use something like TCPMon which will show TLS traffic albeit encrypted. Also there is SSLDump