วิธีทำให้ Zabbix Server สามารถใช้งานได้โดยไม่ต้องปิด Selinux ( How to add policy to selinux? )
สำหรับเพื่อนๆชาว Zabbix In Thailand
คงจะมีหลายคนเจอปัญหาว่า ถ้าเปิด selinux จะทำให้ไม่สามารถใช้งาน zabbix server ได้
อาการ (Symptom):
1. ไม่สามารถ start zabbix server ได้
2. เข้าหน้า web แล้วจะพบตัวเตือนว่า zabbix server อาจจะไม่ได้รันอยู่
ลองทำตามขั้นตอนนะครับ
สร้างไฟล์ ชื่อ zabbix_server.te ก่อนครับ
module zabbix_server 1.0;
require { type fs_t; type zabbix_t;
type zabbix_port_t; type gssproxy_t;
type zabbix_var_run_t;
type httpd_t; class sock_file { create unlink };
class tcp_socket name_connect;
class unix_stream_socket connectto;
class process setrlimit; class filesystem getattr; }
#============= gssproxy_t ==============
#!!!! This avc is allowed in the current policy allow gssproxy_t fs_t:filesystem getattr;
#============= httpd_t ==============
#!!!! This avc can be allowed using one of the these booleans: # httpd_can_network_connect, httpd_can_connect_zabbix allow httpd_t zabbix_port_t:tcp_socket name_connect;
#============= zabbix_t ==============
#!!!! This avc is allowed in the current policy allow zabbix_t self:process setrlimit;
#!!!! This avc is allowed in the current policy allow zabbix_t self:unix_stream_socket connectto;
#!!!! This avc is allowed in the current policy
allow zabbix_t zabbix_var_run_t:sock_file { create unlink };
แล้วรัน command ตามนี้ต่อครับ
checkmodule -M -m -o zabbix_server.mod zabbix_server.te
semodule_package -o zabbix_server.pp -m zabbix_server.mod
semodule -i zabbix_server.pp
แล้วลอง start service ครับ
ทีนี้เราจะสามารถรัน zabbix server ได้แล้วครับ
หากท่านใด เข้าใจ Linux ดีแล้วก็จะเข้าใจ Config นี้ครับ ส่วนวิธีการเตรียม Config ไว้ติดตามใน Course Advance
จากทางทีมงานครับ