0

I need to use the 8081 port with Apache but Selinux doesn't allow that:

semanage port -l | grep http_port_t
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000

semanage port -l | grep 8081
transproxy_port_t              tcp      8081

So, if the httpd.conf there is this:

Listen 8081

then I can't start httpd because I get this error:

#systemctl start httpd
Job for httpd.service failed because the control process exited with error code. 
See "systemctl status httpd.service" and "journalctl -xe" for details.



#systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since lun 2018-11-05 19:21:31 CET; 36s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 1953 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 1952 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 1952 (code=exited, status=1/FAILURE)

nov 05 19:21:31 localhost.localdomain httpd[1952]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:8081
nov 05 19:21:31 localhost.localdomain httpd[1952]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8081
nov 05 19:21:31 localhost.localdomain httpd[1952]: no listening sockets available, shutting down
nov 05 19:21:31 localhost.localdomain httpd[1952]: AH00015: Unable to open logs
nov 05 19:21:31 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
nov 05 19:21:31 localhost.localdomain kill[1953]: kill: cannot find process ""
nov 05 19:21:31 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
nov 05 19:21:31 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
nov 05 19:21:31 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
nov 05 19:21:31 localhost.localdomain systemd[1]: httpd.service failed.

How can I do?

xRobot
  • 141
  • 1
  • 1
  • 4
  • https://superuser.com/q/1373764/105002 – choroba Nov 08 '18 at 12:55
  • https://serverfault.com/questions/563872/selinux-allow-httpd-to-connect-to-a-specific-port – NoNoNo Nov 08 '18 at 13:00
  • You already did 99% of the troubleshooting the only thing you need to is to modify the existing policy for the htttp_port and add 8081 - `semanage port -m -t http_port_t -p tcp 8081` and confirm with `semanage port -l | grep http_port_t` – HBruijn Nov 08 '18 at 13:05

0 Answers0