Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Auth for remote proxy is not working #24

Closed
viniabreulima opened this issue Feb 1, 2019 · 7 comments
Closed

Auth for remote proxy is not working #24

viniabreulima opened this issue Feb 1, 2019 · 7 comments

Comments

@viniabreulima
Copy link

Hi!
I'm trying to use pproxy with a remote proxy, which is a paid proxy service.
I need to authenticate the remote proxy connection with a simple http auth. Reading your docs, i understood that i need to use the username and password on the fragment part of the url, because the usual auth part on url is reserved to cyphers, right?

If i start the proxy like this: pproxy -r 'http://HOST:PORT/#USERNAME:PASSWORD' -vvv and make a call using curl --proxy "http://localhost:8080" "http://httpbin.org/ip", i receive curl: (52) Empty reply from server from the curl command.

If i do not use the pproxy and make a call using curl --proxy "http://HOST:PORT/" --proxy-user "USERNAME:PASSWORD" "http://httpbin.org/ip" works nicely.

Am i doing something wrong?

Thanks!

@SeameX
Copy link

SeameX commented Feb 1, 2019

As far as i understand http is not supported. Try with https.

Would be awesome if you (the project owner) can add this functionality :)
Thats the only part that is missing for me to use this small tool on daily basis.

@viniabreulima
Copy link
Author

Already tried using HTTPS and does not work either.

Tried: pproxy -r 'http+ssl://HOST:PORT/#USERNAME:PASSWORD' -vvv and called curl --proxy "http://localhost:8080" "http://httpbin.org/ip", and still received curl: (52) Empty reply from server from the curl command.

I generated a self-signed certificate and started pproxy with: pproxy -l 'http+ssl://0.0.0.0:8099' --ssl server.crt,server.key -r 'http+ssl://HOST:PORT/#USERNAME:PASSWORD' -vvv and called curl --proxy-insecure --proxy "https://localhost:8099" "http://httpbin.org/ip", and still received curl: (52) Empty reply from server from the curl command.

Direct calls on the server via curl --proxy "https://HOST:PORT/" --proxy-user "USERNAME:PASSWORD" "http://httpbin.org/ip" works nicely.

I tested pproxy with remote proxies that doesn't need authentication and works nicely, but unfortunately, it is not my case

@SeameX
Copy link

SeameX commented Feb 1, 2019

You miss understood me.
Use: pproxy -r 'http://HOST:PORT/#USERNAME:PASSWORD' -vvv
curl --proxy "http://localhost:8080" "https://httpbin.org/ip"

Feature: http TCP server -> http get,post is missing as shown in the main readme.

@viniabreulima
Copy link
Author

Oh, i totally misunderstood you, thanks for the clarification!
I tried calling an HTTPS domain, and it worked! Right now it may solve my case, but eventually i will need to call HTTP domains...

I made a few more tests, and i discovered that HTTP Get works! I tried on another proxy server with the following commands:
pproxy -v -r 'http://177.37.161.4:35509' (this proxy is a free one... maybe it won't be available by the time you test it - if you do that =P)
curl --proxy "http://localhost:8080" "https://httpbin.org/ip" Works!
curl --proxy "http://localhost:8080" "http://httpbin.org/ip" Works too!

So... based on my "investigation" about this issue, i'm concluding that the issue is about the authentication... or am i missing something here?

Oh! And i tried using SOCKS5 on the local proxy instead of HTTP, and works the same way as if i was using HTTP. (https calls work, http calls don't)

And @SeameX , thank you from the bottom of my heart for your assistance!

@qwj
Copy link
Owner

qwj commented Feb 2, 2019

You can try httponly:// instead of http://, if the remote http proxy server supports only GET/POST instead of CONNECT method.
-r httponly:// makes pproxy to connect via GET/POST, and -r http:// makes pproxy to connect via CONNECT.
-l http:// listens via both GET/POST and CONNECT
Some remote http proxy doesn't support CONNECT, so you can try httponly://

You can also use "--test http://google.com" to test the availability of remote proxy instead of "curl --proxy http://localhost:8080"

@viniabreulima
Copy link
Author

Looks like you are right! My remote proxy does not accept CONNECT, and httponly works! But now we have another issue. It is working only for HTTP sites.
I'm trying to link both http+ssl and httponly, but i think they exclude each other, right?
If i use http+ssl, i can access HTTPS sites, and i cannot access HTTP sites.
If i use httponly, i can access HTTP sites and i cannot access HTTPS sites.

Oh, apparently if i use the --test argument, it does not accept HTTPS sites, i'm getting an assertion error: AssertionError: Unknown scheme https

Anyway, now the issue has changed. Authentication is working properly...

@qwj
Copy link
Owner

qwj commented Feb 8, 2019

If the proxy only supports GET/POST, we cannot tunnel HTTPS traffic to this proxy, because TLS traffic needs safe CONNECT method to tunnel.
You don't need to specify http+ssl for HTTPS sites. The TLS traffic can be properly handled if the remote proxy accepts CONNECT method.

@qwj qwj closed this as completed Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants