etcd 开启auth认证

摘要:
一、概述1、etcd的v2和v3的认证有些不同,需要分别设置2、Etcd通过用户(user)-角色(role)-权限的方式来控制访问,用户关联角色,角色拥有权限,从而用户也就拥有了相应的权限3、Etcd开启BasicAuth之后,默认会启用两个角色root和guest,root角色拥有所有权限,guest拥有只读权限,这两个角色都不要删除二、授权v2:1、添加root,创建root后,root默认

一、概述

1、etcd的v2和v3的认证有些不同,需要分别设置
2、Etcd通过用户(user)-角色(role)-权限的方式来控制访问,用户关联角色,角色拥有权限,从而用户也就拥有了相应的权限
3、Etcd开启Basic Auth之后,默认会启用两个角色root和guest,root角色拥有所有权限,guest拥有只读权限,这两个角色都不要删除

二、授权

v2:
1、添加root,创建root后,root默认有root最高权限
etcdctl --endpoints=http://127.0.0.1:2379 user add root

2、开启认证
etcdctl --endpoints=http://127.0.0.1:2379 auth enable

3、添加一个读写账号和一个只读账号
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user add reado
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user add readw

4、添加只读角色和读写角色
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 role add readConf
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 role add rootConf

5、为角色授权
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 grant --read --path /* readConf
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 grant --readwrite --path /* rootConf

6、为用户分配角色
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user grant --roles readConf reado
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user grant --roles rootConf readw

7、常用命令
1)关闭auth
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 auth disable

2)删除用户
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user remove reado

3)用户撤销角色
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user revoke --roles readConf reado

4)修改用户密码
etcdctl --endpoints=http://127.0.0.1:2379 --username root:123456 user passwd reado

v3:
1、添加root,创建root后,root默认有root最高权限
etcdctl --endpoints=http://127.0.0.1:2379 user add root

2、创建普通用户
etcdctl --endpoints=http://127.0.0.1:2379 --user=root:123456 user add putong

3、添加角色
etcdctl --endpoints=http://127.0.0.1:2379 --user=root:123456 role add normal

4、角色授权
etcdctl --endpoints=http://127.0.0.1:2379 --user=root:123456 role grant-permission --prefix=true normal readwrite /path_name

5、用户绑定角色
etcdctl --endpoints=http://127.0.0.1:2379 --user=root:123456 user grant-role putong normal

免责声明:文章转载自《etcd 开启auth认证》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Gateway Redis令牌桶请求限流过滤器安装cfssl证书工具下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Ubuntu Linux启用root用户登录

Ubuntu Linux有一个与众不同的特点,那就是初次使用时,你无法作为root来登录系统,为什么会这样?这就要从系统的安装说起。对于其他Linux系统来 说,一般在安装过程就设定root密码,这样用户就能用它登录root帐户或使用su命令转换到超级用户身份。与之相反,Ubuntu默认安装时,并没有 给root用户设置口令,也没有启用root帐户。问题是...

VSFTP服务

概述: FTP服务器(File Transfer Protocol Server)是在互联网上提供文件存储和访问服务的计算机,它们依照FTP协议提供服务。 FTP(File Transfer Protocol: 文件传输协议)作用: Internet 上用来传送文件的协议 常见FTP服务器: windows:Serv-U FTP Server L...

nagios监控安装esxi的服务器(宿主机)

首先,该博文大部分内容来自网络,少部分是自己监控过程中遇到的问题。如果有侵权,请联系告知!!! 现在互联网公司,有能力的都是自己研发监控系统,要么就是zabbix或者小米的监控,还都二次开发等等,可能使用nagios的不是那么多。哈哈,做个记录,仅供参考!!! <准备部署使用open-Falcon(小米开源)> 以下内容大部分来自网络: 普通的...

shell知识点

各个项目以实践为主。原理及更多细节介绍,请查看官方文档: 例如:bash,grub,postfix,pam,fastcgi,httpd,rsync等诸多项目。 各种总结表格 http://www.cnblogs.com/xkfz007/archive/2012/02/02/2336318.html http://blog.sina.com.cn/s/blo...

VM虚拟机网络设置

 VM虚拟机网络设置(转) VMWare中的几种网络设置 (1)Bridged方式 用这种方式,虚拟系统的IP可设置成和本机系统在同一网段,虚拟系统相当于网络内的一台独立的机器,和本机一起插在一个Hub上,网络内其他机器可访问虚拟系统,虚拟系统也可访问网络内其他机器,当然和本机系统的双向访问也不成问题。 (2)NAT方式 这种方式也能实现本机系统和虚拟系...

etcd查看leader节点

etcd查看集群leader的节点 安装etcdctl 具体命令如下 <root@SYS-OPS-ETCD01 ~># etcdctl -w table --cert /etc/kubernetes/pki/etcd/peer.crt --key /etc/kubernetes/pki/etcd/peer.key --cacert /etc...