Uncomplicated Firewall (UFW)
1 Въведение
2. Инсталиране
3. Активиране/дезактивиране
4. Базови команди
5. Разширени команди
При инсталацията на Ubuntu ufw е инсталиран и деактивириран. Ако поради ннякаква причина е изтрит, инсталацията се извършва като стандартен пакет:
$ sudo apt update
$ sudo apt update
$ sudo apt install ufw
enable:
$ sudo ufw enable
disable:$ sudo ufw disable
check status:.$ sudo ufw status
$ sudo ufw status verbose
$ sudo ufw status numbered
$ sudo ufw default allow outgoing
$ sudo ufw default deny incoming
$ sudo ufw allow http
$ sudo ufw allow https
$ sudo ufw allow 80
$ sudo ufw allow 443
$ sudo ufw deny http
$ sudo ufw deny 80
$ sudo ufw allow 80/tcp
To delete a rule - by number:
$ sudo ufw status numbered
Status: active
To
Action From
--
------ ----
[ 1]
80/tcp
ALLOW IN
Anywhere
[ 2] 80/tcp
(v6)
ALLOW IN Anywhere (v6)
$ sudo ufw delete 2
Deleting:
allow 80/tcp
Proceed with operation (y|n)? y
Rule deleted (v6)
$ sudo ufw status numbered
Status: active
To
Action From
--
------ ----
[ 1]
80/tcp
ALLOW IN Anywhere
$ sudo ufw status
Status: active
To
Action From
--
------ ----
80/tcp
ALLOW
Anywhere
80/tcp
(v6)
ALLOW Anywhere
(v6)
$ sudo ufw delete allow 80/tcp
Rule deleted
Rule deleted (v6)
$ sudo ufw status
Status: active
$ sudo ufw reset
$ sudo ufw allow 6000:6007/tcp
$ sudo ufw allow 6000:6007/udp
$ sudo ufw allow from 81.161.252.17
$ sudo ufw allow from 81.161.252.17 to any port 22
$ sudo ufw allow from 81.161.252.0/24
$ sudo ufw allow from 81.161.252.0/24 to any port 22
$ ip a |egrep enp
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
fq_codel state UP group default qlen 1000
inet 192.168.1.70/24 brd 192.168.1.255 scope global
noprefixroute enp0s3
$ sudo ufw allow in on enp0s3 to any port 80
Rule added
Rule added (v6)
$ sudo ufw status numbered
Status: active
To
Action From
--
------ ----
[ 1] 80 on
enp0s3
ALLOW IN
Anywhere
[ 2] 80 (v6) on
enp0s3 ALLOW
IN Anywhere (v6)
$ sudo nano /etc/ufw/before.rules
Забележка (копирана от https://www.cloudflare.com/learning/ddos/glossary/internet-control-message-protocol-icmp/ )$ man ufw