免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7543 | 回复: 5
打印 上一主题 下一主题

[网络管理] wget 407 error: proxy authentication required? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-02-22 11:36 |只看该作者 |倒序浏览
本帖最后由 dxcheng 于 2016-02-22 11:37 编辑

Virtual box centos 7 虚拟机通过代理上网,firefox可以成功访问网页,但是wget 返回error 407 proxy authentication required 错误
还请大神们帮忙看下,这是怎么回事,谢谢!

Firefox 代理设置:


Firefox 上网时提示输入用户名,密码,输入后可以正常上网:


不过在Terminal下使用wget 下载文件时返回错误407 error proxy authentication required:
# export http_proxy=http:// 135.251.33.16:8080/
# wget -d -v http:// mirrors.163.com/.help/CentOS6-Base-163.repo --proxy-user test --proxy-password test2016
Setting --verbose (verbose) to 1
Setting --proxy-user (proxyuser) to test
Setting --proxy-password (proxypassword) to test2016
DEBUG output created by Wget 1.14 on linux-gnu.

URI encoding = ‘UTF-8’
URI encoding = ‘UTF-8’
--2016-02-22 10:35:26--  http:// mirrors.163.com/.help/CentOS6-Base-163.repo
Connecting to 135.251.33.16:8080... connected.
Created socket 3.
Releasing 0x000000000173ca00 (new refcount 0).
Deleting unused 0x000000000173ca00.

---request begin---
GET http:// mirrors.163.com/.help/CentOS6-Base-163.repo HTTP/1.1
User-Agent: Wget/1.14 (linux-gnu)
Accept: */*
Host: mirrors.163.com
Connection: Close
Proxy-Connection: Keep-Alive
Proxy-Authorization: Basic Y2hhc29uZDpkeGM2NzUxNzch

---request end---
Proxy request sent, awaiting response...
---response begin---
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: close
Set-Cookie: BCSI-CS87FB2110=2; Path=/
Connection: close
Content-Length: 810

---response end---
407 Proxy Authentication Required

Stored cookie mirrors.163.com -1 (ANY) / <session> <insecure> [expiry none] BCSI-CS87FB2110 2
URI content encoding = ‘utf-8’
Closed fd 3
2016-02-22 10:35:26 ERROR 407: Proxy Authentication Required.


PS: 为了绕过论坛发表ULR的限制,所有HTTP URL后面加了一个空格

论坛徽章:
41
操作系统版块每日发帖之星
日期:2016-08-21 06:20:00每日论坛发贴之星
日期:2016-05-05 06:20:00操作系统版块每日发帖之星
日期:2016-05-05 06:20:00IT运维版块每日发帖之星
日期:2016-05-05 06:20:0015-16赛季CBA联赛之山西
日期:2016-04-27 08:49:00操作系统版块每日发帖之星
日期:2016-04-25 06:20:00操作系统版块每日发帖之星
日期:2016-04-17 06:23:2815-16赛季CBA联赛之吉林
日期:2016-03-25 15:46:3415-16赛季CBA联赛之四川
日期:2016-03-25 14:26:19操作系统版块每日发帖之星
日期:2016-05-27 06:20:00操作系统版块每日发帖之星
日期:2016-05-28 06:20:00IT运维版块每日发帖之星
日期:2016-08-18 06:20:00
2 [报告]
发表于 2016-02-22 14:19 |只看该作者
提示就是代理验证失败,配置代理请加上账号密码

论坛徽章:
0
3 [报告]
发表于 2016-02-22 14:30 |只看该作者
回复 2# jixuuse


已经加进去了,
# export http_proxy=http:// 135.251.33.16:8080/
# wget -d -v http:// mirrors.163.com/.help/CentOS6-Base-163.repo --proxy-user test --proxy-password test2016


而且这样也是不行的:
# export http_proxy=http:// test:test2016@135.251.33.16:8080/
# wget -d -v http:// mirrors.163.com/.help/CentOS6-Base-163.repo


PS:注意到HTTP的response中有这么一句,不知道和这个有关吗?
---response begin---
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Cache-Control: no-cache

求职 : Linux运维
论坛徽章:
203
拜羊年徽章
日期:2015-03-03 16:15:432015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:57:092015小元宵徽章
日期:2015-03-06 15:58:182015年亚洲杯之约旦
日期:2015-04-05 20:08:292015年亚洲杯之澳大利亚
日期:2015-04-09 09:25:552015年亚洲杯之约旦
日期:2015-04-10 17:34:102015年亚洲杯之巴勒斯坦
日期:2015-04-10 17:35:342015年亚洲杯之日本
日期:2015-04-16 16:28:552015年亚洲杯纪念徽章
日期:2015-04-27 23:29:17操作系统版块每日发帖之星
日期:2015-06-06 22:20:00操作系统版块每日发帖之星
日期:2015-06-09 22:20:00
4 [报告]
发表于 2016-02-22 17:31 |只看该作者
Proxy-Authenticate: NTLM 就是本地认证吧

论坛徽章:
0
5 [报告]
发表于 2016-02-23 10:45 |只看该作者
回复 4# lyhabc

Thanks,网上搜索了一些资料,和大家一起学习下。

NTLM是一种身份认证协议,这种协议适用于Window操作系统。和他相对应的协议有Basic 和 Digest(wget的man help里面看到的)

--http-password=password
           Specify the username user and password password on an HTTP
           server.  According to the type of the challenge, Wget will encode
           them using either the "basic" (insecure), the "digest", or the
           Windows "NTLM" authentication scheme.



wget仅支持Basic方式的身份认证协议,因此会出现Proxy Authentication Required
       --proxy-user=user
       --proxy-password=password
           Specify the username user and password password for
           authentication on a proxy server.  Wget will encode them using
           the "basic" authentication scheme.


           Security considerations similar to those with --http-password
           pertain here as well.


解决方案:
使用NTLMAPS搭建一个本地代理服务器,实现认证协议的转换。
具体参考如下:
Web Browsing Behind ISA Server HOWTO
Linux下通过Windows的ISA代理认证上网

PS:Firefox 内部实现了认证协议的支持,所以Firefox没有这个问题。

评分

参与人数 1可用积分 +6 收起 理由
chenyx + 6 很给力!

查看全部评分

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
6 [报告]
发表于 2016-02-26 19:23 |只看该作者
感谢楼主分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP