確保CentOS上Filebeat的日志安全可以通過以下幾個步驟來實現:
關閉SELinux:
setenforce 0
/etc/selinux/config
文件,將 SELINUX=enforcing
改為 SELINUX=disabled
,然后重啟系統。關閉Firewalld:
firewall-cmd status
systemctl stop firewalld
systemctl disable firewalld
文件及內存限制配置:
/etc/security/limits.conf
文件,設置文件和內存限制:* soft nofile 65536
* hard nofile 131072
* soft nproc 65536
* hard nproc 131072
* soft memlock unlimited
* hard memlock unlimited
用戶及用戶組要求:
使用TLS/SSL加密通信:
openssl req -subj '/CN=your-server-hostname/' -x509 -days 365 -batch -nodes -newkey rsa:2048 -keyout /path/to/filebeat.key -out /path/to/filebeat.crt
filebeat.inputs:
- type: log
paths:
- /path/to/your/log/*.log
output.elasticsearch:
hosts: ["https://your-elasticsearch-server:9200"]
ssl.certificate_authorities: ["/path/to/ca.crt"]
ssl.certificate: "/path/to/filebeat.crt"
ssl.key: "/path/to/filebeat.key"
日志輪換:
logrotate
工具定期輪換日志文件,防止日志文件被篡改或泄露。審計和監控:
文件權限控制:
通過以上步驟,可以顯著提高CentOS上Filebeat日志的安全性。