-
Notifications
You must be signed in to change notification settings - Fork 1
/
ufw.cheat
44 lines (32 loc) · 1.19 KB
/
ufw.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% ufw,pushou
# ufw status
sudo ufw status numbered
# ufw enable disable reset
sudo ufw <STATUS>
# ufw default policy
sudo ufw default <POLICY> <WAY>
# ufw allow port text
sudo ufw <POLICY> <NNPORT>
# ufw allow numerical port
sudo ufw <POLICY> <PORT>/<PROTO> comment <COMMENT>
# ufw port range
sudo ufw <POLICY> <START_PORT>:<END_PORT> proto <PROTO>
# ufw allow from ip|network
sudo ufw <POLICY> from <IP> to any port <PORT> proto <PROTO>
# ufw delete number rules
sudo ufw delete <UFW_RULES_NUMBER>
# ufw show rules listening|added
sudo ufw show <SHOW_SOCKETS>
$ POLICY: echo 'allow deny' | tr ' ' '\n'
$ STATUS: echo 'enable disable reset' | tr ' ' '\n'
$ SHOW_SOCKETS: echo 'listening added' | tr ' ' '\n'
$ UFW_RULES_NUMBER: sudo ufw status numbered| awk '{print $2}'|grep -o '[[:digit:]]*'
$ WAY: echo 'outgoing incoming' | tr ' ' '\n'
$ NNPORT : cat /etc/services | awk '{print $1}' | egrep -v '^#'| tr ' ' '\n'
$ START_PORT: echo {1..65535} | tr ' ' '\n'
$ END_PORT: echo {1..65535} | tr ' ' '\n'
$ PORT: echo {1..65535} | tr ' ' '\n'
$ TO_PORT: echo {1..65535} | tr ' ' '\n'
$ PROTO: echo 'tcp udp' | tr ' ' '\n'
$ IPSET_TYPE: echo 'hash:ip'
$ IPSET: firewall-cmd --get-ipsets | tr ' ' '\n'