README: more on usage
This commit is contained in:
parent
77e26ef721
commit
cd87d9b743
1 changed files with 13 additions and 2 deletions
15
README.md
15
README.md
|
|
@ -35,9 +35,12 @@ Create a script that performs the tasks below. This can be run by cron.
|
|||
``ufw status verbose | grep DENY | awk '{print $4}' > autofw.blacklist``
|
||||
1. Run `./autofw > ufw.updates`.
|
||||
1. Run the `ufw.updates` script.
|
||||
1. Finally run `ufw reload` to activate the new rules.
|
||||
|
||||
Both the whitelist and blacklist can contain both individual IP addresses and ranges on the form a.b.c.d/e, where e is between 0 and 32.
|
||||
|
||||
To block machines trying to attack your SMTP server sending invalid commands, you can use a command such as the one below.
|
||||
Then simply add additional commands as needed.
|
||||
Then simply add additional commands as needed, based on your own log files from whatever applications you are running.
|
||||
|
||||
cat /var/log/mail.log |
|
||||
grep 'non-SMTP command' |
|
||||
|
|
@ -45,7 +48,10 @@ Then simply add additional commands as needed.
|
|||
tr '[]' ' ' |
|
||||
awk '{print $2}' >> autofw.badips
|
||||
|
||||
The output is a list of UFW commands.
|
||||
If you run `insert deny from x.y.z.w` manually at some point, that IP will stay blocked.
|
||||
It will then possibly be merged with any of the other blocked IP addresses.
|
||||
|
||||
The output from `./autofw` is a list of UFW commands.
|
||||
Here we assume we have blocked a.b.c.115 and a.b.c.116, and whitelisted e.f.g.h.
|
||||
The reason we first delete the rule for e.f.g.h and then add it back, is to make sure it comes first.
|
||||
This way whitelisted addresses can never be blocked.
|
||||
|
|
@ -56,3 +62,8 @@ This way whitelisted addresses can never be blocked.
|
|||
yes | ufw delete allow from e.f.g.h/32
|
||||
yes | ufw insert 1 allow from e.f.g.h/32
|
||||
|
||||
## TODO
|
||||
|
||||
- IPv6
|
||||
- Other firewall backends, such as raw iptables.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue