From 7506047a39eb1e0250373670a7c0cf7fa8bf5dbb Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Sun, 28 Aug 2016 15:21:54 +0530 Subject: [PATCH] ufw: Improve page --- pages/linux/ufw.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pages/linux/ufw.md b/pages/linux/ufw.md index 2d96eded7..a0f5bbb3b 100644 --- a/pages/linux/ufw.md +++ b/pages/linux/ufw.md @@ -11,18 +11,26 @@ `ufw disable` -- Show ufw rules: +- Show ufw rules, along with their numbers: -`ufw status` +`ufw status numbered` -- Add ufw allow rule: +- Allow incoming traffic on port 5432 on this host: -`ufw allow {{port}} {{service_name}}` +`ufw allow {{5432}}` -- Example: Allow access to port 1337 from IP 1.2.3.4 using udp: +- Allow only TCP traffic from 192.168.0.4 to any address on this host, on port 22: -`ufw allow from 1.2.3.4 to any port 1337 proto udp` +`ufw allow from {{192.168.0.4}} to {{any}} port {{22}} proto {{tcp}}` -- Add ufw deny rule: +- Deny traffic on port 80 on this host: -`ufw deny {{port}} {{service_name}}` +`ufw deny {{80}}` + +- Deny all UDP traffic to port 22: + +`ufw deny from {{any}} to {{any}} port {{22}} proto {{udp}}` + +- Remove a particular rule. The rule number can be retrieved from the `ufw status numbered` command: + +`ufw delete {{rule_number}}`