-
Notifications
You must be signed in to change notification settings - Fork 498
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
authorization for https connections? #42
Comments
hi @legale could you give more details of how to reproduce this issue? |
Hi @chobits curl -x 127.0.0.1:3128 http://www.test.com 401
|
It seems there is issue with HTTPS basic authentication. I get 401 Unauthorized. Here is nginx config
Here is curl trace
I happen to have squid configured on the same machine. HTTPS basic auth works on it.
|
Actually it seems nginx PAM authentication breaks when used with this module.
nginx configuration
I used nginx PAM auth module. I checked that basic auth on simple page works. Please @chobits advise on authentication options for this module. |
hi, let me check. (I only check nginx basic auth module before) |
nginx的auth模块也不起作用吧 |
any progress about this critical bug? From my point of view, it provides little value if this module insists to break/deny the existing authentication mechanism. |
This module can work with lua-nginx-module. During REWRITE phase (directive But you should know that the request which you can check is only the CONNECT request, not any data proxied under CONNECT tunnel. |
@chobits Thanks for your quick reply. But we all want is nothing else but basic auth to prevent illegal traffic pass through forward proxy. Do you think it is not important? |
@gamelton 's case has two problem, which are not associated with proxy connect module.
Note that I have checked proxy_connect module can work under auth basic module (Note that my test case worked for CONNECT request with auth basic header, NOT for GET request). |
This module only handles CONNECT request, the raw stream (maybe GET/POST request, or anyother data stream) under CONNECT tunnel cannot be parsed and is passed to backend server directly. (The similar problem for this case, see #108 (comment). ) |
I think this module should supports |
@chobits
3.2 proxytunnel
nginx debug log :
|
For "3.1 curl" case, your nginx server config listens 443 with ssl protocol, while curl command (
For this case, proxytunnel creates tunnel under SSL protocol, in which case CONNECT request and later proxied stream is under ssl protocol. But nginx auth_basic module can only handle
|
How to do access control using nginx auth basic moduleNote that this auth-basic checking only works for CONNECT request, not for proxied requests on the CONNECT tunnel.
See Also |
See my comment: #42 (comment). We should transfer Proxy-Authorization header to Authorization header for auth basic module!! Thanks for your report~! |
I think there are two cases interleaved here.
For the first case its fairly simple, just return 407 Proxy Authentication Required (if client does not provide credentials) For second case, we can use proxy_pass_header with client credentials or use proxy_set_header with hard coded credentials |
hi @deba12
I have given a tricky way to support Proxy-Authorization via lua-nginx-module(rewrite_by_lua directive) and auth basic module. See my comment of the test case: #42 (comment).
We cannot support this featue, because proxy_connect module wont parse and modify proxied data stream. For why, see #108 (comment). |
yep it should works. But your example have to include at least proxy_hide_header to hide authorization headers ;) |
hi @deba12 It's unnecessary for CONNECT tunnel, because CONNECT request is only handled by proxy_connect module, there is no header passed to backend for CONNECT request. And later request under CONNECT tunnel is proxied to backend without any modified. step: CONNECT request handled(no request passed to backend) -> create tcp connection with backned -> pass later request to backend( passthrough without modification) I mean proxy_hide_header ( any directive of proxy module) wont work for CONNECT request and requests/data stream under CONNECT tunnel. However, proxy_hide_header can work for plain http proxying, for example
|
@chobits yes, but for plain http connections we have to hide it anyway so why not to include it. |
Yes, I agree. Have updated #42 (comment).
|
Hi, @chobits.
Does it mean that credentials are sent in clear text? |
hi @gamelton
Yes you can config nginx with SSL protocol( And you can test it with proxytunnel command from |
hi, i donnot know why, but proxy_hide_header is not work here.. your code work? |
Not an easy task here while remaining widely compatible and without using MITM ssl... (plus the current solution is not compatible with chrome and others...) looking forward to what will be implemented against this issue. |
hi @xlcn from ur #42 (comment)
Yes, it works, see the example in my comment:
|
ok,nice work;
|
Do you recommend using OpenResty to get |
If you just use a few functions of nginx OR personal use, there is no difference between using nginx and openresty. But if you need to use a large number of nginx three-party modules to complete online business, and do not want to maintain the update of each module independently, it is highly recommended that you use nginx bundle (maybe openresty, NGINX Plus, Tengine ...) |
Reply late, this thread is too long. There is no module that can directly modify and handle the request before the nginx proxy module. Maybe nginx-native module: Perl module can do this also, I rarely use it, only use it to write nginx test case. Lua module is a convenient way to do programming for HTTP request. For perl module: http://nginx.org/en/docs/http/ngx_http_perl_module.html |
This issue was resolved in #42 (comment). I Closed and locked this issue. If you have any question, please open a new issue. |
Hi. Thank you for your work.
Is there any way to enable authorization for https connections?
The text was updated successfully, but these errors were encountered: