SELinux Teil IV
Im letzten Teil der SELinux-Reihe will ich anhand von einem Beispiel demonstrieren, wie man SELinux-Probleme aufdeckt und behebt.
Eine Kunde hat einen neuen Webserver installiert, der auf Port 85 seinen Dienst zur Verfügung stellen soll. Aus irgendeinem Grund aber lässt sich der Apache-httpd-Server nicht starten.
| Der httpd Server startet nicht |
Als erstes prüfe ich, ob es ein SELinux Problem ist. Ich schalte SELinux in den permissive Modus und versuche erneut den Webserver zu starten:
| SELinux permissive Mode / Webserverstart |
Tatsächlich hat das Problem mit SELinux zu tun. Ich bringe SELinux wieder in den enforcing Modus und begebe mich an die Fehlersuche.
Ein Blick in die Logfiles ist sicherlich erstmal eine gute Idee:
journalctl -u httpd
grep httpd /var/log/audit/audit.log | more
ausearch -c 'httpd' --raw
und zum guten Schluss auch noch in /var/log/messages
grep httpd /var/log/messages | less
Nov 10 13:42:10 rocky setroubleshoot[10596]: SELinux is preventing /usr/sbin/httpd from name_bind access on the tcp_socket port 85.#012#012***** Plugin bind_ports (99.5 confidence) suggests ************************#012#012If you want to allow /usr/sbin/httpd to bind to network port 85#012Then you need to modify the port type.#012Do#012# semanage port -a -t PORT_TYPE -p tcp 85#012 where PORT_TYPE is one of the following: http_cache_port_t, http_port_t, jboss_management_port_t, jboss_messaging_port_t, ntop_port_t, puppet_port_t.#012#012***** Plugin catchall (1.49 confidence) suggests **************************#012#012If you believe that httpd should be allowed name_bind access on the port 85 tcp_socket by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'httpd' --raw | audit2allow -M my-httpd#012# semodule -X 300 -i my-httpd.pp#012
Es wurden zwei Dateien erzeugt (my-httpd.pp, my-httpd.te) welche mit semodule in die SELinux Datenbank importiert werden.
Keine Kommentare:
Kommentar veröffentlichen