博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[svc]logstash和filebeat之间ssl加密
阅读量:7078 次
发布时间:2019-06-28

本文共 2984 字,大约阅读时间需要 9 分钟。

cfssl生成证书

wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -O     /usr/local/bin/cfsslwget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -O      /usr/local/bin/cfssljsonwget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 -O /usr/local/bin/cfssl-certinfochmod +x /usr/local/bin/cfssl*cd;mkdir keys;cd keyscat > ca-config.json <
ca-csr.json <
app-csr.json <

可以看到san里包含了n1 和 n2的ip. 这里计划logstash(的ip)和filebeat(的ip)使用同一套证书

实验环境

806469-20171224101505271-857910381.png

logstash&filebeat之间传数据-明文

logstash配置

cat > pipeline.conf <
5044 } stdin { codec => "json" }}output { stdout { codec => rubydebug }}EOFbin/logstash -f pipeline.conf --config.reload.automatic

filebeat多输入(不能多输出)参考:

cat > filebeat.yml <

测试文字

helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld

wireshark抓包: 不加密的时候,可以看到这玩意依稀可以看到依稀传输内容,如果互联网传输的话会有隐患.

806469-20171224101209146-458609802.png

logstash&filebeat之间传数据-ssl加密

  • logstash配置ssl

参考:

cat > pipeline.conf <
5044 ssl => true ssl_certificate_authorities => ["/root/keys/ca.pem"] ssl_certificate => "/root/keys/app.pem" ssl_key => "/root/keys/app-key.pem" ssl_verify_mode => "force_peer" } stdin { codec => "json" }}output { stdout { codec => rubydebug }}EOFbin/logstash -f pipeline.conf --config.reload.automatic
  • filebeat配置ssl
filebeat.prospectors:- type: log  enabled: true  paths:    - /tmp/ma.txt    output.logstash:  hosts: ["192.168.1.12:5043"]output.logstash.ssl.certificate_authorities: ["/root/keys/ca.pem"]output.logstash.ssl.certificate: "/root/keys/app.pem"output.logstash.ssl.key: "/root/keys/app-key.pem"output.console:  pretty: true  ./filebeat -e -c filebeat.yml -d "publish"

wireshark抓包: 看不到任何传输内容,依稀看到证书的subject(公开的).

806469-20171224101308912-872436410.png

报错doesn't contain any IP SANs

2017/12/24 02:33:59.242540 output.go:74: ERR Failed to connect: x509: cannot validate certificate for 192.168.1.11 because it doesn't contain any IP SANs2017/12/24 02:34:15.289558 output.go:74: ERR Failed to connect: x509: cannot validate certificate for 192.168.1.11 because it doesn't contain any IP SANs

ssl验证流程:

806469-20171224103952928-506861902.png

报错原因: 我生成证书请求的时候 hosts字段(即san)为空.

cd /root/keyscat > app-csr.json <

转载地址:http://uycml.baihongyu.com/

你可能感兴趣的文章
onclik的使用.
查看>>
【温故而知新-Javascript】使用Web存储
查看>>
eclipse 和 android studio 编译时报 Unsupported major.minor version 52.0错解决办法
查看>>
Linq To Sql进阶系列(二)M:M关系
查看>>
6.进程间关系
查看>>
查看电脑或者服务器sqlserver端口命令
查看>>
如何成为一名成功的程序员
查看>>
华为nova 2系列自拍狂欢季即将火爆开启
查看>>
观点解读:Hadoop可能衰落,但核心组件的生命力依旧旺盛!
查看>>
28000名开发者,100个问题,这份JavaScript生态报告值得收藏!
查看>>
湖北襄阳女警“跪拍”照感动网友
查看>>
统计局解读1月制造业采购经理指数:服务业回升明显
查看>>
警方通报“济南1家6口死亡”案:男子杀害亲人后放火跳楼
查看>>
揭秘爆款《啥是佩奇》:差点被毙 主演非专业(图)
查看>>
我国高原柴油车治污迎来新机遇
查看>>
刷脸进门、病猫识别,程序员撸猫太高端!网友:看完服了!
查看>>
七牛云:基于Go开发的大数据平台
查看>>
ES 5 新增特性汇总
查看>>
Unity 游戏框架搭建 (八) 减少加班利器-QLog
查看>>
Array · 数组去重
查看>>