在CentOS上,要確保Filebeat傳輸的數據加密,可以使用以下方法:
使用X-Pack安全功能(適用于Elasticsearch 6.x及更高版本):
elasticsearch.yml
配置文件中啟用以下設置:xpack.security.enabled: true
重啟Elasticsearch服務以應用更改。
為Elasticsearch創建一個內置用戶,并為其分配角色。例如,創建一個名為filebeat_internal
的用戶,并為其分配filebeat_internal
角色:
bin/elasticsearch-setup-passwords interactive
/etc/filebeat/filebeat.yml
)中,啟用X-Pack安全功能并配置傳輸加密:xpack.security.enabled: true
filebeat.users:
- name: "filebeat_internal"
password: "your_password"
roles: ["filebeat_internal"]
full_name: "Filebeat Internal User"
使用TLS/SSL加密傳輸:
為您的Elasticsearch集群生成或獲取SSL證書和密鑰。您可以使用自簽名證書,但建議使用由受信任的證書頒發機構(CA)簽發的證書。
將生成的證書和密鑰分發給Filebeat和Elasticsearch節點。將證書和密鑰放在Filebeat和Elasticsearch的配置目錄中,例如/etc/filebeat
和/etc/elasticsearch
。
在Filebeat配置文件(通常位于/etc/filebeat/filebeat.yml
)中,配置TLS/SSL加密傳輸:
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*log
ssl.enabled: true
ssl.certificate_authorities: ["/etc/filebeat/ca.pem"]
ssl.certificate: "/etc/filebeat/filebeat.pem"
ssl.key: "/etc/filebeat/filebeat-key.pem"
/etc/elasticsearch/elasticsearch.yml
)中,配置TLS/SSL加密傳輸:xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.certificate: "/etc/elasticsearch/elasticsearch-cert.pem"
xpack.security.http.ssl.key: "/etc/elasticsearch/elasticsearch-key.pem"
xpack.security.http.ssl.certificate_authorities: ["/etc/elasticsearch/ca.pem"]
通過以上方法,您可以確保在CentOS上運行的Filebeat傳輸的數據是加密的。