Icinga / icingaweb2

A lightweight and extensible web interface to keep an eye on your environment. Analyse problems and act on them.
https://icinga.com/get-started/
GNU General Public License v2.0
810 stars 282 forks source link

RHEL8/SELinux: IcingaDB-Web can't connect to Redis with icingaweb2-selinux installed #5034

Open mocdaniel opened 1 year ago

mocdaniel commented 1 year ago

Describe the bug

After installing icinga2, icingadb, icingadb-redis, icingaweb2, and icingadb-web on a freshly deployed RHEL8 server, Icingaweb2/IcingaDB-Web can't connect to the Redis instance deployed by IcingaDB-Redis. This happens despite having installed both, icinga2-selinux, and icingaweb2-selinux policy packages.

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

1.

$ dnf install icinga2 icingadb icingadb-redis icinga2-selinux icingaweb2 icingaweb2-selinux icingadb-web
  1. Configure all components according to the documentation, don't touch any config regarding Redis as this is wired up correctly in the respective components by default.
  2. Open Icingaweb, follow the setup according to the documentation
  3. Icingaweb2 will complain that it can't connect to Redis running on the same host

Expected behavior

With SELinux enabled and icingaweb2-selinux/icinga2-selinux installed, communication between Redis and Icingaweb should be possible.

Your Environment

Include as many relevant details about the environment you experienced the problem in

Additional context

The problem can be fixed by setting the following SELinux boolean:

$ setsebool -P httpd_can_network_connect on

This should be a work-around, not a permanent solution.

Some more information regarding the apparently missing policy, thx for pointing that out @pdolinic

$ audit2allow -rli /var/log/audit/audit.log

require {
        type httpd_t;
        type redis_port_t;
        class tcp_socket name_connect;
}

#============= httpd_t ==============

#!!!! This avc can be allowed using the boolean 'httpd_can_network_connect'
allow httpd_t redis_port_t:tcp_socket name_connect;
dgoetz commented 1 year ago

Please bring this issue upstream (https://bugzilla.redhat.com - Product: Red Hat Enterprise Linux 8 - Component: selinux-policy, also mention newer versions and derivates as affected), as there are rules for httpd_t to allow connection to the redis socket and a boolean for memcache, it looks more like an oversight there.

mocdaniel commented 1 year ago

Upstream issue created here.