Squid Listen on Other Port ( Squid Configure Port Listing with SELinux)

www.‮.iruttual‬com
Squid Listen on Other Port ( Squid Configure Port Listing with SELinux)

To configure Squid to listen on a different port with SELinux enabled, you will need to modify the Squid configuration file and then update the SELinux policy to allow Squid to listen on the new port.

  1. Modify the Squid configuration file: The Squid configuration file is typically located at /etc/squid/squid.conf. To change the port that Squid listens on, you will need to find the http_port directive in the configuration file and change the port number. For example, to listen on port 8080, you would change the directive to http_port 8080.

  2. Update the SELinux policy: SELinux is a security feature that prevents programs from accessing resources that they are not authorized to access. In order to allow Squid to listen on the new port, you will need to update the SELinux policy to allow Squid to listen on the port. You can do this using the semanage command.

For example, to allow Squid to listen on port 8080, you can use the following command:

semanage port -a -t http_port_t -p tcp 8080

This will add a rule to the SELinux policy to allow Squid to listen on port 8080.

  1. Restart Squid: After modifying the configuration file and updating the SELinux policy, you will need to restart Squid for the changes to take effect. You can do this using the systemctl command.

For example, to restart Squid, you can use the following command:

systemctl restart squid

Keep in mind that you will need to have root privileges to modify the Squid configuration file and update the SELinux policy.

It is also a good idea to test the new configuration to ensure that Squid is listening on the correct port and that the SELinux policy is configured correctly. You can do this using a web browser or a tool such as curl to send a request to the Squid proxy.

Created Time:2017-10-30 14:27:20  Author:lautturi