Installation
1
| yum -y install salt-api
|
Configuration
cat /etc/salt/master.d/api.conf #Configure certificates and ports
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 an account
1
2
| useradd -M -s /sbin/nologin saltapi
echo "saltapi_xxxxxx" | passwd saltapi --stdin
|
Start the service
1
2
| systemctl enable salt-api
systemctl start salt-api
|
Test
curl test and get 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 you use python or golang, you can encapsulate the client yourself