Firewalld

firewall-cmd is used to manage firewall (iptables). It is used by default on latest version of CentOS, RHEL. Check firewall status To see if firewall is running of not use or To disable firewalls Open a port in firewall To allow HTTP and HTTPS traffic, run Permanent option make the changes permanant. You need to … Read more

Firewalld list rules

To list rules use command firewall-cmd –list-all –zone=public To list all open ports firewall-cmd –list-ports Example [root@centos7 zones]# firewall-cmd –zone=public –add-rich-rule=’rule family=”ipv4″ source address=”10.1.1.2/32″ port protocol=”tcp” port=”1-65535″ accept’ success [root@centos7 zones]# firewall-cmd –list-all –zone=public public (active) target: default icmp-block-inversion: no interfaces: eth0 eth1 sources: services: dhcpv6-client ssh ports: 25/tcp 9090/tcp protocols: masquerade: no forward-ports: source-ports: … Read more

Block Country in CSF firewall

CSF firewall can block all traffic from a country or list of countries using the GeoIP database. To block a country, edit the file /etc/csf/csf.conf Find CC_DENY=”” Replace with CC_DENY=”2_LETTER_COUNTRY_CODE” Here is an example to block all traffic from China CC_DENY=”CN” If you want to block another country, you can add it like CC_DENY=”CN,RU” Now … Read more

How to Block a Country in CSF firewall

To block all traffic from a country in CSF Firewall edit file /etc/csf/csf.conf vi /etc/csf/csf.conf Find the line CC_DENY = “” In this line, you can add 2 Letter country code. For example to block China and Russia, add CC_DENY = “CN,RU” Now you need to restart firewall with command systemctl restart lfd csf -r

Unban an IP from CSF Firewall

To unban an IP from CSF firewall, run csf -dr IP_ADDR Here i have an IP blocked in firewall. [root@server22 ~]# iptables -L -n | grep 13.224.29.193 DROP all — 13.224.29.193 0.0.0.0/0 LOGDROPOUT all — 0.0.0.0/0 13.224.29.193 [root@server22 ~]# To see if CSF is blocking the IP, run csf -g IP_ADDR Example This command also … Read more