Installation

1
yum -y install salt-api

Configuration

cat /etc/salt/master.d/api.conf # Configure certificate and port

1
2
3
4
5
rest_cherrypy:
  port: 8888
  debug: True
  ssl_crt: /etc/pki/tls/certs/localhost.crt
  ssl_key: /etc/pki/tls/private/localhost_nopass.key

cat /etc/salt/master.d/eauth.conf # Set permissions

1
2
3
4
5
6
external_auth:
  pam:
    saltapi:
      - .*
      - '@wheel'
      - '@runner'

Add User

1
2
useradd -M -s /sbin/nologin saltapi
echo "saltapi_xxxxxx" | passwd saltapi --stdin

Start Service

1
2
systemctl enable salt-api
systemctl start salt-api

Test

Test using curl to obtain token information:

1
2
3
4
curl -k https://manage-op.test.cn:8888/login -H "Accept: application/x-yaml" \
-d username='saltapi' \
-d password='saltapi_xxxxxxxx' \
-d eauth='pam'

If using Python or Go, you can wrap your own client.