Repository navigation
Default to true for options.encrypt - #694
arthurschreiber wants to merge 3 commits into
Conversation
|
On a side note, while updating the documentation, remember to update the requirements for older versions of SQL Server. |
|
@v-suhame Thanks for reminding me! We probably should support this out-of-the box. I read the documentation you linked to in #610. From what I understand, SQL Server supports ciphers based on the operating system it is running on. In the case of SQL Server 2008 running on Windows Server 2003, the list looks like this:
None of these ciphers is accepted by newer Node versions, as their security is rather questionable. According to https://wiki.mozilla.org/Security/Server_Side_TLS, the only cipher out of this list that might be used for backwards-compatibility without totally compromising security is This specific suite can be enabled by using I think we can make tedious inform the user more thoroughly when the encryption handshake fails, and let them know that potentially the cipher suite configuration they're using is too strict? I'd rather not include that cipher by default (because of security implications), but the current behaviour is pretty opaque and unfortunate from a user experience perspective. |
👍 to this. It will be more helpful than putting them on GitHub Pages. Right now, there is no error thrown if handshake fails due to incompatible cipher suite. Error gets thrown at the later phase during prelogin and its totally unrelated to the root of failure (error msg). So yes, it would be super helpful if right message is thrown at right place. |
It's actually worse than that. If the handshake fails, the server side closes the socket, and tedious does not report any error whatsoever. 😞 I think we need to re-visit handling of sockets that get closed from the server side before tedious has entered the |
|
I'm not sure if there are other ways to verify the socket closed on server side, apart from sending data/packet to it 🤔 |
|
I think you just need to look into how socket close, end and error events are being handled. As long as these events are handled correctly in all states of the TDS state machine, server closing the socket will just fold into one of those... I think :-) |
|
Hey @tvrprasad 👋 |
I think it does, as well. At least I had a POC that could detect the handshake failed by listening to the socket |
|
What's the feasibility issue? |
|
😕 Let me re-iterate what is happening, to see if we are on the same page : So, we should find a way to let the user know about handshake failure. Isn't that what we are looking at? |
I don't think that's what is happening. See the handler here Lines 956 to 970 in 76c7d06 If the |
|
The close event actually happens after
log is from simple code: connection.on('debug', function(text) {
console.log('--log :', text);
});
connection.on('connect', function (err) {
if (err) { console.log('Error Caught in connect callback: ', err) }
});
As you can see from the logs, |
|
Mh, that is weird. I'll try to dig up the test example where I've run into this. |
7f0147a to
02a24e0
Compare
options.encrypt handlingtrue for options.encrypt
|
@Suraiya-Hameed @tvrprasad I figured out what was causing these issues! The SSL/TLS implementation on older Windows versions is buggy and does not handle the countermeasures against the BEAST attack that were put into OpenSSL well. (OpenSSL inserts empty fragments to fix the exploit). This caused the connection process to hang during the TLS/SSL handshake forever, which then lead to the connection timeout. Fortunately, there is an option to disable the countermeasure, which in turn fixes connecting to SQLServer instances that still use that buggy SSL/TLS implementation. 🎉 I'll open a separate PR for the fix, and then we can re-evaluate changing this option. |
|
I opened (and merged) #820, so we can move forward with this PR now. |
BREAKING CHANGE: If no `encrypt` setting was specified before, `tedious` would fall back to not using any encryption by default. This changes the default to encrypt connections unless `encrypt` is explicitly set to `false`. This _should_ work without issues with most SQL Server setups, but might cause connections to fail if encryption between `tedious` and SQL Server can not be established.
eeb4326 to
61d51fc
Compare
|
This was part of #864. |
This changes the default of
options.encryptfromfalsetotrue, effectively switching on connection encryption unless explicitly turned off.It also makes the type checking of the
options.encryptvalue stricter, only acceptingbooleanvalues.Both of these changes are breaking backwards compatibility. The plan is to deprecate the current behaviour, and then later release these changes on a major version bump.
Fixes #606.