salt 扩展认证 PAM,能够利用PAM 认证机制对系统帐户作出功能操做上的限制html
官方文档:http://docs.saltstack.com/topics/eauth/index.htmlubuntu
编辑 /etc/salt/masterthis
<pre> external_auth: pam: salt: - '*' </pre>code
建立 salt 用户 设置密码htm
salt PAM 认证用户 只能经过 “ -a pam ” 参数才能使用文档
<pre> salt -a pam test.ping </pre>get
会提示登录用户,输入密码,若是正确返回结果,说明pam认证已经生效it
/etc/salt/masterio
external_auth: pam: admin: - '*' # 全部模块 salt: - test.ping # test.ping 模块 test: - 'dev*': # 主机配置规则 - test.ping # Salt 模块
解释:ast
实例1: 以salt用户为例,认证用户必须打开PAM 参数才能操做
<pre> salt@fabrizio-vaio:~$ salt '*' test.ping Failed to authenticate, is this user permitted to execute commands? </pre>
<pre> salt@fabrizio-vaio:~$ salt -a pam '*' test.ping username: salt password: ubuntu-master: True </pre>
实例2: 以salt用户为例,执行未受权模块被拒绝
<pre> salt@fabrizio-vaio:~$ salt -a pam '*' state.highstate username: salt password: Failed to authenticate, is this user permitted to execute commands? </pre>
实例3: 以test用户为例,操做未受权主机被拒绝 失败操做
<pre> salt@fabrizio-vaio:~$ salt -a pam '*' test username: test password: Failed to authenticate, is this user permitted to execute commands? </pre>
成功操做
<pre> salt@fabrizio-vaio:~$ salt -a pam 'test-001' test username: test password: test-001: True </pre>