Bug 561175 - Native support for proxy authentication schemes Negotiate (Kerberos) and/or NTLMv2 required
Summary: Native support for proxy authentication schemes Negotiate (Kerberos) and/or N...
Status: NEW
Alias: None
Product: ECF
Classification: RT
Component: ecf.filetransfer (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: ecf.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 561223 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-03-17 04:07 EDT by phorcys CLA
Modified: 2023-11-16 17:18 EST (History)
6 users (show)

See Also:


Attachments
Screenshot - Check for Update - Proxy Authentication Error (64.31 KB, image/png)
2020-03-17 04:07 EDT, phorcys CLA
no flags Details
See Comment #9. (19.12 KB, image/png)
2020-05-18 05:51 EDT, phorcys CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description phorcys CLA 2020-03-17 04:07:51 EDT
Created attachment 282125 [details]
Screenshot - Check for Update - Proxy Authentication Error

If I set up a proxy in Windows System Preferences that supports the, and only the, authentication schemes Negotiate (Kerberos) and NTLMv2 (in that exact order), Eclipse will automatically detect it, but the "Check for Update" function will not work correctly (see screenshot). The following error appears for many update sites:

HTTP Proxy Authentication Required

When can we expect native support for the above proxy authentication schemes in future Eclipse releases?
Comment 1 Thomas Wolf CLA 2020-03-17 04:24:52 EDT
I don't think NTLM should be supported. Microsoft themselves discourage using it and state in their NTLM specification[1]: "applications are generally advised not to use NTLM". ([MS-NLMP] - v20190923 NT LAN Manager (NTLM) Authentication Protocol, 23 Sep 2019.)

If you want to use NTLM, try the cntlm proxy.

[1] https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/b38c36ed-2804-4868-a9ff-8dd3182128e4
Comment 2 phorcys CLA 2020-03-17 04:47:47 EDT
Ok, thanks, and what about the native support of Negotiate (Kerberos)?
Comment 3 Rolf Theunissen CLA 2020-03-19 08:50:57 EDT
*** Bug 561223 has been marked as a duplicate of this bug. ***
Comment 4 Ed Merks CLA 2020-03-19 11:52:30 EDT
I suspect this issue will just rot sitting in p2.  In the end, p2 uses ECF for all the communication so it would need to be supported in ECF.  Is this statement correct Mat?
Comment 5 Mat Booth CLA 2020-03-19 21:48:38 EDT
(In reply to Ed Merks from comment #4)
> I suspect this issue will just rot sitting in p2.  In the end, p2 uses ECF
> for all the communication so it would need to be supported in ECF.  Is this
> statement correct Mat?

I don't know if this is correct, I am not familiar with p2's update-checking code.
Comment 6 Ed Merks CLA 2020-03-20 01:21:51 EDT
All of p2's transport is funneled though org.eclipse.equinox.internal.p2.repository.Transport which is primarily implemented by org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport:

/**
 * RepositoryTransport adapts p2 to ECF file download and file browsing.
 * Download is performed by {@link FileReader}, and file browsing is performed
 * by {@link FileInfoReader}.
 */
public class RepositoryTransport extends Transport {

I'm very familiar with both from heavy usage in Oomph where we also implement Transport via org.eclipse.oomph.p2.internal.core.CachingTransport which delegates to p2's RepositoryTransport.  We also use ECF directly in org.eclipse.oomph.setup.internal.core.util.ECFURIHandlerImpl.  In this class we use both org.eclipse.ecf.core.util.Proxy and org.eclipse.core.net.proxy.IProxyData but it's primarily driven by ECF's proxy support.  It's used for org.eclipse.ecf.filetransfer.IRemoteFileSystemBrowserContainerAdapter.setProxy(Proxy) and org.eclipse.ecf.filetransfer.IRetrieveFileTransferContainerAdapter.setProxy(Proxy).  This is the primary mechanism by which setup resources are loaded.

Looking at org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport.getLastModified(URI, IProgressMonitor) as a basic example, it uses org.eclipse.ecf.core.security.ConnectContextFactory.createUsernamePasswordConnectContext(String, Object) to provide context when delegating though p2's ECF layer.

In any case, it should be clear up front that no one is likely to spend time on an issue such as this.  Firstly, it's a heavy burden with no clear benefit to the person shouldering that burden.  And secondly, one needs an environment in which to reproduce the problem, making the burden even heavier.  I'm certainly not going to mess with my machine's configuration to try to replicate the context because I can try to find a way to fix it. I'm already annoyed that I get this in my log every time I launch anything:

!ENTRY org.eclipse.core.net 4 0 2020-03-20 06:14:29.458
!MESSAGE WinHttp.GetProxyForUrl for pac failed with error 'The proxy auto-configuration script could not be downloaded
' #12167.

This comes from my last efforts to fix proxy problems by first trying to reproduce them with Fiddler.

I'll mark this as an enhancement request and will strongly suggest that anyone interested in this capability either contribute the implementation themselves or hire an expert to contribute the implementation.
Comment 7 phorcys CLA 2020-04-15 14:14:07 EDT
How is the issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=544447 (thx to Mr. Thomas Wolf for the hint) related to the issues described here? Obviously it has already been fixed there. Why does "Check for Update" still not work with Eclipse 2019-12 in this case?

For your information: The proxy server with which "Check for Update" fails in this case responds to the following curl command as follows:

curl -X CONNECT -i --proxy-ntlm --proxy <POXY_HOST>:<PROXY_PORT> <HTTPS-URL>

HTTP/1.1 407 Proxy Authentication Required
Server: squid/3.5.21
...
Proxy-Authenticate: Negotiate
Proxy-Authenticate: NTLM
...
Comment 8 Rolf Theunissen CLA 2020-04-16 02:28:33 EDT
(In reply to phorcys from comment #7)
> How is the issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=544447 (thx
> to Mr. Thomas Wolf for the hint) related to the issues described here?
> Obviously it has already been fixed there. Why does "Check for Update" still
> not work with Eclipse 2019-12 in this case?
> 
> For your information: The proxy server with which "Check for Update" fails
> in this case responds to the following curl command as follows:
> 
> curl -X CONNECT -i --proxy-ntlm --proxy <POXY_HOST>:<PROXY_PORT> <HTTPS-URL>
> 
> HTTP/1.1 407 Proxy Authentication Required
> Server: squid/3.5.21
> ...
> Proxy-Authenticate: Negotiate
> Proxy-Authenticate: NTLM
> ...

As already stated by Ed, it is very hard to reproduce these kind of issues without access to the right environment. So I am afraid that best changes to get this issue fixed it that you start debugging yourself.

You could start by checking:
- What are the versions of the HttpClient plugins in your environment (does it include the required fixes)
- Are the HttpClient win plugins installed
- Does the proxy work if you manually provide it in the Eclipse settings (including credentials)
Comment 9 phorcys CLA 2020-05-18 05:50:44 EDT
Okay, here's what I tried:

- Download the latest eclipse-java-2020-03-R-win32-x86_64
- Check whether the following plungins are available in "plugins" subfolder (yes, they are):
    - org.apache.httpcomponents.httpcore_4.4.12.v20200108-1212
    - org.apache.httpcomponents.httpclient_4.5.10.v20200114-1512
    - org.apache.httpcomponents.httpclient.win_4.5.10.v20200113-2105
	- org.eclipse.ecf.provider.filetransfer.httpclient45_1.0.200.v20200212-0036
	- org.eclipse.ecf.provider.filetransfer.httpclient45.win32_1.0.100.v20200212-0036

1)

- Configure my test proxy with SPNEGO and NTLM, so that the proxy responds to the following curl command as follows:

curl -X CONNECT -i --proxy-ntlm --proxy <POXY_HOST>:<PROXY_PORT> <HTTPS-URL>

HTTP/1.1 407 Proxy Authentication Required
Server: squid/3.5.21
...
Proxy-Authenticate: Negotiate
Proxy-Authenticate: NTLM
...

- Start via eclipse.exe
- Enter the correct manual proxy settings (Host, Port, Auth, User) for HTTP and HTTPS schemes via menu: Window -> Preferences -> General -> Network Connections -> Active Provider -> Manual
- Check for Updates via menu: Help -> Check for Updates
- It works! :)

The win extension of the standard apache httpclient library can read the authentication (User, Password) directly from the operating system, see: org.apache.httpcomponents.httpclient.win_4.5.10.v20200113-2105/org.apache.http.impl.client/WinHttpClients.

It would be nice if eclipse could do the same in this case so there would be no need for user interaction.

2)

- Configure my test proxy with SPNEGO only, so that the proxy responds to the following curl command as follows:

curl -X CONNECT -i --proxy-negotiate --proxy <POXY_HOST>:<PROXY_PORT> <HTTPS-URL>

HTTP/1.1 407 Proxy Authentication Required
Server: squid/3.5.21
...
Proxy-Authenticate: Negotiate
...

- Do the same as in 1) (see above)
- It does NOT work (see screenhot)! :(

I debugged myself and I noticed the following strange default settings in class org.eclipse.ecf.provider.filetransfer.httpclient45_1.0.200.v20200212-0036/org.eclipse.ecf.internal.provider.filetransfer.httpclient45.ECFHttpClientFactory

public class ECFHttpClientFactory implements IHttpClientFactory {
...
	private static final List<String> DEFAULT_PREFERRED_AUTH_SCHEMES = Arrays.asList(AuthSchemes.BASIC, AuthSchemes.DIGEST, AuthSchemes.NTLM);
...
	private static final Registry<AuthSchemeProvider> DEFAULT_AUTH_SCHEME_REGISTRY = RegistryBuilder.<AuthSchemeProvider> create().register(AuthSchemes.BASIC, new BasicSchemeFactory()).register(AuthSchemes.DIGEST, new DigestSchemeFactory()).register(AuthSchemes.NTLM, new NTLMSchemeFactory()).build();
...
}

I miss the AuthSchemes.SPNEGO in the default auth schemes. So how can the default auth schemes be extended?
Comment 10 phorcys CLA 2020-05-18 05:51:29 EDT
Created attachment 282904 [details]
See Comment #9.
Comment 11 Christoph von Wittich CLA 2021-03-01 10:25:12 EST
It looks like Negotiate is not implemented.
Only the direct NTLM authentication was implemented by Yatta.

Won't help me neither because or corporate proxy is limited to Kerberos for security reasons.


see:
https://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/HttpClientProxyCredentialProvider.java

} else if ("negotiate".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$
  Trace.trace(Activator.PLUGIN_ID, "SPNEGO is not supported, if you can contribute support, please do so."); //$NON-NLS-1$



I wonder if anything from this old patch could be reused:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=408216
Comment 12 Christoph von Wittich CLA 2023-10-20 10:09:17 EDT
Looks like someone should really start to implement kerberos authentication now. Microsoft plans to remove NTLM support in Windows 11.

https://techcommunity.microsoft.com/t5/windows-it-pro-blog/the-evolution-of-windows-authentication/ba-p/3926848
Comment 13 Rolf Theunissen CLA 2023-10-23 03:34:45 EDT
As you did trace the issue down to ECF, moving to that project. I didn't follow the project closely, probably you should also file the bug here: https://github.com/eclipse/ecf/

Note that (as always) for biggest chance to get the bug fixed, is to either provide the fix yourself or to pay somebody to fix it for you. You will need to find somebody with access to the right environment and right knowledge on the topic.

@Ed wasn't there a request (long ago) from Microsoft on which topics they could help Eclipse?
Comment 14 Christoph von Wittich CLA 2023-11-16 04:52:55 EST
https://github.com/eclipse/ecf/issues/73


"Replace ECF's filetransfer.httpclient5 with filetransfer.httpclientjava"
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/1389
Comment 15 Scott Lewis CLA 2023-11-16 17:18:38 EST
(In reply to Christoph von Wittich from comment #14)
> https://github.com/eclipse/ecf/issues/73
> 
> 
> "Replace ECF's filetransfer.httpclient5 with filetransfer.httpclientjava"
> https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/
> 1389


Hi Christoph. 

I'm not clear on what you were trying to convey by adding the links to issue 73 and pr 1389.

Just so it's clear to everyone:   A proxy auth problem was found with the javahttpclient provider some weeks ago:

https://github.com/eclipse/ecf/pull/78#pullrequestreview-1730572643

Because of this problem, the Eclipse platform project elected to include both the httpclient5 and the javahttpclient provider in the upcoming release 12-2023 I think it's called).   A start-time property (see issue above) allows control of which provider is actually used.   

Also: I (ECF project lead) am not the author of the javahttpclient provider.  That was/is Christoph Laubrich.  It's probably going to require Christian's help in getting support for Kerberos into javahttpclient (at least for review and testing) so I've added @laubi onto https://github.com/eclipse/ecf/issues/73