使用curl与NTLM auth发布帖子失败

Jud*_*les 22 curl ntlm http request

我似乎无法绕过这个.我正在尝试编写自动上传csv的脚本,但卷曲失败了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):
Run Code Online (Sandbox Code Playgroud)

我替换了我的实际域名的示例,我肯定使用正确的用户名/ pw作为我的域名.

Dan*_*ayo 34

你试试这个

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

(例如在Sharepoint页面)

curl http://enterprisesharepoint -v --ntlm --negotiate -u USER123:PASSWORD123
Run Code Online (Sandbox Code Playgroud)

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

- 编辑 -

如果你进行协商,这会给本地帐户并使用服务器登录,如果用户名和密码不正确,那就不行了,因为协商会对本地用户使用windows帐户进行自动身份验证.如果你不喜欢这种行为,你应该只为ntlm登录正确的ntlm.

  • 删除“--negotiate”使它对我有用。(到 ADFS 集成 Windows 登录端点,向 Windows 域进行身份验证) (3认同)

Jud*_*les 13

以下作品

curl -X POST -k -v --ntlm --negotiate -u usernamehere -F "csv=@pt_update.csv" -F "op=add" "https://google.com/csv_import"

  • 您应该考虑解释*为什么*它有效.处于类似情况的人将不知道哪个部分是错的. (55认同)
  • 请注意,发帖者自己可能不知道解决方案为何有效。这可能是他们在互联网上或通过反复试验找到的东西。您可能不想抱怨,而是想感谢他们花时间尝试提供帮助。从复选标记来看,它至少对OP来说是有价值的。 (2认同)