From c2e248da550260fd983448d54d312a188a78f5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Bouynot?= Date: Fri, 27 Jan 2023 01:03:28 +0100 Subject: [PATCH] Add SELinux instructions for systemd monitoring (#14809) --- doc/Extensions/Applications.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index 489d12d97d..20dc123f3b 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -2186,6 +2186,29 @@ chmod +x /etc/snmp/redis.py extend redis /etc/snmp/redis.py ``` +4. (Optional) If you have SELinux in Enforcing mode, you must add a module so the script can get redis informations and write them: +``` +cat << EOF > snmpd_redis.te +module snmpd_redis 1.0; + +require { + type tmp_t; + type redis_port_t; + type snmpd_t; + class tcp_socket name_connect; + class dir { add_name write }; +} + +#============= snmpd_t ============== + +allow snmpd_t redis_port_t:tcp_socket name_connect; +allow snmpd_t tmp_t:dir { write add_name }; +EOF +checkmodule -M -m -o snmpd_redis.mod snmpd_redis.te +semodule_package -o snmpd_redis.pp -m snmpd_redis.mod +semodule -i snmpd_redis.pp +``` + ### Agent [Install the agent](Agent-Setup.md) on this device if it isn't already