Saltstack api wheel module error HTTP/1.1 401 Unauthorized
An error with no permission will occur when calling the wheel module using saltstack api
[root@ntest1] # curl-k-v https://localhost:8000-H "Accept: application/x-yaml"-H "X-Auth-Token: 65198e689eb5e720ce75970a4b10da91dc003211"-d client='wheel'-d fun='key.list_all'* About to connect () to localhost port 8000 (# 0) * Trying:: 1. Connection refused* Trying 127.0.0.1... Connected* Connected to localhost (127.0.0.1) port 8000 (# 0) * Initializing NSS with certpath: sql:/etc/pki/nssdb* warning: ignoring value of ssl.verifyhost* skipping SSL peer certificate verification* SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA* Server certificate:* subject: O=Default Company Ltd,L=Default City,C=XX* start date: Feb 15 09:34:13 2016 GMT* expire date: Feb 14 09:34:13 2017 GMT* common name: (nil) * issuer: O=Default Company Ltd,L=Default City C=XX > POST / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh3/1.4.2 > Host: localhost:8000 > Accept: application/x-yaml > X-Auth-Token: 65198e689eb5e720ce75970a4b10da91dc003211 > Content-Length: 29 > Content-Type: application/x-www-form-urlencoded > < HTTP/1.1 401 Unauthorized < Content-Length: 735 < Access-Control-Expose-Headers: GET POST < Access-Control-Allow-Credentials: true < Vary: Accept-Encoding < Server: CherryPy/3.2.2 < Allow: GET, HEAD, POST < Cache-Control: private < Date: Fri, 05 May 2017 15:16:50 GMT < Access-Control-Allow-Origin: * < Content-Type: text/html Charset=utf-8 < Set-Cookie: session_id=65198e689eb5e720ce75970a4b10da91dc003211; expires=Sat, 06 May 2017 01:16:50 GMT; Path=/ < 401 Unauthorized # powered_by {margin-top: 20px; border-top: 2px solid black; font-style: italic;} # traceback {color: red;} 401 Unauthorized
No permission-see authorization schemes
Powered by CherryPy 3.2.2 * Connection # 0 to host localhost left intact* Closing connection # 0
You need to modify the configuration of master to authorize saltapi users
[root@test1 ~] # vim / etc/salt/masterexternal_auth: pam: saltapi: -. * -'@ wheel' [root@test1 ~] # / etc/init.d/salt-master restartStopping salt-master daemon: [OK] Starting salt-master daemon: [OK]
Re-execute the command, execute successfully
[root@ntest1] # curl-k https://localhost:8000-H "Accept: application/x-yaml"-H "X-Auth-Token: bb8bc594d3e9d7de6105046a07c9b2ba619161b2"-d client='wheel'-d fun='key.list_all'return:- data: _ stamp: '2017-05-05-05T15purl 19pur47.532569' fun: wheel.key.list_all jid:' 20170505231946757429 'return: local: -master.pem-master.pub minions:-test1.nginxs.net-test2.nginxs.net-test3.nginxs.net-test4.nginxs.net minions_denied: [] minions_pre:-test5.nginxs.net-test6.nginxs.net-test7.nginxs.net-test8.nginxs.net minions_rejected: [] success: true tag: Salt/wheel/20170505231946757429 user: saltapi tag: salt/wheel/20170505231946757429