国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書

這篇具有很好參考價(jià)值的文章主要介紹了安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

在為 Elasticsearch 采集數(shù)據(jù)時(shí),我們經(jīng)常使用到 Filebeat 及 Logstash。在我們之前的很多教程中,我們通常不為 Filebeat 和 Logstash 之前的通信做安全配置。

安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書,Logstash,Elastic,安全,ssl,網(wǎng)絡(luò)協(xié)議,logstash,elasticsearch,filebeat

如何為 Filebeat 及 Logstash 直接建立安全的鏈接?這個(gè)在很多的情況下是非常有用的。在我之前的文章 “Elasticsearch:為日志分析設(shè)置安全的 Elasticsearch 管道”,我有涉及到這個(gè)問題。最主要的是,它是針對(duì) Elastic Stack 8.x 而設(shè)計(jì)的。在今天的文章中,我將針對(duì)最普通的情況來進(jìn)行展示。

本指南提供了有關(guān)使用 OpenSSL 生成和配置 SSL 證書的詳細(xì)說明,以增強(qiáng) Logstash 和 Filebeat 之間通信的安全性。 概述的步驟包括為證書頒發(fā)機(jī)構(gòu) (CA) 生成私鑰、為 CA 創(chuàng)建自簽名 X509 證書以及為 Logstash 和 Filebeat 生成密鑰和證書。 還包括使用這些證書的 Filebeat 和 Logstash 的配置步驟。

為 CA 生成私鑰

# Generate a private key for the Certificate Authority (CA)
openssl genrsa 2048 > /path/to/your/ca-key.pem
$ pwd
/Users/liuxg/demos/filebeat_logstash
$ openssl genrsa 2048 > ca-key.pem
$ ls
ca-key.pem

為 CA 生成 X509 證書

# Generate a self-signed X509 certificate for the CA
openssl req -new -x509 -nodes -days 365000 \
    -key /path/to/your/ca-key.pem \
    -out /path/to/your/ca-cert.pem
openssl req -new -x509 -nodes -days 365000 -key ca-key.pem -out ca-cert.pem
$ pwd
/Users/liuxg/demos/filebeat_logstash
$ ls
ca-key.pem
$ openssl req -new -x509 -nodes -days 365000 -key ca-key.pem -out ca-cert.pem
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) [AU]:CN
State or Province Name (full name) [Some-State]:Beijing
Locality Name (eg, city) []:Beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Elastic
Organizational Unit Name (eg, section) []:Community
Common Name (e.g. server FQDN or YOUR name) []:Xiaoguo
Email Address []:x@y.com
$ ls
ca-cert.pem ca-key.pem

為 Logstash 和 Filebeat 創(chuàng)建證書和密鑰

# Generate a private key and certificate for Logstash and Filebeat using the CA
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
    -keyout /path/to/your/server.key \
    -out /path/to/your/server.crt \
    -CA /path/to/your/ca-cert.pem \
    -CAkey /path/to/your/ca-key.pem
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
    -keyout ./server.key \
    -out ./server.crt \
    -CA ./ca-cert.pem \
    -CAkey ./ca-key.pem
