使用ntlmaps 穿过 MSPROXY(ISA) ,Linux 上网不用愁
时间:2009-03-23 来源:sjhf
一般来说,ISA 2004作防火墙.下面的客户机都是windows.如果有个别linux客户端也想通过http代理方式上网.在NTLM验证这里就会卡住.
今天想更新虚拟机里面的程序.设置http_proxy #http_proxy="http://user:[email protected]:8080" #export http_proxy 然后yum install xxx 居然报HTTP ERROR 400 (Bad Request) 后来在我的windows xp上安装了一个ccproxy,然后由ccproxy中设置二级代理,填上公司的ISA防火墙 的IP,端口,用户名,密码,然后把虚拟机中的linux的http_proxy设置成winxp的ccproxy的ip和端口,再 来yum.ok了. #export http_proxy="192.168.1.159:808" yum 安装一个lynx,字符界面的浏览器,看看为啥不能更新 #yum install lynx #lynx www.baidu.com Looking up www.baidu.com first Looking up 192.168.1.224:8080 Making HTTP connection to 192.168.1.224:8080 Sending HTTP request. HTTP request sent; waiting for response. Alert!: Invalid header 'Proxy-Authenticate: Negotiate' Alert!: Invalid header 'Proxy-Authenticate: Kerberos' Alert!: Invalid header 'Proxy-Authenticate: NTLM' Alert!: Proxy authorization required -- retrying Retrying with proxy authorization information. .... Can't Access `http://www.baidu.com/' Alert!: Unable to access document. 噢.报NTLM错误,原来是验证的问题. baidu之,找到一个解决办法. http://www.chinaunix.net/jh/4/227822.html 使用ntlmaps 穿過 msproxy ,Linux 上網不用愁 NTLM 代理服務器 1) 什麼是 NTLM Authorization Proxy Server 'NTLM Authorization Proxy Server'是一类似于代理的软件.它能够使用 MS proxy服务器认证模式. 它修改客戶端数据請求包中的一些值,使請求类似 MS IE发出.程式是用Python語言写的 . 接下来好办,参考这篇文章,下载,安装.然后配置,然后测试.ok了. 下载之后,执行 $ tar zxvf ntlmaps-0.9.9.tar.gz 找到server.cfg,修改它 [GENERAL] LISTEN_PORT:5865 # 本机监听端口 PARENT_PROXY:192.168.1.224 # ISA服务器 PARENT_PROXY_PORT:8080 # ISA服务器端口 PARENT_PROXY_TIMEOUT:15 ALLOW_EXTERNAL_CLIENTS:0 FRIENDLY_IPS: URL_LOG:0 MAX_CONNECTION_BACKLOG:5 [CLIENT_HEADER] Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */* User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98) [NTLM_AUTH] NT_HOSTNAME:yw-04 # 主机名 NT_DOMAIN:chinabank # 域 USER:test# ISA代理的用户名 PASSWORD:test# ISA代理的密码 LM_PART:1 NT_PART:0 NTLM_FLAGS: 06820000 NTLM_TO_BASIC:0 [DEBUG] DEBUG:0 BIN_DEBUG:0 SCR_DEBUG:0 AUTH_DEBUG:0 配置完后保存,启动main.py: # ./main.py & 或者 # python main.py & 然后把linux的http_proxy改成127.0.0.1:5865 #http_proxy="http://127.0.0.1:5865" #export http_proxy 再来上网更新程序.ok了,如果不行,则尝试修改server.cfg中的ntlm验证模式. 总结.ISA的NTLM验证真是讨厌. 如果启动的时候报这样一个错误. ERROR: Unable to get the IP address of this machine. This is not a fatal problem, but may cause problems for you using this proxy in some scenarios." google无结果.后来看源代码lib/config_affairs.py 中有 hostname = socket.gethostname() 看来是hostname不对. #hostname bogon 显示的和/etc/hosts里面不一样, 运行 #hostname localhost 然后再运行.这次不报错了. |
相关阅读 更多 +