feat(ufw): add function for full reset ufw and allow ssh only

This commit is contained in:
Hanashiko 2025-05-24 09:18:28 +03:00
commit 47d3a38f5f
2 changed files with 10 additions and 0 deletions

View file

@ -16,3 +16,4 @@ Some of the commands include:
* `deny <port>/<optional: protocol>` add deny rule * `deny <port>/<optional: protocol>` add deny rule
* `disable` disables the firewall * `disable` disables the firewall
* `enable` enables the firewall * `enable` enables the firewall
* `ufw-lockdown` full reset firewall and allow SSH only

View file

@ -0,0 +1,9 @@
# Function: Full reset and allow SSH only
ufw-lockdown() {
echo "Locking down firewall (allow only SSH)..."
sudo ufw reset
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw enable
}