一般來說,ISA 2004作防火牆.下面的客戶機都是windows.如果有個別linux客戶端也想通過http代理方式上網.在NTLM驗證這裡就會卡住.
 
今天想更新虛擬機器裡面的程式.設定http_proxy
#http_proxy=”[url]http://user:passwd@192.168.1.224:8080[/url]
#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 [url]www.baidu.com[/url]
Looking up [url]www.baidu.com[/url] 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 `[url]http://www.baidu.com/[/url]`
Alert!: Unable to access document.
噢.報NTLM錯誤,原來是驗證的問題.
使用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: p_w_picpath/gif, p_w_picpath/x-xbitmap, p_w_picpath/jpeg, p_w_picpath/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=”[url]http://127.0.0.1:5865[/url]
#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
然後再執行.這次不報錯了.