# apt-get install ufw
# nano /etc/ufw/ufw.conf ENABLED=yes -- aktywacja po restarcie IPV6=yes
# ufw status verbose Status: inactive
# ufw disable -- wyłączenie ufw # ufw reset -- reset do wartości domyślnych
Definiowanie reguł
# ufw default deny incoming -- reguły domyślne # ufw default allow outgoing
Składnia reguł
# ufw allow [nazwa_usługi] # ufw allow [port] # ufw allow [port_od]:[port_do] # ufw allow [port]/[typ_połączenia] # ufw allow [port_od]:[port_do]/[typ_połączenia] # ufw allow from [adres_IP] # ufw allow from [adres_IP] to any port [port] # ufw allow from [adres_IP]/[maska_sieciowa] to any port [port] # ufw allow from [adres_IP]/[maska_sieciowa] to any port [port] proto [typ_połączenia] # ufw allow in on [interfejs_sieciowy] to any port [port] # ufw insert [numer_reguły] deny [port] # ufw insert [numer_reguły] deny from [adres_IP]
# ufw allow 22 # ufw allow 80 # ufw allow 443 # ufw allow from 176.107.131.222 to any port 3306 - zdalny dostęp do bazy
# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
# ufw status Status: active To Action From -- ------ ---- 22 ALLOW Anywhere 80 ALLOW Anywhere 443 ALLOW Anywhere 22 (v6) ALLOW Anywhere (v6) 80 (v6) ALLOW Anywhere (v6) 443 (v6) ALLOW Anywhere (v6)
# ufw status numbered To Action From -- ------ ---- [ 1] 22 ALLOW IN Anywhere [ 2] 80 ALLOW IN Anywhere [ 3] 443 ALLOW IN Anywhere [ 4] 22 (v6) ALLOW IN Anywhere (v6) [ 5] 80 (v6) ALLOW IN Anywhere (v6) [ 6] 443 (v6) ALLOW IN Anywhere (v6)
# ufw delete allow 80/tcp -- kasowanie lub # ufw delete 5 -- podając nr reguły
# ufw disable -- wyłączenie zapory # ufw reset -- wyczyszczenie reguł