Search code examples
curlcherrypysalt-stack

How to debug curl request for salt-api?


I have salt masters and salt-api services on Ubuntu servers. I'm trying to verify connection, using this command:

curl -sSk https://<MY-URL>/login \
    -H 'Accept: application/x-yaml' \
    -d username=<MY-LOGIN> \
    -d password=<MY-PASSWORD> \
    -d eauth=ldap

Wierd thing is - from some machines (linux servers) I'm getting correct response, but from other I'm getting error like this:

<h2>401 Unauthorized</h2>
        <p>Could not authenticate using provided credentials</p>
        <pre id="traceback">Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python3/dist-packages/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/netapi/rest_cherrypy/app.py", line 858, in hypermedia_handler
    ret = cherrypy.serving.request._hypermedia_inner_handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python3/dist-packages/salt/netapi/rest_cherrypy/app.py", line 1870, in POST
    401, "Could not authenticate using provided credentials"
cherrypy._cperror.HTTPError: (401, 'Could not authenticate using provided credentials')

What could I check to debug this? I can provide any information about servers, if needed.


Solution

  • Problem was in salt-master. pip packages python-ldap and some other were absent