Konfigurasi Firewall UFW: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 68: Line 68:
== Block ping (ICMP) ==
== Block ping (ICMP) ==
In order to deny any incoming ICMP ping requests we need to modify <code>/etc/ufw/before.rules</code> UFW’s configuration file. First, make a backup copy:
In order to deny any incoming ICMP ping requests we need to modify <code>/etc/ufw/before.rules</code> UFW’s configuration file. First, make a backup copy:
$ sudo cp /etc/ufw/before.rules /etc/ufw/before.rules_backup
 
<syntaxhighlight lang="bash">
sudo cp /etc/ufw/before.rules /etc/ufw/before.rules_backup
</syntaxhighlight>
 
Next, open the file with root privileges using your favorite text editor and change:
Next, open the file with root privileges using your favorite text editor and change:


FROM:
FROM:
<syntaxhighlight lang="bash">
  # ok icmp codes for INPUT
  # ok icmp codes for INPUT
  -A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT
  -A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT
Line 78: Line 84:
  -A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT
  -A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT
  -A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT
  -A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT
</syntaxhighlight>
TO:
TO:
<syntaxhighlight lang="bash">
   # ok icmp codes for INPUT
   # ok icmp codes for INPUT
  -A ufw-before-input -p icmp --icmp-type destination-unreachable -j DROP
  -A ufw-before-input -p icmp --icmp-type destination-unreachable -j DROP
Line 85: Line 94:
  -A ufw-before-input -p icmp --icmp-type parameter-problem -j DROP
  -A ufw-before-input -p icmp --icmp-type parameter-problem -j DROP
  -A ufw-before-input -p icmp --icmp-type echo-request -j DROP
  -A ufw-before-input -p icmp --icmp-type echo-request -j DROP
</syntaxhighlight>


== Source ==
== Source ==
==Source==
*[https://www.linuxbabe.com/security/ufw-firewall-debian-ubuntu-linux-mint-server linuxbabe.com]
*[https://www.linuxbabe.com/security/ufw-firewall-debian-ubuntu-linux-mint-server linuxbabe.com]
*[https://www.cyberciti.biz/faq/how-to-delete-a-ufw-firewall-rule-on-ubuntu-debian-linux/ cyberciti.biz]
*[https://www.cyberciti.biz/faq/how-to-delete-a-ufw-firewall-rule-on-ubuntu-debian-linux/ cyberciti.biz]