2

I am fairly new to Centos/Linux and have been trying to configure my firewall to restrict access to mysql and ssh for only a few IP addresses. When I run the following and do a port scan I do see that all ports are shut, however when I run firewall-cmd --reload port 22 opens again. How can I restrict it by default or do I not need to run the reload? What would happen if the server restarted? Thanks.

firewall-cmd --permanent --zone=trusted --add-source=IP1/24
firewall-cmd --permanent --zone=trusted --add-source=IP2/24
firewall-cmd --permanent --zone=trusted --add-service=mysql
firewall-cmd --permanent --zone=trusted --add-service=ssh
firewall-cmd --list-services --zone=trusted
firewall-cmd --zone=public --remove-service=ssh 
5
  • Which zones did you assign to each interface? Oct 29, 2014 at 13:12
  • If there is a command to tell you that I will happily run it :)
    – Ukuser32
    Oct 29, 2014 at 13:16
  • @Ukuser32 firewall-cmd --get-zone-of-interface=<interface_name> or the reverse : firewall-cmd --zone=<zone_name> --list-interfaces Nov 14, 2014 at 15:30
  • @Ukuser32 Did you copy/paste or modified with zone/interface name ? If it's the second answer, then firewalld is not using any interface on your machine and you need to bind interfaces to target zones. Nov 14, 2014 at 21:27
  • I did copy/paste/modify the code so it looks like the later. How does one bind interfaces to target zones?
    – Ukuser32
    Nov 17, 2014 at 9:08

0

You must log in to answer this question.

Browse other questions tagged .