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>