Skip to content

Preferred proxy authentication methods removed #296

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jun 8, 2020

Conversation

the-thing
Copy link
Contributor

@the-thing the-thing commented Jun 5, 2020

Fixes #295

Opening as a DRAFT before we gather the test evidence.

@curdreinert

Would you be able to build or test directly from branch? At the moment I'm using CCProxy for Windows, but I struggle to get either SOCKS or HTTP method to work (most likely a setup issue). Also, what OS and proxy software are you using? I will have a look again in the evening/tomorrow.

@chrjohn chrjohn marked this pull request as draft June 5, 2020 14:31
@cd-ppi
Copy link

cd-ppi commented Jun 6, 2020

Took me some time, but managed to build and test directly from branch. And learned some things on the way :-)
I can confirm that with this fix

  • I could succesfully connect through an authenticating HTTP proxy. Tested with a Squid (3.5.20) running on Linux (CentOS Linux release 7.8.2003 (Core)), the QuickFIX/J application was running on Windows 10
  • I could also connect through an non-authenticating HTTP proxy. Tested with the same setup (Squid, Linux, Windows as above), only with the authentication turned off in the proxy.

I checked the traffic with Wireshark to confirm that in both cases actually happened what was expected (i.e. CONNECT -> 407 -> CONNECT with BASIC credentials -> Connection esatblished in the first case and CONNECT -> Connection established in the second case).

@cd-ppi
Copy link

cd-ppi commented Jun 6, 2020

As the Mina documentation of ProxyIOSession.getPreferedOrder() points out, the order is only used for http proxies (and you can confirm that by looking into their source code). However, for good measure, I also tried against an authenticating Socks 5 Proxy (some badly misused variant of jsocks), and this also works.
I'm lacking the imagination why this fix should yield problems on other operating systems or with other Http Proxies. So from my point of view, I think we are fine.
The only thing I can think of is that the new test in the ProtocolFactoryTest sets the proxy type to "socks" which might suggest to the casual reader that the necessity of not setting the preffered order has something to do with socks, while it only comes into play for http proxies. But this is rather cosmetically.

@chrjohn chrjohn added this to the QFJ 2.2.0 milestone Jun 6, 2020
@chrjohn
Copy link
Member

chrjohn commented Jun 6, 2020

@the-thing @curdreinert

Great, thanks guys!

@the-thing
Copy link
Contributor Author

the-thing commented Jun 7, 2020

@curdreinert

Good work and thanks for the suggestion with the unit test - I've changed it.

SOCKS proxy handshake seems to be different. According to RFC https://tools.ietf.org/html/rfc1928 for SOCKS proxy client advertises available methods and the server chooses which one to use. Current MINA version advertises NO_AUTH, GSSAPI_AUTH, BASIC_AUTH statically, order does not matter for the client (but I assume it might be configured withing the proxy server itself). For HTTP proxy, server returns available methods and client chooses how to authenticate.

org.apache.mina.proxy.handlers.socks.Socks5LogicHandler#writeRequest

@the-thing the-thing marked this pull request as ready for review June 7, 2020 09:41
@chrjohn chrjohn merged commit e24b744 into quickfix-j:master Jun 8, 2020
@the-thing the-thing deleted the proxy_auth_order_fix branch June 24, 2020 15:25
jli8000 pushed a commit to jli8000/quickfixj that referenced this pull request Sep 22, 2020
* preferred proxy auth methods removed
* changed proxy type and version in unit test
@sachin681
Copy link

Can you please provide more details with some sample of configurations you tried with Squid ? What the values used at QFJ end? Can we do same with Apache proxy ?

@sachin681
Copy link

Took me some time, but managed to build and test directly from branch. And learned some things on the way :-)
I can confirm that with this fix

  • I could succesfully connect through an authenticating HTTP proxy. Tested with a Squid (3.5.20) running on Linux (CentOS Linux release 7.8.2003 (Core)), the QuickFIX/J application was running on Windows 10
  • I could also connect through an non-authenticating HTTP proxy. Tested with the same setup (Squid, Linux, Windows as above), only with the authentication turned off in the proxy.

I checked the traffic with Wireshark to confirm that in both cases actually happened what was expected (i.e. CONNECT -> 407 -> CONNECT with BASIC credentials -> Connection esatblished in the first case and CONNECT -> Connection established in the second case).

Can you please provide more details with some sample of configurations you tried with Squid ? What the values used at QFJ end? Can we do same with Apache proxy ?

@chrjohn
Copy link
Member

chrjohn commented Sep 29, 2020

@sachin681 Please don't use the bug tracker for help requests. See https://github.com/quickfix-j/quickfixj#questions

@sachin681
Copy link

https://github.com/quickfix-j/quickfixj#questions

Sorry for posting it here. I will post the question on the right forum.

@cd-ppi
Copy link

cd-ppi commented Sep 30, 2020 via email

@sachin681
Copy link

sachin681 commented Sep 30, 2020 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connecting over an authenticating HTTP proxy fails
4 participants