AnsweredAssumed Answered

Getting HTTP Code 400 from every request

Question asked by NStefanisko on Dec 11, 2017
Latest reply on Dec 11, 2017 by NStefanisko

Using a browser from Windows works just fine, but when I try to use Curl from Linux I have a problem.

What am I doing wrong?

 

  1. kinit -f   to get a forwardable ticket
  2. curl -k --negotiate -u : -H "Accept:application/json; charset=utf-8" -H "Accept-Language:en-US,en;q=0.9" -H "Content-Type: application/json"  -X GET -v https://<myhost>/piwebapi/system/userinfo

 

results: initial request returns a 401/Unauthorized, then security is negotiated, and 400/Bad Request with no data is returned

 

*   Trying <myhost>...

* Connected to <myhost> (<myhost>) port <myport> (#0)

* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH

* successfully set certificate verify locations:

*   CAfile: none

  CApath: /etc/ssl/certs/

* TLSv1.2, TLS handshake, Client hello (1):

* TLSv1.2, TLS handshake, Server hello (2):

* TLSv1.2, TLS handshake, CERT (11):

* TLSv1.2, TLS handshake, Server key exchange (12):

* TLSv1.2, TLS handshake, Server finished (14):

* TLSv1.2, TLS handshake, Client key exchange (16):

* TLSv1.2, TLS change cipher, Client hello (1):

* TLSv1.2, TLS handshake, Finished (20):

* TLSv1.2, TLS change cipher, Client hello (1):

* TLSv1.2, TLS handshake, Finished (20):

* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA384

* Server certificate:

<... blah blah blah ...>

> GET /piwebapi/system/userinfo HTTP/1.1

> Host: <myhost>:<myport>

> User-Agent: curl/7.42.1

> Accept:application/json; charset=utf-8

> Accept-Language:en-US,en;q=0.9

> Content-Type: application/json

>

< HTTP/1.1 401 Unauthorized

< Transfer-Encoding: chunked

< Content-Type: application/json; charset=utf-8

< Server: Microsoft-HTTPAPI/2.0

< X-Frame-Options: SAMEORIGIN

< WWW-Authenticate: Negotiate

< Date: Mon, 11 Dec 2017 01:00:11 GMT

<

* Ignoring the response-body

* Connection #0 to host <myhost> left intact

* Issue another request to this URL: 'https://<myhost>:<myport>/piwebapi/system/userinfo'

* Found bundle for host <myhost>: 0x794df0

* Re-using existing connection! (#0) with host <myhost>

* Connected to <myhost> (<myhost>) port <myport> (#0)

* Server auth using Negotiate with user ''

> GET /piwebapi/system/userinfo HTTP/1.1

> Host: <myhost>:<myport>

> Authorization: Negotiate

> User-Agent: curl/7.42.1

<... blah blah blah ...>

> Accept:application/json; charset=utf-8

> Accept-Language:en-US,en;q=0.9

> Content-Type: application/json

>

< HTTP/1.1 400 Bad Request

< Content-Length: 0

< Server: Microsoft-HTTPAPI/2.0

< Date: Mon, 11 Dec 2017 01:00:11 GMT

<

* Closing connection 0

* TLSv1.2, TLS alert, Client hello (1):

Outcomes