$ pwd
/Users/liuxg/demos/filebeat_logstash
$ ls
ca-cert.pem ca-key.pem
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
>     -keyout ./server.key \
>     -out ./server.crt \
>     -CA ./ca-cert.pem \
>     -CAkey ./ca-key.pem
........+...+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...........+..+.+...+.........+..+.............+...+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..........+..........+.....+...+.........+.+..+......+.......+...............+..+...+.......+...+...+.....+......+......+.......+..+....+..+..........+..+......+......+.+..+.+..............+...+.......+..+...+.......+...+........+...+......+....+..+.......+.....+...............+......+................+......+...+......+.....+.+..+...+..........+........+................+...............+......+..+.+..+.........+...+.......+......+...+.....+.+...............+...+........+...+.........+...+.........+....+.....+.+........+...+.........+..........+......+..+.............+.....+....+...+..+.............+......+......+.........+..+...+....+...+............+...+..+.+......+.....+.+..+...+..................+.....................+....+..............+.+..+..........+..+...+....+...+......+.................+...+....+........+...+.+...........+..........+.....+...............+....+......+..............+...+......+......+...+.......+...+.....+...+.............+..+.......+.....+.+..+....+...+......+.....+..........+..+.........+.........+.+........+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.........+......+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*........+.........+.........+.....+.+.....+.+.........+..+....+........+...+.......+........+...+......+...+...+............+..........+...+..+..........+.....+.............+..+...+...+....+...+..............+....+..+......................+..+...+...+...+.+.........+......+...+..+.+...+.....+.........+...+...+.+...+..+.+........+............+..........+..+.+.....................+......+........+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
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) [AU]:CN
State or Province Name (full name) [Some-State]:Beijing
Locality Name (eg, city) []:Beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Elastic
Organizational Unit Name (eg, section) []:Community 
Common Name (e.g. server FQDN or YOUR name) []:localhost
Email Address []:x@y.com

按照同樣的方法,我們生成相應(yīng)的 client 證書:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
    -keyout client.key \
    -out client.crt \
    -CA ./ca-cert.pem \
    -CAkey ./ca-key.pem
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
>     -keyout ./server.key \
>     -out ./server.crt \
>     -CA ./ca-cert.pem \
>     -CAkey ./ca-key.pem
........+...+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...........+..+.+...+.........+..+.............+...+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..........+..........+.....+...+.........+.+..+......+.......+...............+..+...+.......+...+...+.....+......+......+.......+..+....+..+..........+..+......+......+.+..+.+..............+...+.......+..+...+.......+...+........+...+......+....+..+.......+.....+...............+......+................+......+...+......+.....+.+..+...+..........+........+................+...............+......+..+.+..+.........+...+.......+......+...+.....+.+...............+...+........+...+.........+...+.........+....+.....+.+........+...+.........+..........+......+..+.............+.....+....+...+..+.............+......+......+.........+..+...+....+...+............+...+..+.+......+.....+.+..+...+..................+.....................+....+..............+.+..+..........+..+...+....+...+......+.................+...+....+........+...+.+...........+..........+.....+...............+....+......+..............+...+......+......+...+.......+...+.....+...+.............+..+.......+.....+.+..+....+...+......+.....+..........+..+.........+.........+.+........+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.........+......+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*........+.........+.........+.....+.+.....+.+.........+..+....+........+...+.......+........+...+......+...+...+............+..........+...+..+..........+.....+.............+..+...+...+....+...+..............+....+..+......................+..+...+...+...+.+.........+......+...+..+.+...+.....+.........+...+...+.+...+..+.+........+............+..........+..+.+.....................+......+........+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
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) [AU]:CN
State or Province Name (full name) [Some-State]:Beijing
Locality Name (eg, city) []:Beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Elastic
Organizational Unit Name (eg, section) []:Community 
Common Name (e.g. server FQDN or YOUR name) []:localhost
Email Address []:x@y.com
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
>     -keyout client.key \
>     -out client.crt \
>     -CA ./ca-cert.pem \
>     -CAkey ./ca-key.pem
....+...+.+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+.........+........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*......+....+.....+....+...+...+..+..................+.+..............+.+.....................+...+..+.............+..+.......+..+......+............+......+.+......+.........+.........+......+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
..+.....+..................+.+..+............+.+..+....+......+...+.....+.......+...+.....+......+...+.............+........+.+.....+....+..+.......+......+..+....+...+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+.....+......+.+...+..+....+.....+.............+........+.......+...+............+.....+..................+.......+..+.+.........+...............+.....+.+..+...+...+.+......+.....+.......+.....+...+.........+......+....+...+...........+....+...........+......+.........+....+.....+......+......+.+.....+..........+.....+............+.+......+...+...+...+..+.......+..+...+......+.+......+.....+....+...+..+...............+....+...............+..+.........+...+.+.....+................+.....+.+...+......+.....+......+.......+..+...+......+.+......+...+.....+.........+......................+...+.....+...+...+......+.........+.+.....+....+.....+...............+....+...+.....+............+.+..+.......+..+...+...+............+..........+..+................+..+...+...+.+...+........+...+.+...........+.........+......+..................+....+.....+............+....+.....+......+....+..+....+.....+.+.....+...+...............+....+.....+..........+..+................+..+............+.........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
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) [AU]:CN
State or Province Name (full name) [Some-State]:Beijing
Locality Name (eg, city) []:Beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Elastic
Organizational Unit Name (eg, section) []:Community
Common Name (e.g. server FQDN or YOUR name) []:localhost
Email Address []:x@y.com
$ ls
ca-cert.pem                           filebeat-8.12.0-darwin-aarch64.tar.gz
ca-key.pem                            logstash-8.12.0
client.crt                            logstash-8.12.0-darwin-aarch64.tar.gz
client.key                            server.crt
filebeat-8.12.0-darwin-aarch64        server.key

