确保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日志的安全性。