2013-03-29 70 views
14

我似乎無法包裹我的頭圍繞此。我試圖腳本自動CSV格式的上傳,但捲曲與401使用捲曲與NTLM身份驗證,使一個帖子失敗

curl -v --ntlm -u username --upload-file ~/galaxy/forums/pt_update.csv https://connect.example.com/11063/csv_import?op=add -k 
Enter host password for user 'username: 
* About to connect() to connect.example.com port 443 (#0) 
* Trying x.x.x.x... connected 
* successfully set certificate verify locations: 
* CAfile: none 
    CApath: /etc/ssl/certs 
* SSLv3, TLS handshake, Client hello (1): 
* SSLv3, TLS handshake, Server hello (2): 
* SSLv3, TLS handshake, CERT (11): 
* SSLv3, TLS handshake, Server finished (14): 
* SSLv3, TLS handshake, Client key exchange (16): 
* SSLv3, TLS change cipher, Client hello (1): 
* SSLv3, TLS handshake, Finished (20): 
* SSLv3, TLS change cipher, Client hello (1): 
* SSLv3, TLS handshake, Finished (20): 
* SSL connection using RC4-MD5 
* Server certificate: 
* subject: C=US; ST=Washington; L=internetland; O=example.com Inc.; CN=connect.example.com 
* start date: 2012-06-11 14:53:47 GMT 
* expire date: 2013-06-11 14:53:47 GMT 
* common name: connect.example.com (matched) 
* issuer: DC=com; DC=example; DC=ant; CN=example.com Infosec CA G2 
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. 
* Server auth using NTLM with user 'username' 
> PUT /11063/csv_import?op=add HTTP/1.1 
> Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA= 
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 
> Host: connect.example.com 
> Accept: */* 
> Content-Length: 0 
> Expect: 100-continue 
> 
< HTTP/1.1 401 Authorization Required 
< Date: Fri, 29 Mar 2013 03:47:00 GMT 
< Server: Server 
< WWW-Authenticate: Basic realm="ANT (Windows) Login" 
< Content-Length: 401 
< Connection: close 
< Content-Type: text/html; charset=iso-8859-1 
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html><head> 
<title>401 Authorization Required</title> 
</head><body> 
<h1>Authorization Required</h1> 
<p>This server could not verify that you 
are authorized to access the document 
requested. Either you supplied the wrong 
credentials (e.g., bad password), or your 
browser doesn't understand how to supply 
the credentials required.</p> 
</body></html> 
* Closing connection #0 
* SSLv3, TLS alert, Client hello (1): 

失敗我換成例如在我的實際訪問的,我肯定使用了正確的用戶名/密碼我域。

回答

23

你試試這個

如果你在IIS託管的網頁,並使用NTLM的工作,那麼你應該把:

(例如,在共享點頁)

curl http://enterprisesharepoint -v --ntlm --negotiate -u USER123:PASSWORD123 

這對我來說很好你可以看到標題消息

- 編輯 -

如果你把談判,這給本地帳戶並與服務器登錄,如果用戶名和密碼是不正確的,這是沒有問題,因爲與用戶本地loged的windows帳戶協商做自動驗證。如果你不喜歡這種行爲,你應該只用ntlm來獲得正確的ntlm登錄。

+0

刪除「 - 協商」使它爲我工作。 (到ADFS集成的Windows登錄端點,對Windows域進行身份驗證) –