配置 Filebeat(或任何 Beat)

output.logstash:
  hosts: ["localhost:5044"]
  
  # Specify the path to the CA certificate for verification
  ssl.certificate_authorities: ["/path/to/your/ca-cert.pem"]
  
  # Specify the path to the client certificate
  ssl.certificate: "/path/to/your/server.crt"
  
  # Specify the path to the client private key
  ssl.key: "/path/to/your/server.key"

配置 Logstash

input {
  beats {
    port => 5044
    ssl => true
    
    # Specify the path to the CA certificate for verification
    ssl_certificate_authorities => ["/path/to/your/ca-cert.pem"]
    
    # Specify the path to the server certificate
    ssl_certificate => "/path/to/your/server.crt"
    
    # Specify the path to the server private key
    ssl_key => "/path/to/your/server.key"
    
    # Set peer verification mode to force_peer
    ssl_verify_mode => "force_peer"
  }
}

確保將 /path/to/your/ 替換為密鑰和證書的實(shí)際所需路徑。

測(cè)試

我們?cè)诋?dāng)前的目錄下安裝 Filebeat 及 Logstash:

filebeat_ssl.yml

$ pwd
/Users/liuxg/demos/filebeat_logstash
$ ls 
ca-cert.pem                           logstash-8.12.0
ca-key.pem                            logstash-8.12.0-darwin-aarch64.tar.gz
filebeat-8.12.0-darwin-aarch64        server.crt
filebeat-8.12.0-darwin-aarch64.tar.gz server.key
$ cd filebeat-8.12.0-darwin-aarch64
$ ls filebeat_ssl.yml 
filebeat_ssl.yml
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - ./logfile.log
output.logstash:
  hosts: ["localhost:5044"]
  ssl.certificate_authorities: ["../ca-cert.pem"]
  ssl.certificate: "../server.crt"
  ssl.key: "../server.key"
logging:
  level: info
  to_files: true
  files:
  path: .
  name: filebeat.log
  keepfiles: 7
  permissions: 0644

我們?cè)?filebeat 安裝目錄下創(chuàng)建一個(gè)叫做 logfile.log 的文件。它的內(nèi)容如下:

logfile.log

This is a test log

logstash.conf

input {
  beats {
    port => 5044
    ssl => true
    ssl_certificate_authorities => "../ca-cert.pem"
    ssl_certificate => "../server.crt"
    ssl_key => "../server.key"
    ssl_verify_mode => "force_peer"
  }
}

output {
  stdout { codec => rubydebug }
  file {
    path => "../outputfile.log"
  }
}

我們首先運(yùn)行 logstash:

./bin/logstash -f logstash.conf

