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

http正向代理 401 Unauthorized #156

Closed
CoreJa opened this issue Aug 5, 2019 · 10 comments
Closed

http正向代理 401 Unauthorized #156

CoreJa opened this issue Aug 5, 2019 · 10 comments

Comments

@CoreJa
Copy link

CoreJa commented Aug 5, 2019

需求:通过校内服务器访问内网资源。
情况:已通过nps建立与公网服务器连接,搭建了tcp隧道,可以使用ssh访问。
问题:401 Unauthorized

大致能明白是认证出了问题。但是一直未能解决。
我用的basic验证如下,不知道为什么没用
export http_proxy=xxx:xxx@abc.com:1082
export https_proxy=xxx:xxx@abc.com:1082
使用的是配置文件连接,在web端设置了http代理,web端显示basic验证的用户密码均正确

@CoreJa
Copy link
Author

CoreJa commented Aug 5, 2019

附:socks5正向代理也无法使用。
image
image

@CoreJa
Copy link
Author

CoreJa commented Aug 5, 2019

在服务端日志里看得出来代理有正常启动,但随后的validation failed EOF应该是表示验证出了问题。 socks5也有这个问题。
image
image

@cnlh
Copy link
Collaborator

cnlh commented Aug 5, 2019 via email

@CoreJa
Copy link
Author

CoreJa commented Aug 5, 2019

关闭了验证,http和socks5正向代理都可以正常使用了。感谢作者。
刚刚查到了似乎http验证已经将xxx:xxx@yyy.com:1234这样的方式废弃掉了。
image

我会去研究一下basic验证需要哪些工作。找到了方法后贴在楼下就close。
再次感谢作者。

不会用验证可以先关闭验证。 发自我的 iPhone

在 2019年8月5日,14:40,Core-Chan @.***> 写道: 在服务端日志里看得出来代理有正常启动,但随后的validation failed EOF应该是表示验证出了问题。 socks5也有这个问题。 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

@demoshang
Copy link

demoshang commented Aug 22, 2019

@cnlh

是不是么有判断 Proxy-Authorization 这个header?

curl -v 的日志来看, 会添加 Proxy-Authorization 这个 header, 但是从 代码 CheckAuth 看好像没有处理

手动添加 header Authorization 可以正常

curl  --header 'Authorization: Basic <base64Auth>' \
-x http://<USERNAME>:<PASSWORD>@<IP>:<PORT> \
-v ifconfig.co/json
> GET http://ifconfig.co/json HTTP/1.1
> Host: ifconfig.co
> Proxy-Authorization: Basic XXXXXXXXXXXXXX
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
> Authorization: Basic XXXXXXX
>

不添加, 仅仅使用 http://<USERNAME>:<PASSWORD>@<IP>:<PORT> 失败

curl  -x http://<USERNAME>:<PASSWORD>@<IP>:<PORT> -v ifconfig.co/json
> GET http://ifconfig.co/json HTTP/1.1
> Host: ifconfig.co
> Proxy-Authorization: Basic XXXXXX
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>

@demoshang
Copy link

@cnlh

是不是么有判断 Proxy-Authorization 这个header?

curl -v 的日志来看, 会添加 Proxy-Authorization 这个 header, 但是从 代码 CheckAuth 看好像没有处理

手动添加 header Authorization 可以正常

curl  --header 'Authorization: Basic <base64Auth>' \
-x http://<USERNAME>:<PASSWORD>@<IP>:<PORT> \
-v ifconfig.co/json
> GET http://ifconfig.co/json HTTP/1.1
> Host: ifconfig.co
> Proxy-Authorization: Basic XXXXXXXXXXXXXX
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
> Authorization: Basic XXXXXXX
>

不添加, 仅仅使用 http://<USERNAME>:<PASSWORD>@<IP>:<PORT> 失败

curl  -x http://<USERNAME>:<PASSWORD>@<IP>:<PORT> -v ifconfig.co/json
> GET http://ifconfig.co/json HTTP/1.1
> Host: ifconfig.co
> Proxy-Authorization: Basic XXXXXX
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>

@cnlh any update?

@boot-vue
Copy link

大BUG 待修复

@ffdfgdfg
Copy link
Collaborator

#279

@demoshang
Copy link

demoshang commented Dec 16, 2019

@ffdfgdfg

这是2个问题, 指向的问题是说存在2个 http basic auth 引起的错误, 而这里指的是 只有一个 basic auth 下

frp 代码来看 http_proxy.go#L166, 就是因为 nps 没有处理 Proxy-Authorization 导致的

@ffdfgdfg
Copy link
Collaborator

ffdfgdfg commented Dec 16, 2019

感谢反馈,我们查阅了资料后,确实对http正向代理的处理有问题,按照标准,http正向代理服务器应该处理这个Proxy-Authorization,但是我们考虑到这里也可以做一个代理保护功能,通过暴露WWW-Authenticate来当成一个网站,这一块我们后面单独做出来,现在先做兼容处理,同时处理这两个header

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

5 participants