etcd 开启auth认证
一、概述
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认证的更多相关文章
- Etcd安全配置之Basic Auth认证
<中小团队落地配置中心详解>文章中我们介绍了如何基于Etcd+Confd构建配置中心,最后提到Etcd的安全问题时说了可以使用账号密码认证以达到安全访问的目的,究竟该如何开启认证以及怎么设 ...
- CentOS6.8部署MongoDB集群及支持auth认证
三个节点的副本集如下图所示: 实验目的: 配置MongoDB的3节点副本集 3个节点的副本集都要开启auth认证,并且开启认证后,能互相通信 第一步 - 准备环境 准备三个虚拟机,其中一个用作Prim ...
- MongDB开启权限认证
在生产环境中MongoDB已经使用有一段时间了,但对于MongoDB的数据存储一直没有使用到权限访问(MongoDB默认设置为无权限访问限制),最近在酷壳网看了一篇技术文章(https://cools ...
- Docker Mongo数据库开启用户认证
一.启动mongo容器的几种方式 #简化版 docker run --name mongo1 -p 21117:27017 -d mongo --noprealloc --smallfiles #自定 ...
- MongoDB开启权限认证
MongoDB默认安装完后,如果在配置文件中没有加上auth = true,是没有用户权限认证的,这样对于一个数据库来说是相对不安全的,尤其是在外网的情况下. 接下来是配置权限的过程: //切入到 ...
- mongodb复制集开启安全认证
之前我有一篇博客写的是“node.js通过权限验证连接MongoDB”,这篇博客上提到如何在启动文件中通过配置auth参数来开启权限认证,但这种认证方式只适合单机节点,当我们使用复制集时应该怎么开启权 ...
- MongoDB开启安全认证
MongoDB开启安全认证 注意 对MongoDB部署启用访问控制会强制执行身份验证,要求用户识别自己.当访问启用了访问控制的MongoDB部署时,用户只能执行由其角色确定的操作. 启用访问控制后,请 ...
- mongodb分片集群开启安全认证
原文地址:https://blog.csdn.net/uncle_david/article/details/78713551 对于搭建好的mongodb副本集加分片集群,为了安全,启动安全认证,使用 ...
- 玩转Django2.0---Django笔记建站基础九(一)(Auth认证系统)
第九章 Auth认证系统 Django除了有强大的Admin管理系统之外,还提供了完善的用户管理系统.整个用户管理系统可分为三大部分:用户信息.用户权限和用户组,在数据库中分别对应数据表auth_us ...
随机推荐
- NGINX 配置清单
以下内容来自 SimulatedGREG/nginx-cheatsheet. 通用设置 端口 listen server { # standard HTTP protocol listen 80; # ...
- HTTP 响应的分块传输
Transfer-Encoding 响应头用于告诉客户端服务器发送内容的编码格式. 其可选值有: chunked:数据分块发送.此时应缺省 Content-Length 响应头. compress:使 ...
- Web前端基础(7):JavaScript(一)
1. JavaScript概述 1.1 JavaScript历史背景介绍 布兰登 • 艾奇(Brendan Eich,1961年-),1995年在网景公司,发明的JavaScript. 一开始Java ...
- PHP+Mysql查询上一篇和下一篇文章实例
简单的PHP+Mysql查询上一篇和下一篇文章实例,并输出上一篇和下一篇文章的标题和链接,适合新手学习 获取当前浏览文章id: $id = isset($_GET['id']) > 0 ? in ...
- Falling back to java on path. This behavior is deprecated
windows启动elasticsearch报错:warning: Falling back to java on path. This behavior is deprecated. Specify ...
- CodeForces - 1260C(贪心+思维)
题意 https://vjudge.net/problem/CodeForces-1260C 有一串砖,凡是r的倍数而不是b的倍数必须涂红,凡是b的倍数而不是r的倍数必须涂蓝,是公倍数则选一个涂.把涂 ...
- pyspark 使用时环境设置
在脚本中导入pyspark的流程 import os import sys spark_name = os.environ.get('SPARK_HOME',None) # SPARK_HOME即sp ...
- UGUI Manual
以Unity 5.5 的官方文档为例 Canvas UI元素的前后顺序:SetAsFirstSibling, SetAsLastSibling, and SetSiblingIndex BasicLa ...
- Node版本管理器NVM常用命令
NVM是什么?nvm (Node Version Manager) 是Nodejs版本管理器,可对不同的node版本快速进行切换. 为什么要用NVM?基于node的工具和项目越来越多,但是每个项目使用 ...
- 初学JavaScript正则表达式(十一)
JavaScript的对象属性 整理自慕课网教学 点此进入