安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書,Logstash,Elastic,安全,ssl,網(wǎng)絡(luò)協(xié)議,logstash,elasticsearch,filebeat

我們?cè)俳酉聛磉\(yùn)行 Filebeat:

安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書,Logstash,Elastic,安全,ssl,網(wǎng)絡(luò)協(xié)議,logstash,elasticsearch,filebeat

我們回到 Logstash 運(yùn)行的 terminal 中進(jìn)行查看:

安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書,Logstash,Elastic,安全,ssl,網(wǎng)絡(luò)協(xié)議,logstash,elasticsearch,filebeat

從上面的輸出中,我們可以看到日志被正確地采集到 Logstash。我們可以更進(jìn)一步輸出到 Elasticsearch。在這里,我們就不再累述了。文章來源地址http://www.zghlxwxcb.cn/news/detail-831593.html

到了這里,關(guān)于安全通信設(shè)置:使用 OpenSSL 為 Logstash 和 Filebeat 提供 SSL 證書的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Flume、Logstash、Filebeat對(duì)比

    Flume、Logstash和Filebeat是三種常用的數(shù)據(jù)采集工具,用于收集、聚合和傳輸日志和事件數(shù)據(jù)。它們?cè)诠δ?、特性和適用場(chǎng)景上有一些區(qū)別。以下是對(duì)它們的簡(jiǎn)要對(duì)比: Apache Flume: 用途:主要用于大規(guī)模數(shù)據(jù)采集、傳輸和聚合,特別適用于將數(shù)據(jù)送入Hadoop生態(tài)系統(tǒng)。 特點(diǎn): 提供

    2024年02月11日
    瀏覽(5)
  • Fluentd、Filebeat、Logstash 對(duì)比分析

    Fluentd 創(chuàng)建的初衷主要是盡可能的使用 JSON 作為日志輸出,所以傳輸工具及其下游的傳輸線不需要猜測(cè)子字符串里面各個(gè)字段的類型。這樣,它為幾乎所有的語言都提供庫(kù),這也意味著,我們可以將它插入到我們自定義的程序中。 優(yōu)勢(shì): ? 和多數(shù) Logstash 插件一樣,F(xiàn)luentd 插

    2024年02月05日
    瀏覽(16)
  • filebeat采集日志數(shù)據(jù)到kafka(一)(filebeat->kafka->logstash->es)

    filebeat采集日志數(shù)據(jù)到kafka(一)(filebeat->kafka->logstash->es)

    一、filebeat安裝 filebeat-kafka版本適配 1、安裝包下載 https://www.elastic.co/cn/downloads/past-releases#filebeat 解壓 2、新建yml配置文件,如test.yml 3、Filebeat啟動(dòng)和停止 啟動(dòng):./filebeat -c test.yml 停止:kill -9 PID

    2024年02月16日
    瀏覽(24)
  • ELK集群部署---LogStash,F(xiàn)ilebeat的部署

    1.? 環(huán)境規(guī)劃: 主機(jī)名 IP地址 角色 node1 192.168.56.111 ElasticSearch(master) Zookeeper Kafka node2 192.168.56.112 ElasticSearch(slave) Kibana Zookeeper Kafka node3 192.168.56.113 ElasticSearch(slave) Zookeeper Kafka node4 192.168.56.114 Logstash Filebeat

    2023年04月18日
    瀏覽(31)
  • 日志系統(tǒng)一(elasticsearch+filebeat+logstash+kibana)

    日志系統(tǒng)一(elasticsearch+filebeat+logstash+kibana)

    目錄 一、es集群部署 安裝java環(huán)境 部署es集群 安裝IK分詞器插件 二、filebeat安裝(docker方式) 三、logstash部署 四、kibana部署 背景:因業(yè)務(wù)需求需要將nginx、java、ingress日志進(jìn)行收集。 架構(gòu):filebeat+logstash+es+kibana 服務(wù)器規(guī)劃: 192.168.7.250(es) 192.168.6.216(filebeat,es) 192.168.7

    2024年02月03日
    瀏覽(27)
  • elasticSearch+kibana+logstash+filebeat集群改成https認(rèn)證

    elasticSearch+kibana+logstash+filebeat集群改成https認(rèn)證

    ps:主節(jié)點(diǎn)操作 切換用戶:su es 進(jìn)入目錄:cd /home/es/elasticsearch-7.6.2 創(chuàng)建文件:vi instances.yml 生成證書:/home/es/elasticsearch-7.6.2/bin/elasticsearch-certutil cert ca --pem --in instances.yml --out certs.zip 解壓得到各個(gè)證書:unzip certs.zip ps:三個(gè)節(jié)點(diǎn) 切換用戶:su es 將解壓得到的三個(gè)文件夾文件

    2024年02月09日
    瀏覽(23)
  • MySQL MHA信息的收集【Filebeat+logstash+MySQL】

    MySQL MHA信息的收集【Filebeat+logstash+MySQL】

    隨著集團(tuán)MHA集群的日漸增長(zhǎng),MHA管理平臺(tái)話越來越迫切。而MHA平臺(tái)的建設(shè)第一步就是將這些成百上千套的MHA集群信息收集起來,便于查詢和管理。 MHA主要信息如下: (1)基礎(chǔ)配置信息; (2)運(yùn)行狀態(tài)信息; (3)啟動(dòng)及FailOver的log信息。 集團(tuán)目前數(shù)據(jù)庫(kù)的管理平臺(tái)是在Arch

    2023年04月15日
    瀏覽(12)
  • EFLK日志平臺(tái)(filebeat-->kafka-->logstash-->es-->kiabana)

    EFLK日志平臺(tái)(filebeat-->kafka-->logstash-->es-->kiabana)

    ELK平臺(tái)是一套完整的日志集中處理解決方案,將 ElasticSearch、Logstash 和 Kiabana 三個(gè)開源工具配合使用, 完成更強(qiáng)大的用戶對(duì)日志的查詢、排序、統(tǒng)計(jì)需求。 1. es安裝(單節(jié)點(diǎn)部署) 前提 安裝 2.es web 查看 瀏覽器訪問 http://esIP:9200 或者本地訪問curl ‘http://localhost:9200/?pretty’ 安

    2024年02月10日
    瀏覽(25)
  • 利用logstash/filebeat/插件,將graylog日志傳輸?shù)絢afka中

    利用logstash/filebeat/插件,將graylog日志傳輸?shù)絢afka中

    在System-outputs,選擇GELF Output,填寫如下內(nèi)容,其它選項(xiàng)默認(rèn) 在要輸出的Stream中,選擇Manage Outputs 選擇GELF Output,右邊選擇剛才創(chuàng)建好的test。 下載logstash,最新版就可以。 上傳到服務(wù)器,編寫test.conf配置文件,內(nèi)容如下 運(yùn)行l(wèi)ogstash,輸入以下命令 前提:安裝好kafka集群, 創(chuàng)建

    2024年02月13日
    瀏覽(18)
  • 【微服務(wù)】日志搜集es+kibana+filebeat+redis+logstash(單機(jī))

    【微服務(wù)】日志搜集es+kibana+filebeat+redis+logstash(單機(jī))

    日志搜集系統(tǒng)搭建 基于7.17.16版本 ps: 項(xiàng)目是toB的,日志量不大 7.17.16版本。8.x版本需要JDK11 java8 elastic 軟件不能以root用戶啟動(dòng),需要?jiǎng)?chuàng)建用戶 redis elasticsearch kibana logstash filebeat 下載tar包,解壓即可 es部署 配置ES_JAVA_HOME 略 elasticsearch.yml 修改config/elasticsearch.yml中參數(shù) 系統(tǒng)參數(shù)

    2024年01月16日
    瀏覽(77)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包