zoukankan      html  css  js  c++  java
  • saltstack之(三)认证管理

    salt-master和salt-minion之间需要进行认证,认证之后salt-master才能管理salt-minion。

    1.在node1:
    [root@node1 ~]# egrep -v '^#|^$' /etc/salt/minion
    master: 192.168.3.1
    id: 192.168.3.1

    启动服务并添加开机启动。
    node1:
    service salt-master start
    chkconfig salt-master on
    service salt-minion start
    chkconfig salt-minion on


    2.在node2:
    [root@node2 ~]# egrep -v '^#|^$' /etc/salt/minion
    master: 192.168.3.1
    id: 192.168.3.2

    启动服务并添加开机启动。
    node2:
    service salt-minion start
    chkconfig salt-minion on

    3.在node1端查看:
    [root@node1 ~]# salt-key -L
    Accepted Keys:
    Denied Keys:
    Unaccepted Keys:
    192.168.3.1
    192.168.3.2
    Rejected Keys:


    4.salt-master接受minion客户端的认证。

    方法一:使用单个认证的方法
    [root@node1 ~]# salt-key -a 192.168.3.1
    The following keys are going to be accepted:
    Unaccepted Keys:
    192.168.3.1
    Proceed? [n/Y] y
    Key for minion 192.168.3.1 accepted.

    *注释:如果此处不想出现提示:salt-key -y -a 192.168.3.1

    [root@node1 ~]# salt-key -L
    Accepted Keys:
    192.168.3.1
    Denied Keys:
    Unaccepted Keys:
    192.168.3.2
    Rejected Keys:

    方法二:使用全部认证的方法:
    [root@node1 ~]# salt-key -A
    The following keys are going to be accepted:
    Unaccepted Keys:
    192.168.3.2
    Proceed? [n/Y] y
    Key for minion 192.168.3.2 accepted.

    方法三:使用配置文件自动发现minion并完成认证。
    编辑配置文件/etc/salt/master,修改如下参数auto_accept: True
    sed -i '/^auto_accept/s;False;True;g' /etc/salt/master
    重新启动服务。
    service salt-master restart

    *注释: 安全起见,不建议修改此参数的值为:True


    5.删除客户端认证
    [root@node1 ~]# salt-key -L
    Accepted Keys:
    192.168.3.1
    192.168.3.2
    Denied Keys:
    Unaccepted Keys:
    Rejected Keys:
    [root@node1 ~]# salt-key -d 192.168.3.1
    The following keys are going to be deleted:
    Accepted Keys:
    192.168.3.1
    Proceed? [N/y] y
    Key for minion 192.168.3.1 deleted.
    [root@node1 ~]# salt-key -L
    Accepted Keys:
    192.168.3.2
    Denied Keys:
    Unaccepted Keys:
    Rejected Keys:

    *注释:删除所有的使用-D参数,同样不想出现是否确认删除,使用-y参数。


    6.简单功能测试
    [root@node1 ~]# salt '*' test.ping
    192.168.3.2:
    True
    192.168.3.1:
    True

  • 相关阅读:
    E. XOR and Favorite Number (莫队板子题)
    bzoj 2038: [2009国家集训队]小Z的袜子(hose)
    世风日下的哗啦啦族I (简单分块模板)
    Turtles (非纯分块)
    楼房重建
    智商问题
    A
    51 Nod 1640 天气晴朗的魔法( Kruskall )
    后缀数组
    51nod 1562 玻璃切割 (set)
  • 原文地址:https://www.cnblogs.com/xkops/p/5482398.html
Copyright © 2011-2022 走看看