Elastic Stack 证书创建
1.创建CA证书
./bin/elasticsearch-certutil ca
# 默认文件名:elastic-stack-ca.p12
2.生成节点使用的证书
./bin/elasticsearch-certutil cert \
--ca elastic-stack-ca.p12 \
--dns localhost \
--ip 127.0.0.1,::1 \
--out config/certs/node-1.p12
# --ca为CA证书路径名称
# -dns为节点DNS
# --ip为节点ip
# --out为生成节点证书的路径和名称等,输出文件是PKCS#12密钥库,其中包括节点证书,节点密钥和CA证书
# 或者使用命令 bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 效果跟上面这个一样,生成一个p12结尾的证书
提取出pem证书
# elastic-certificates.p12为上一步节点证书
openssl pkcs12 -in elastic-certificates.p12 -cacerts -nokeys -out elastic-ca.pem
不知道是啥的证书
bin/elasticsearch-certutil ca --pem (elastic-stack-ca.zip)
inflating: ca/ca.crt
inflating: ca/ca.key
批量生成证书
# 创建实例 yaml 文件
vi ~/tmp/cert_blog/instance.yml
# 将实例信息添加到 yml 文件
instances:
- name: 'node1'
dns: [ 'node1.elastic.test.com' ]
- name: "node2"
dns: [ 'node2.elastic.test.com' ]
- name: 'my-kibana'
dns: [ 'kibana.local' ]
- name: 'logstash'
dns: [ 'logstash.local' ]
# 生成 CA 和服务器证书
bin/elasticsearch-certutil cert ca --pem --in instance.yml --out certs.zip
# 会生成一个压缩包,解压后会有一个ca文件夹和各以name命令的文件夹,包含文件如下
cat instance.yml
instances:
- name: '192.168.75.20'
dns: ['192.168.75.20']
- name: '192.168.75.21'
dns: ['192.168.75.21']
- name: '192.168.75.22'
dns: ['192.168.75.22']
- name: '192.168.75.23'
dns: ['192.168.75.23']
bin/elasticsearch-certutil cert ca --pem --in instance.yml --out certs.zip
unzip certs.zip
tree ca/
ca/
└── ca.crt
tree 192.168.75.2*
192.168.75.20
├── 192.168.75.20.crt
└── 192.168.75.20.key
192.168.75.21
├── 192.168.75.21.crt
└── 192.168.75.21.key
192.168.75.22
├── 192.168.75.22.crt
└── 192.168.75.22.key
192.168.75.23
├── 192.168.75.23.crt
└── 192.168.75.23.key
官方文档证书生成
# cat instance.yml
instances:
- name: "node1"
ip:
- "192.0.2.1"
dns:
- "node1.mydomain.com"
- name: "node2"
ip:
- "192.0.2.2"
- "198.51.100.1"
- name: "node3"
- name: "node4"
dns:
- "node4.mydomain.com"
- "node4.internal"
- name: "CN=node5,OU=IT,DC=mydomain,DC=com"
filename: "node5"
bin/elasticsearch-certutil cert --silent --in instances.yml --out test1.zip --pass testpassword
unzip test1.zip
# tree node*
node1
└── node1.p12
node2
└── node2.p12
node3
└── node3.p12
node4
└── node4.p12
node5
└── node5.p12
bin/elasticsearch-certutil csr --silent --in instances.yml --out test2.zip --pass testpassword
unzip test2.zip
# tree node*
node1
├── node1.csr
└── node1.key
node2
├── node2.csr
└── node2.key
node3
├── node3.csr
└── node3.key
node4
├── node4.csr
└── node4.key
node5
├── node5.csr
└── node5.key
官方地址:https://www.elastic.co/guide/en/elasticsearch/reference/master/encrypting-communications-certificates.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.5/certutil.html
分离p12(或pfx)文件中的证书和私钥
p12(或者pfx)文件里一般存放有CA的根证书,用户证书和用户的私钥
假设我们有一个test.p12文件,在安装了openssl的linux服务器上执行以下命令:
提取用户证书:
openssl pkcs12 -in test.p12 -clcerts -nokeys -out cert.pem //pem格式
openssl pkcs12 -in test.p12 -clcerts -nokeys -out cert.crt //crt格式
如果需要携带秘钥,则去掉 -nokeys
openssl pkcs12 -in test.p12 -clcerts -out cert.pem //pem格式
openssl pkcs12 -in test.p12 -clcerts -out cert.crt //crt格式
提取私钥:
openssl pkcs12 -in test.p12 -nocerts -out key.pem
清除秘钥中的密码(在把秘钥部署到某些服务器上时可能需要清除密码)
openssl rsa -in key.pem -out newkey.pem
在java中pkcs12 和jks的相互转换:
# JKS → P12
keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12
# P12 → JKS
keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks
Elastic Stack 证书创建的更多相关文章
- Elastic Stack
Elastic Stack 开发人员不能登陆线上服务器查看详细日志 各个系统都有日志,日志数据分散难以查找 日志数据量大,查询速度慢,或者数据不够实时 官网地址:https://www.elastic ...
- Elastic Stack之kibana入门
为了解决公司的项目在集群环境下查找日志不便的问题,我在做过简单调研后,选用Elastic公司的Elastic Stack产品作为我们的日志收集,存储,分析工具. Elastic Stack是ELK(E ...
- Elastic Stack之kibana使用
Elastic Stack之kibana使用 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 本篇博客数据流走向:FileBeat ===>Redis ===>log ...
- Elastic Stack之Logstash进阶
Elastic Stack之Logstash进阶 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.使用GeoLite2和logstash 过滤插件的geoip案例 1>. ...
- Elastic Stack之搜索引擎基础
Elastic Stack之搜索引擎基础 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.搜索引擎概述 1>.什么是搜索引擎 搜索引擎(Search Engine)是指根 ...
- Elastic Stack之ElasticSearch分布式集群二进制方式部署
Elastic Stack之ElasticSearch分布式集群二进制方式部署 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 想必大家都知道ELK其实就是Elasticsearc ...
- Elastic Stack之ElasticSearch分布式集群yum方式搭建
Elastic Stack之ElasticSearch分布式集群yum方式搭建 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.搜索引擎及Lucene基本概念 1>.什么 ...
- Elastic Stack 安装
Elastic Stack 是一套支持数据采集.存储.分析.并可视化全面的分析工具,简称 ELK(Elasticsearch,Logstash,Kibana)的缩写. 安装Elastic Stack ...
- Spring Boot + Elastic stack 记录日志
原文链接:https://piotrminkowski.wordpress.com/2019/05/07/logging-with-spring-boot-and-elastic-stack/ 作者: ...
随机推荐
- selenium和AutoIt工具辅助下载和上传
上传 根据AutoIt Windows Info 所识别到的控件信息打开SciTE Script Editor编辑器,编写脚本. ;ControlFocus("title",&qu ...
- [b0014] HDFS 常用JAVA 操作实战
目的: 学习用java进行的常用hdfs操作 参考: [b0002] Hadoop HDFS cmd常用命令练手 环境: hadoop2.6.4 win7 下的eclipse环境调试已经配置好,参考前 ...
- Asp.Net六大内置对象
前面学习mvc管道处理模型的时候,我们晓的HttpContext是贯穿全文的一个对象,在HttpRuntime产生,现在我们所谓的Asp.Net六大内置对象,其实就是HttpContext的属性.具体 ...
- UVa 202 Repeating Decimals 题解
The decimal expansion of the fraction 1/33 is 0.03, where the 03 is used to indicate that the cycle ...
- Transformer模型---decoder
一.结构 1.编码器 Transformer模型---encoder - nxf_rabbit75 - 博客园 2.解码器 (1)第一个子层也是一个多头自注意力multi-head self-atte ...
- Pytorch中Module,Parameter和Buffer的区别
下文都将torch.nn简写成nn Module: 就是我们常用的torch.nn.Module类,你定义的所有网络结构都必须继承这个类. Buffer: buffer和parameter相对,就是指 ...
- linux (08) nginx入门详解
一. nginx 入门 nginx 入门学习 web服务器软件 windows IIS服务器 linux nginx apache 收费lighthttp 公司的技术栈 收费版技术栈 apache ...
- 过滤身份证号和grep复习
一.把身份证号过滤出来 我们还是从一道面试题说起. 请从test.txt文件当中过滤出正确的的身份证号码 [root@localhost test.dir]# cat test.txt 赵 37083 ...
- springcloud注解解释
@SpringBootApplication是springboot启动类,包括三个注解,他们的作用分别是: @Configuration:表示将该类作用springboot配置文件类 @Enabl ...
- 41 修改树莓派交换分区 SWAP 的大小
http://blog.lxx1.com/3289 SWAP就是LINUX下的虚拟内存分区,它的作用是在物理内存使用完之后,将磁盘空间(也就是SWAP分区)虚拟成内存来使用.它和Windows系统的交 ...