You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Connection when both "Force Enryption" and "Extended Protection" are active #963
I'm trying to connect to a SQL Server (2012) using Windows Authentication where both Force Enryption is set to true and Extended Protection is set to required.
What I'm getting on the Client side is:
Login failed. The login is from an untrusted domain and cannot
be used with Windows authentication.
ClientConnectionId:<redacted>
Server side:
SSPI handshake failed with error code 0x80090346, state 46 while
establishing a connection with integrated security; the connection
has been closed. Reason: The Channel Bindings from this client are
missing or do not match the established Transport Layer Security (TLS)
Channel. The service might be under attack, or the data provider
or client operating system might need to be upgraded to support
Extended Protection. Closing the connection. Client's supplied SSPI
channel bindings were incorrect
[CLIENT: <redacted>]
I've tried many different configuration options (client side) including:
sslProtocol all options
trustStore alongside trustStorePassword with a self signed cert
trustServerCertificate
serverSpn alongside corresponding server setting
encrypt
All results in the same error combination. OS instances are identical on Windows Sever 2012 R2 latest SP.
Just to put myself better on this, the error you are receiving "The login is from an untrusted domain and cannot be used with Windows authentication" is coming due to lack of configuration on client side.
From the links above, you may wanna check
if extended protection is enabled by setting the value of the registry key HKLM\System\CurrentControlSet\Control\LSA\SuppressExtendedProtection to 0 on Client OS.
if SPN as provided in serverSPN connection property is registered in <extendedProtection> section of ApplicationHost.config file on server.
Since you are working with Kerberos negotiation, it is expected to be supported by default, further configuration for LmCompatibilityLevel may not be mandatory.
On the contrary, please also confirm:
Connection succeeds on disabling Extended Protection on Server and Kerberos setup is done properly.
What happens if a test application attempts connection from the same OS where SQL Server is present.
Please also provide your connection string with repro code if possible in a standalone Java class.
Using this Connection String jdbc:sqlserver://192.168.56.101:1433;serverSpn=MSSQLSvc/WIN-097Q29SOILR.corp.michi.com:1433;integratedSecurity=true;authenticationScheme=JavaKerberos;trustServerCertificate=true
Force Enryption is set to false --> Successful connection
Force Enryption is set to false --> Errors happen as seen above
I've checked the Kerberos setup using the Kerberos config tool and also registered the registry key HKLM\System\CurrentControlSet\Control\LSA\SuppressExtendedProtection to 0
I'll try to reproduce this in my environment, as I'm not entirely sure if this is a configuration problem or something else. Let me know if you have any pointers to problem root cause.
On the contrary, if you face any problems with Certificate validation, you may try to provide "trustServerCertificate=true" in connection and can avoid setting any TrustStore.
Ok, looks like I am able to reproduce the error now, but the issue isn't dependent on Force Encryption Turned On/Off but on Extended Protection when set to "Required" on SQL Server Instance configuration window.
Anyways, I'll investigate more into it and let you know soon!
Upon investigations I discovered that in order to work with both Extended Protection and Encryption on Connection, client needs to supply Channel Binding which is accomplished by the client transferring the SPN and the CBT to the server in a tamperproof fashion. In absence of which server will not accept any requests from client. More details can be found here.
As of now, the driver does not implement Channel Binding and thus this combination of Extended Protection + Force Encryption during connection is not supported. Turning one of them OFF will result in a successful connection, as you must have figured out too.
I stumbled across this issue as well. A pity that it is now waiting on external factors.
Please clarify: I have tested with the following configs at the server:
Force Encryption: On; Exteded Protection:Required ---> Error (as detailed above)...was to be expected
Force Encryption: On; Extended Protection: Allowed --> Same error ...why?
Force Encryption: On; Extended Protection: Off --> works without error
Why is Extended Protection: Allowed not possible? AFAIK this is the setting at the server side which does not enforce Extended Protection.
Java is missing public APIs that allow channel binding to be implemented. The POC described above was accomplished via methods that are not suitable to production-level code.
Bernd (@ecki) Yeah, we've considered that as an option, but for now even with support from the Microsoft Java team I don't see the openjdk team consenting to the required Java API changes to make this happen as these types of changes were requested in the past.
Force Encryption: On; Extended Protection: Allowed --> Same error ...why?
martin-guth thats indeed problematic, I suspect the SSPI on the client think it can/should negotiate it and then Java does not add the token therefore corrupting the handshake which the server uses to abort. Would maybe a good idea to filter it out in the driver so it does not get negotiated.
I would actually relabel the Issue from 'Enhancement' to 'Security Issue' as we are forced to downgrade the complete Instance, because if just 1 Client still can't use Channel binding nowadays, all other clients have to use the downgraded security as well.
Unfortunately we don't have a timeline to address this as this feature is still currently blocked by a lack of TLS APIs in Java required to implement it.
We did work on this in a feature branch where we worked around this using reflection (channel-bindings) or Bouncy Castle (channel-bindings-bc) . These are not official solutions they will not be merged however you are welcome to take a look and build a version of the driver for your needs but please be aware this is not something that we officially support. Until there is a proper API available in Java this will not be something that will be supported in the driver.
If the driver Not yet accept Channel binding, it should not propose it (i.e. Filter the Bit out in the negotiation message), otherwise the opportunistic („allowed“) setting does not work.
Activity
cheenamalhotra commentedon Feb 14, 2019
Hi michaelenglert
Please confirm if Client (Windows Server 2012 R2 in your case) has enabled Extended Protection support.
This blog will be worth looking into on how to enable it:
https://blogs.technet.microsoft.com/srd/2009/12/08/extended-protection-for-authentication/
More details about Windows Update required for Extended Protection support: https://support.microsoft.com/en-us/help/973917/description-of-the-update-that-implements-extended-protection-for-auth
michaelenglert commentedon Feb 14, 2019
Hi Cheena Malhotra (@cheenamalhotra),
confirmed as this is enabled by default in Windows Server 2012 R2.
cheenamalhotra commentedon Feb 14, 2019
Just to put myself better on this, the error you are receiving "The login is from an untrusted domain and cannot be used with Windows authentication" is coming due to lack of configuration on client side.
From the links above, you may wanna check
serverSPNconnection property is registered in<extendedProtection>section of ApplicationHost.config file on server.Since you are working with Kerberos negotiation, it is expected to be supported by default, further configuration for LmCompatibilityLevel may not be mandatory.
On the contrary, please also confirm:
Please also provide your connection string with repro code if possible in a standalone Java class.
michaelenglert commentedon Feb 14, 2019
thanks for helping Cheena Malhotra (@cheenamalhotra)
Using this Connection String
jdbc:sqlserver://192.168.56.101:1433;serverSpn=MSSQLSvc/WIN-097Q29SOILR.corp.michi.com:1433;integratedSecurity=true;authenticationScheme=JavaKerberos;trustServerCertificate=trueForce Enryptionis set tofalse--> Successful connectionForce Enryptionis set tofalse--> Errors happen as seen aboveI've checked the Kerberos setup using the Kerberos config tool and also registered the registry key
HKLM\System\CurrentControlSet\Control\LSA\SuppressExtendedProtectionto0cheenamalhotra commentedon Feb 14, 2019
Hi michaelenglert
I hope you wanted to mention error occurs if Force Encryption is set to true and are you not passing
encrypt=truein connection string?michaelenglert commentedon Feb 15, 2019
Hi Cheena Malhotra (@cheenamalhotra)
I'm sorry. I lost track of all the different setups. Same error happens also with
encrypt=trueinmichaelenglert commentedon Feb 20, 2019
Hi Cheena Malhotra (@cheenamalhotra) it would be great if you have another hint for me :-)
cheenamalhotra commentedon Feb 20, 2019
Hi michaelenglert
I'll try to reproduce this in my environment, as I'm not entirely sure if this is a configuration problem or something else. Let me know if you have any pointers to problem root cause.
michaelenglert commentedon Feb 21, 2019
that would be awesome Cheena Malhotra (@cheenamalhotra) there is not much I did on the setup. Here's what I did on the Server side:
Extended Protectionfor SQL Server toRequiredForce Encryptionfor SQL Server toYes- if set noNoit worksOn the Client Side I tried/used:
serverSpn=serverSpnintegratedSecurity=trueauthenticationScheme=JavaKerberostrustServerCertificate=trueencrypt=truetrustStore=storeNametrustStorePassword=storePasswordcheenamalhotra commentedon Feb 22, 2019
Thanks michaelenglert for the details.
Out of curiosity, have you tried to connect with any of the other SQL Server drivers?
cheenamalhotra commentedon Feb 25, 2019
Hi michaelenglert
I configured Force Protocol Encryption + Extended Protection on SQL Server 2012 and am able to connect using Kerberos.
I could connect with below properties set using
SQLServerDataSource.Also, it works without adding
ds.setAuthenticationScheme("JavaKerberos");as default Negotiation is set to Kerberos.cheenamalhotra commentedon Feb 25, 2019
I followed same steps defined in https://blogs.technet.microsoft.com/srd/2009/12/08/extended-protection-for-authentication/ for configuring Client and Server. No extra configurations were needed.
On the contrary, if you face any problems with Certificate validation, you may try to provide "trustServerCertificate=true" in connection and can avoid setting any TrustStore.
cheenamalhotra commentedon Feb 26, 2019
Ok, looks like I am able to reproduce the error now, but the issue isn't dependent on Force Encryption Turned On/Off but on Extended Protection when set to "Required" on SQL Server Instance configuration window.
Anyways, I'll investigate more into it and let you know soon!
cheenamalhotra commentedon Feb 27, 2019
Hi michaelenglert
Upon investigations I discovered that in order to work with both Extended Protection and Encryption on Connection, client needs to supply Channel Binding which is accomplished by the client transferring the SPN and the CBT to the server in a tamperproof fashion. In absence of which server will not accept any requests from client. More details can be found here.
As of now, the driver does not implement Channel Binding and thus this combination of Extended Protection + Force Encryption during connection is not supported. Turning one of them OFF will result in a successful connection, as you must have figured out too.
32 remaining items
martin-guth commentedon Aug 24, 2023
I stumbled across this issue as well. A pity that it is now waiting on external factors.
Please clarify: I have tested with the following configs at the server:
Why is Extended Protection: Allowed not possible? AFAIK this is the setting at the server side which does not enforce Extended Protection.
David-Engel commentedon Aug 24, 2023
Java is missing public APIs that allow channel binding to be implemented. The POC described above was accomplished via methods that are not suitable to production-level code.
user1oc commentedon Jan 31, 2024
Hi are there any updates on this issue?
As per the last comment from David Engel (@David-Engel) and Terry Chow (@tkyc), this feature was put on hold.
David-Engel commentedon Jan 31, 2024
user1oc No new updates. Lack of appropriate public Java APIs is still a blocker for this issue. I don't see that changing any time soon.
ecki commentedon Feb 2, 2024
BTW it’s also an issue for http and ldap and really needs reconsideration on openjdk level. Maybe escalate it to the Microsoft Java team?
tkyc commentedon Feb 2, 2024
Bernd (@ecki) Yeah, we've considered that as an option, but for now even with support from the Microsoft Java team I don't see the openjdk team consenting to the required Java API changes to make this happen as these types of changes were requested in the past.
ecki commentedon Feb 2, 2024
martin-guth thats indeed problematic, I suspect the SSPI on the client think it can/should negotiate it and then Java does not add the token therefore corrupting the handshake which the server uses to abort. Would maybe a good idea to filter it out in the driver so it does not get negotiated.
postfach33 commentedon Oct 4, 2024
I would actually relabel the Issue from 'Enhancement' to 'Security Issue' as we are forced to downgrade the complete Instance, because if just 1 Client still can't use Channel binding nowadays, all other clients have to use the downgraded security as well.
ADror-Quest commentedon Jan 27, 2025
any update on when this will be fixed?
lilgreenbird commentedon Jan 29, 2025
hi Anat Dror (@ADror-Quest)
Unfortunately we don't have a timeline to address this as this feature is still currently blocked by a lack of TLS APIs in Java required to implement it.
We did work on this in a feature branch where we worked around this using reflection (channel-bindings) or Bouncy Castle (channel-bindings-bc) . These are not official solutions they will not be merged however you are welcome to take a look and build a version of the driver for your needs but please be aware this is not something that we officially support. Until there is a proper API available in Java this will not be something that will be supported in the driver.
ecki commentedon Feb 2, 2025
If the driver Not yet accept Channel binding, it should not propose it (i.e. Filter the Bit out in the negotiation message), otherwise the opportunistic („allowed“) setting does not work.
postfach33 commentedon Jan 20, 2026
any update on when this will be fixed?