Discussion:
Unable to upload file from RedHat to a Share Point site
Garcia, Jerry E
2017-12-19 16:47:31 UTC
Permalink
I am getting an HTTP/1.1 401 Unathorized when using curl to upload a file from a RedHat Linux server to a Share Point site.Here is a command that I used:
curl -k --ntlm --user username:password --upload-file <path to file> --cacert <path to certRepo that has the PEM certs> <Share Point Site> -v

Here is the message from the verbose flag:
* About to connect() to collab.web.boeing.com port 443 (#0)
* Trying 137.137.15.123... connected
* Connected to collab.web.boeing.com (137.137.15.123) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
* subject: CN=collab.web.boeing.com,OU=servers,O=Boeing,C=US
* start date: Sep 06 12:38:17 2017 GMT
* expire date: Nov 05 12:38:17 2019 GMT
* common name: collab.web.boeing.com
* issuer: CN=Boeing Basic Assurance Software Issuing CA G3,OU=certservers,O=Boeing,C=US
* Server auth using NTLM with user 'lm446a'
PUT /sites/ServiceOperations/Knowlege%20Shareing%20Base2/BPM/BPM%20ENVIRONMENT/bpmaips-ti01.html HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: collab.web.boeing.com
Accept: */*
Content-Length: 0
Expect: 100-continue
< HTTP/1.1 401 Unauthorized
< Server: Microsoft-IIS/8.0
< WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADgAAAAGgokCx0kxT/Nng6UAAAAAAAAAALIAsgA6AAAABgLwIwAAAA9OVwIABABOAFcAAQAUAEUAUwBTAC0ARQBXAEEALQAwADEABAAiAG4AdwAuAG4AbwBzAC4AYgBvAGUAaQBuAGcALgBjAG8AbQADADgARQBTAFMALQBFAFcAQQAtADAAMQAuAG4AdwAuAG4AbwBzAC4AYgBvAGUAaQBuAGcALgBjAG8AbQAFABwAbgBvAHMALgBiAG8AZQBpAG4AZwAuAGMAbwBtAAcACACfa6rQ5HjTAQAAAAA=
< SPRequestGuid: d51b389e-a40b-60e7-4fd9-bc938d767920
< request-id: d51b389e-a40b-60e7-4fd9-bc938d767920
< X-FRAME-OPTIONS: SAMEORIGIN
< SPRequestDuration: 2
< SPIisLatency: 1
< WWW-Authenticate: Basic realm="collab.web.boeing.com"
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 15.0.0.4737
< X-Content-Type-Options: nosniff
< X-MS-InvokeApp: 1; RequireReadOnly
< Date: Tue, 19 Dec 2017 16:17:06 GMT
< Content-Length: 0
< Set-Cookie: BIGipServercollab-ew-80-pool=3021506953.20480.0000; path=/
<
* Connection #0 to host collab.web.boeing.com left intact
* Issue another request to this URL: 'https://collab.web.boeing.com/sites/ServiceOperations/Knowlege%20Shareing%20Base2/BPM/BPM%20ENVIRONMENT/bpmaips-ti01.html'
* Re-using existing connection! (#0) with host collab.web.boeing.com
* Connected to collab.web.boeing.com (137.137.15.123) port 443 (#0)
* Server auth using NTLM with user 'lm446a'
PUT /sites/ServiceOperations/Knowlege%20Shareing%20Base2/BPM/BPM%20ENVIRONMENT/bpmaips-ti01.html HTTP/1.1
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABgAGAHAAAAAMAAwAdgAAAAAAAAAAAAAABoKJAu1qvqHWpJKqAAAAAAAAAAAAAAAAAAAAAKPBfel2LyCbaItI8Suj+8VXCHlLrX8dMWxtNDQ2YWJwbWFpcHMtdGkwMQ==
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: collab.web.boeing.com
Accept: */*
Content-Length: 4096
Expect: 100-continue
< HTTP/1.1 100 Continue
* SSL read: errno -5961
* Closing connection #0
curl: (56) SSL read: errno -5961

I get this message with almost any changes that I do. I need help with this.

Thanks,

Jerry E. Garcia
Boeing IT, AI Level 3 (A2A, BizTalk, CEERS, DCAC, WPS, MQM, eFDS)
425-234-4049 (Work)
253-670-8974 (cell)
Mail Drop - 7L-65
Hours - 7:00 AM to 3:00 PM PST
Cell Pager: http://webpager.boeing.com/htbin/pagem/?pagee=Jerry.Garcia
Norton, Mike
2017-12-19 23:27:45 UTC
Permalink
Hi, a few thoughts:

1. The HTTP 401 Unauthorized is not the problem. That is the entirely normal way of the server telling the client that it needs to authenticate, which it then does in the next step of your output. The actual error that you need to concern yourself with is SSL read: errno -5961.

2. It is pointless for you to bother specifying --cacert since you have disabled certificate checking with -k. That said, disabling certificate checking is almost never a good idea.

3. I tried your method against my SharePoint site and my output was the same as yours up until your SSL read error. At that point, my upload finishes and SharePoint returns HTTP 201 Created. So it definitely should be possible to do an upload the way you are attempting to. My versions are different than yours: I'm using newer Curl, 7.38.0 (Debian), newer IIS, 8.5, and older SharePoint, 15.0.0.4561. My SharePoint frontends are behind an OpenSSL-based reverse proxy, so in my case the Windows SSL is not in play.

I don't know what errno -5961 means so I don't have any specific suggestions.

-mn

Loading...