ufw commands
$ sudo ufw logging on
$ sudo ufw enable
$ sudo ufw status
ufw status inactive
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
UFW Allow Port
UFW Allow service nginx apache etc
ERROR: Could not find a profile matching ‘Nginx HTTP’
sudo ufw app list
sudo ufw allow nginx
root@-s-4vcpu-8gb-blr1-01:~# ls /etc/ufw/applications.d
openssh-server
cat /etc/ufw/applications.d/openssh-server
root@-s-4vcpu-8gb-blr1-01:~# cat /etc/ufw/applications.d/openssh-server
[OpenSSH]
title=Secure shell server, an rshd replacement
description=OpenSSH is a free implementation of the Secure Shell protocol.
ports=22/tcp
Available applications:
OpenSSH
UFW Block Port
UFW Block All Ports except allowed
Delete UFW rule
ufw rules
root@-s-4vcpu-8gb-blr1-01:~# ufw status
Status: active
To Action From
— —— —-
80 ALLOW Anywhere
22 ALLOW Anywhere
443 ALLOW Anywhere
3306 ALLOW Anywhere
9000 ALLOW Anywhere
6379 ALLOW Anywhere
22/tcp ALLOW Anywhere
80 (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
3306 (v6) ALLOW Anywhere (v6)
9000 (v6) ALLOW Anywhere (v6)
6379 (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
rate limiting linux with ufw
ufw configuration file to save changes permanently
sudo ufw app list
ufw logging high
UFW Allow mail server
pam_unix(sshd:auth): check pass; user unknown
Apr 21 06:03:18 -s-4vcpu-8gb-blr1-01 sshd[16902]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=80.98.249.181
The result is RESULT.
Apr 21 06:58:43 -s-4vcpu-8gb-blr1-01 kernel: [UFW BLOCK] IN=eth0 OUT= MAC=a6:01:3e:6a:96:b1:fe:00:00:00:01:01:08:00 SRC=45.146.165.129 DST=128.199.25.144 LEN=40 TOS=0x00 PREC=0x00 TTL=249 ID=46620
PROTO = The protocol used by the attempted connection.
ufw allow ssh out
sudo ufw allow from 203.0.113.4 to any port 22
sudo ufw allow from 15.15.15.0/24 to any port 22