Http 将curl与NTLM auth一起使用以生成post失败

Http 将curl与NTLM auth一起使用以生成post失败,http,curl,request,ntlm,Http,Curl,Request,Ntlm,我似乎无法对这件事保持清醒。我正在尝试脚本自动上传一个csv,但是curl在401上失败了 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.exampl

我似乎无法对这件事保持清醒。我正在尝试脚本自动上传一个csv,但是curl在401上失败了

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):
curl-v--ntlm-u用户名--上传文件~/galaxy/forums/pt_update.csvhttps://connect.example.com/11063/csv_import?op=add -k
输入用户用户名的主机密码:
*即将连接()到connect.example.com端口443(#0)
*正在尝试x.x.x.x。。。有联系的
*已成功设置证书验证位置:
*卡菲尔:没有
CApath:/etc/ssl/certs
*SSLv3,TLS握手,客户端hello(1):
*SSLv3,TLS握手,服务器hello(2):
*SSLv3,TLS握手,证书(11):
*SSLv3,TLS握手,服务器完成(14):
*SSLv3、TLS握手、客户端密钥交换(16):
*SSLv3,TLS更改密码,客户端你好(1):
*SSLv3,TLS握手,完成(20):
*SSLv3,TLS更改密码,客户端你好(1):
*SSLv3,TLS握手,完成(20):
*使用RC4-MD5的SSL连接
*服务器证书:
*主题:C=美国;ST=华盛顿;L=互联网用地;O=example.com公司。;CN=connect.example.com
*开始日期:2012-06-1114:53:47格林尼治标准时间
*过期日期:2013-06-11 14:53:47 GMT
*通用名称:connect.example.com(匹配)
*发行人:DC=com;DC=示例;DC=蚂蚁;CN=example.com信息安全CA G2
*SSL证书验证结果:无法获取本地颁发者证书(20),仍在继续。
*使用用户“username”的NTLM进行服务器身份验证
>PUT/11063/csv\u导入?op=add HTTP/1.1
>授权:NTLM TLRMTVNTUAABAAABOIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
>用户代理: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
>主持人:connect.example.com
>接受:*/*
>内容长度:0
>预期:100人继续
> 

*正在关闭连接#0
*SSLv3,TLS警报,客户端你好(1):
我替换了我的实际域所在的示例,并且我非常肯定地为我的域使用了正确的用户名/pw

curl-X POST-k-v--ntlm--negotiate-u usernamehere-F“csv=@pt_update.csv”-F“op=add”“”

您可以试试这个

如果您在IIS中托管了一个页面,并且该页面可与NTLM一起使用,那么您应该放置:

(例如,在Sharepoint页面)

这对我来说很好,你可以看到标题信息

--编辑--


如果设置协商,这将提供本地帐户并使用服务器登录,如果用户名和密码不正确,这无关紧要,因为协商会对本地登录的用户使用windows帐户进行自动身份验证。如果你不喜欢这个行为,你应该只把NTLM用于正确的NTLM登录。

你应该考虑解释它为什么工作。处于类似情况下的人不知道哪一部分出了问题。删除--“协商”使它对我有效。(对于ADFS集成的windows登录端点,对windows域进行身份验证)您可以删除:PASSWORD123,这样您就不必以纯文本形式键入它。如果删除,您将收到相同的提示。通常是的,但请确保使用https,因为在这两种情况下,“质询”都将以明文形式发送,不会出现任何问题。谢谢你,丹尼尔。
curl http://enterprisesharepoint -v --ntlm --negotiate -u USER123:PASSWORD123