patroni+etcd开启SSL认证(三个节点证书一致 使用openssl命令)
瀚高数据库
目录
环境
文档用途
详细信息
环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:14
文档用途
本文主要介绍Patroni架构中如何开启etcd的ssl证书认证。
详细信息
一、前提说明
patroni版本:3.0.2
etcd版本:3.5.7
数据库版本:14.4
OS版本:redhat7.7
二、自签名CA证书及私钥
1、私钥生成
[root@patroni8 ssl]# openssl genrsa -out ca-key.pem 2048
Generating RSA private key, 2048 bit long modulus
.....................................+++
.............................+++
e is 65537 (0x10001)
2、自签名证书生成
填写以下内容,其余的回车跳过
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:SD
Locality Name (eg, city) [Default City]:JN
Common Name (eg, your name or your server’s hostname) []:etcd
[root@patroni8 ssl]# openssl req -new -x509 -key ca-key.pem -out ca.pem -days 365
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:SD
Locality Name (eg, city) [Default City]:JN
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:etcd
Email Address []:
[root@patroni8 ssl]# ls
ca-key.pem ca.pem
3、etcd私钥生成
[root@patroni8 ssl]# openssl genrsa -out server-key.pem 2048
Generating RSA private key, 2048 bit long modulus
.....+++
...............+++
e is 65537 (0x10001)
4、编辑配置文件,生成etcd证书
[root@patroni8 ssl]# vi openssl.cnf
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = CN
ST = SD
L = JN
CN = etcd
[v3_req]
subjectAltName = @alt_names
[alt_names]
IP.1 = 192.168.11.16
IP.2 = 192.168.11.17
IP.3 = 192.168.11.18
5、生成etcd证书
[root@patroni8 ssl]# openssl req -new -key server-key.pem -out server.csr -subj "/CN=etcd-server" -config openssl.cnf
[root@patroni8 ssl]# ls
ca-key.pem ca.pem openssl.cnf server.csr server-key.pem
[root@patroni8 ssl]# openssl x509 -req -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server.pem -days 365 -extensi ons v3_req -extfile openssl.cnf
Signature ok
subject=/C=CN/ST=SD/L=JN/CN=etcd
Getting CA Private Key
[root@patroni8 ssl]# ls
ca-key.pem ca.pem ca.srl openssl.cnf server.csr server-key.pem server.pem
[root@patroni8 ssl]# ls -lrth
total 28K
-rw-r--r--. 1 root root 1.7K May 15 11:20 ca-key.pem
-rw-r--r--. 1 root root 1.3K May 15 11:28 ca.pem
-rw-r--r--. 1 root root 1.7K May 15 11:29 server-key.pem
-rw-r--r--. 1 root root 255 May 15 11:33 openssl.cnf
-rw-r--r--. 1 root root 1001 May 15 11:33 server.csr
-rw-r--r--. 1 root root 17 May 15 11:34 ca.srl
-rw-r--r--. 1 root root 1.2K May 15 11:34 server.pem
6、将私钥证书复制到其他节点
[root@patroni8 ssl]# scp ca-key.pem ca.pem server.pem server-key.pem root@192.168.11.17:/opt/etcd/ssl
[root@patroni8 ssl]# scp ca-key.pem ca.pem server.pem server-key.pem root@192.168.11.16:/opt/etcd/ssl
7、修改各节点etcd配置文件,将http换为https
编辑/opt/etcd/etcd.yaml文件
debug: false
name: etcd03
data-dir: /opt/etcd/data
initial-advertise-peer-urls: https://192.168.11.18:2380
listen-peer-urls: https://192.168.11.18:2380
advertise-client-urls: https://192.168.11.18:2379
listen-client-urls: https://192.168.11.18:2379,https://127.0.0.1:2379
initial-cluster-token: etcd-cluster
initial-cluster: etcd01=https://192.168.11.16:2380,etcd02=https://192.168.11.17:2380,etcd03=https://192.168.11.18:2380
initial-cluster-state: newclient-transport-security:cert-file: /opt/etcd/ssl/server.pemkey-file: /opt/etcd/ssl/server-key.pemclient-cert-auth: truetrusted-ca-file: /opt/etcd/ssl/ca.pemauto_tls: truepeer-transport-security:cert-file: /opt/etcd/ssl/server.pemkey-file: /opt/etcd/ssl/server-key.pemclient-cert-auth: truetrusted-ca-file: /opt/etcd/ssl/ca.pemauto_tls: trueenable-v2: true
8、各节点开启etcd并验证tls通信,注意,无法使用环境变量,如果环境变量冲突,注释掉对应的环境变量。
[root@patroni8 ssl]# systemctl start etcd
验证etcd开启tls
[root@patroni6 etcd]# etcdctl --endpoints=https://192.168.11.16:2379,https://192.168.11.17:2379,https://192.168.11.18:2379 --cacert=/opt/etcd/ssl/ca.pem --cert=/opt/etcd/ssl/server.pem --key=/opt/etcd/ssl/server-key.pem endpoint health
https://192.168.11.18:2379 is healthy: successfully committed proposal: took = 12.05254ms
https://192.168.11.16:2379 is healthy: successfully committed proposal: took = 12.007163ms
https://192.168.11.17:2379 is healthy: successfully committed proposal: took = 12.344144ms[root@patroni6 patroni]# ETCDCTL_API=2 etcdctl --endpoints=https://192.168.11.16:2379,https://192.168.11.17:2379,https://192.168.11.1 8:2379 --ca-file=/opt/etcd/ssl/ca.pem --cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem cluster-health
member 421aadb231b71fa1 is healthy: got healthy result from https://192.168.11.17:2379
member 61a0b36ccbf8f9bf is healthy: got healthy result from https://192.168.11.18:2379
member 910f6ce438f0d4dd is healthy: got healthy result from https://192.168.11.16:2379
cluster is healthy
三、patroni配置ssl
1、配置patroni文件中的etcd部分
etcd:#配置etcd所有节点的访问IP及端口hosts: 192.168.11.16:2379,192.168.11.17:2379,192.168.11.18:2379protocol: httpscert: /opt/etcd/ssl/server.pemkey: /opt/etcd/ssl/server-key.pemcacert: /opt/etcd/ssl/ca.pem
# username: root
# password: 123456
2、启动patroni
systemctl start patroni
四、注意事项
1、如果报错是CA是自签名的不可信,需要将证书添加到可信存储中,每个节点都执行
cp ca.pem /etc/pki/ca-trust/source/anchors/update-ca-trust
相关文章:
patroni+etcd开启SSL认证(三个节点证书一致 使用openssl命令)
瀚高数据库 目录 环境 文档用途 详细信息 环境 系统平台:Linux x86-64 Red Hat Enterprise Linux 7 版本:14 文档用途 本文主要介绍Patroni架构中如何开启etcd的ssl证书认证。 详细信息 一、前提说明 patroni版本:3.0.2 etcd版本&#x…...
Eureka入门指南:微服务注册与发现的基础概念
Eureka入门指南:微服务注册与发现的基础概念 引言 随着微服务架构的普及,微服务之间的高效通信和管理成为了开发和运维的核心挑战之一。为了解决服务发现和管理问题,Netflix推出了Eureka,一个功能强大的服务注册和发现工具。Eur…...
Linux:动态库和静态库
静态库与动态库 A:静态库(.a):程序在编译链接的时候把库的代码链接到可执行文件中。程序运行的时候将不再需要静态库。 B:动态库(.so):程序在运行的时候才去链接动态库的代码&#…...
8.13网络编程
笔记 多点通信 一、套接字属性 套接字属性的获取和设置 #include <sys/types.h> /* See NOTES */#include <sys/socket.h>int getsockopt(int sockfd, int level, int optname,void *optval, socklen_t *optlen);int setsockopt(int sockfd, int level…...
蚂蚁AL1 15.6T 创新科技的新典范
● 哈希率:算力达到15.6T(相当于15600G),即每秒能够进行15.6万亿次哈希计算,在同类产品中算力较为出色,能提高WA掘效率。 ● 功耗:功耗为3510W,虽然数值看似不低,但结合其…...
2024年【汽车驾驶员(技师)】考试报名及汽车驾驶员(技师)试题及解析
题库来源:安全生产模拟考试一点通公众号小程序 汽车驾驶员(技师)考试报名参考答案及汽车驾驶员(技师)考试试题解析是安全生产模拟考试一点通题库老师及汽车驾驶员(技师)操作证已考过的学员汇总…...
2024年【甘肃省安全员C证】报名考试及甘肃省安全员C证考试总结
题库来源:安全生产模拟考试一点通公众号小程序 甘肃省安全员C证报名考试参考答案及甘肃省安全员C证考试试题解析是安全生产模拟考试一点通题库老师及甘肃省安全员C证操作证已考过的学员汇总,相对有效帮助甘肃省安全员C证考试总结学员顺利通过考试。 1、…...
RabbitMQ 双机系统偶尔丢失消息问题排查
实话说起来,这个问题,实际是一个非常低级的错误导致的,算不得什么高深的技术问题。但是在排查的过程中,却是费了好大的功夫,死了不少脑细胞。所以也值得记录一下,算作给大家提个醒,或许可以帮大…...
Python 环境搭建指南 超详细
Python是由荷兰⼈吉多范罗苏姆(Guido von Rossum,后⾯都称呼他为Guido)发明的⼀种编程语言 1. 1989年圣诞节:Guido开始写Python语⾔的编译器。2. 1991年2⽉:第⼀个Python解释器诞⽣,它是⽤C语⾔实现的&…...
使用三菱PLC源码进行PLC读取写入操作
安装 MX Component 。 我的安装地址在: 打开 utl 文件夹下的 Communication Settings Utility 执行。 配置PLC 添加当前需要配置的PLC 注意 logical station Namber 就是程序里需要对接的逻辑站点编号 5.配置选择对应的COM操作选择对应的cpu型型号,…...
使用Nvm切换nodeJs高版本之后,使用npm install一闪而过
先说现象,最近又有几个项目接手,其中有一个使用NVM切换至高版本node后,出现如下症状; 没有任何提示,然后翻看文件目录,node_modules目录没有创建,同时在全局 npm config set prefix 设置的目录下 多了一个 pgn的快捷,指向项目目录。 使用百度或者chart-gtp,搜索到的答案…...
【Kubernetes】k8s集群安全机制
目录 一.认证 1.k8s集群内的三种认证方式 2.k8s集群内的认证说明 2.1.需要被认证的访问类型 2.2.安全性说明 2.3.证书颁发的方式 2.4.kubeconfig 2.5.Service Account 2.6.Secret 与 SA 的关系 二.鉴权 1.鉴权的方式 2.RBAC的角色与角色绑定 2.1.RBAC的角色 2.2…...
嵌入式学习---DAY24:进程--二
一、exec函数族----启动一个新程序 用fork创建子进程后执行的是和父进程相同的程序(但有可能执行不同的代码分支), 子进程往往要调用一种exec函数以执行另一个程序。当进程调用一种exec函数时,该进程的 用户空间代码和数据完全被…...
Diffusion Model相关论文解析之(二)DENOISING DIFFUSION IMPLICIT MODELS
目录 1、摘要2、创新点3、主要公式4、自己的理解,对错不确定 1、摘要 Denoising Diffusion Implicit Models (DDIM)是一种扩散模型的改进版本,旨在加速采样过程并提高采样速度。DDIM通过引入非马尔可夫扩散过程,相对于传统的去噪扩散概率…...
【STM32嵌入式系统设计与开发拓展】——14_定时器之输入捕获
参考哔站:链接: 铁头山羊 一、微控制器的高级定时与控制功能集合 1、时基单元 2、输入捕获 3、输出比较 4、从模式控制器 5、高级定时器的输出控制 二、问题集合 1、什么是定时器 定时器是一种专门负责定时功能的片上外设GPI0AFI0EXTIUSART RCC I2C) 2、定时器…...
docker swarm如何让两个副本分别跑在两台不同的主机上
虽然 docker swarm 支持自动扩容部署,但是为了服务的稳定性、可靠性,有的时候甲方巴巴会要求一定要服务分散部署在不同的服务器上。 使用默认的部署方式,虽然副本为 N,但是部署的 N 个服务可能落在同一台服务器上。 在 Docker Swa…...
GPT助手的训练流程四个主要阶段( GPT Assistant training pipeline )
GPT助手的训练流程四个主要阶段( GPT Assistant training pipeline ) flyfish 四个阶段 预训练(pre-training) 监督微调(supervised fine tuning, SFT) 奖励建模(reward modeling)…...
网络如何发送一个数据包
网络如何发送一个数据包 网络消息发送就是点一点屏幕。 骚瑞,这一点都不好笑。(小品就是我的本质惹) 之前我就是会被这个问题搞的不安宁。是怎么知道对方的IP地址的呢?怎么知道对方的MAC呢?世界上计算机有那么多&…...
【Harmony OS 4.0】向上滑动加载案例
// 自定义class类对象类型 class Article {public id: numberpublic title: stringpublic content: stringconstructor(id: number, title: string, content: string) {this.id idthis.title titlethis.content content} }// 子组件 Component struct ArticleComponent {Pro…...
SQL基础教程(八)SQL高级处理
※食用指南:文章内容为《SQL基础教程》系列学习笔记,该书对新手入门非常友好,循序渐进,浅显易懂,本人主要用来补全学习MySQL中未涉及的部分,便于刷题和做项目。 官方电子书:《SQL基础教程》第2…...
Vim 调用外部命令学习笔记
Vim 外部命令集成完全指南 文章目录 Vim 外部命令集成完全指南核心概念理解命令语法解析语法对比 常用外部命令详解文本排序与去重文本筛选与搜索高级 grep 搜索技巧文本替换与编辑字符处理高级文本处理编程语言处理其他实用命令 范围操作示例指定行范围处理复合命令示例 实用技…...
Chapter03-Authentication vulnerabilities
文章目录 1. 身份验证简介1.1 What is authentication1.2 difference between authentication and authorization1.3 身份验证机制失效的原因1.4 身份验证机制失效的影响 2. 基于登录功能的漏洞2.1 密码爆破2.2 用户名枚举2.3 有缺陷的暴力破解防护2.3.1 如果用户登录尝试失败次…...
SkyWalking 10.2.0 SWCK 配置过程
SkyWalking 10.2.0 & SWCK 配置过程 skywalking oap-server & ui 使用Docker安装在K8S集群以外,K8S集群中的微服务使用initContainer按命名空间将skywalking-java-agent注入到业务容器中。 SWCK有整套的解决方案,全安装在K8S群集中。 具体可参…...
Oracle查询表空间大小
1 查询数据库中所有的表空间以及表空间所占空间的大小 SELECTtablespace_name,sum( bytes ) / 1024 / 1024 FROMdba_data_files GROUP BYtablespace_name; 2 Oracle查询表空间大小及每个表所占空间的大小 SELECTtablespace_name,file_id,file_name,round( bytes / ( 1024 …...
质量体系的重要
质量体系是为确保产品、服务或过程质量满足规定要求,由相互关联的要素构成的有机整体。其核心内容可归纳为以下五个方面: 🏛️ 一、组织架构与职责 质量体系明确组织内各部门、岗位的职责与权限,形成层级清晰的管理网络…...
镜像里切换为普通用户
如果你登录远程虚拟机默认就是 root 用户,但你不希望用 root 权限运行 ns-3(这是对的,ns3 工具会拒绝 root),你可以按以下方法创建一个 非 root 用户账号 并切换到它运行 ns-3。 一次性解决方案:创建非 roo…...
论文解读:交大港大上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(一)
宇树机器人多姿态起立控制强化学习框架论文解析 论文解读:交大&港大&上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(一) 论文解读:交大&港大&上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化…...
OpenPrompt 和直接对提示词的嵌入向量进行训练有什么区别
OpenPrompt 和直接对提示词的嵌入向量进行训练有什么区别 直接训练提示词嵌入向量的核心区别 您提到的代码: prompt_embedding = initial_embedding.clone().requires_grad_(True) optimizer = torch.optim.Adam([prompt_embedding...
Reasoning over Uncertain Text by Generative Large Language Models
https://ojs.aaai.org/index.php/AAAI/article/view/34674/36829https://ojs.aaai.org/index.php/AAAI/article/view/34674/36829 1. 概述 文本中的不确定性在许多语境中传达,从日常对话到特定领域的文档(例如医学文档)(Heritage 2013;Landmark、Gulbrandsen 和 Svenevei…...
【分享】推荐一些办公小工具
1、PDF 在线转换 https://smallpdf.com/cn/pdf-tools 推荐理由:大部分的转换软件需要收费,要么功能不齐全,而开会员又用不了几次浪费钱,借用别人的又不安全。 这个网站它不需要登录或下载安装。而且提供的免费功能就能满足日常…...
