honeyjar
February 25th, 2012, 09:22 PM
I started using ufw to configure ubuntu firewall.
At the moment I have a basic setup that blocks all traffic except a few ports that I want:
sudo ufw default deny incoming
sudo ufw default deny outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 25/tcp
sudo ufw allow 443/tcp
sudo ufw enable
- My first question is, will this block udp traffic since I specified the default to deny incoming and outgoing?
- My second questions is, how can I get ufw to insert rules to block the IPs listed on the website? I know I have to write a script that wgets the files, but I'm not sure how to apply it to ufw. Furthermore, even if there's a way to apply it, how would one easily allow access by country again? Is there something along the lines of:
sudo ufw deny India.txt
sudo ufw deny Sweden.txt
Then if I want:
sudo ufw allow India.txt
sudo ufw allow Sweden.txt
The list of IPs by country is here: http://www.ipdeny.com/ipblocks/
- My third question is, if someone uses a proxy to bypass the above deny by country IP, is there a way for ufw to automatically block that specific IP after a certain amount of tries? I know there's the limit command:
ie,
sudo ufw limit ssh/tcp
But I am unsure if the IP will be blocked permanently or just temporarily by ufw? That is, will it automagically insert rules before my other rules that I've defined, and it'll show up in ufw status?
At the moment I have a basic setup that blocks all traffic except a few ports that I want:
sudo ufw default deny incoming
sudo ufw default deny outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 25/tcp
sudo ufw allow 443/tcp
sudo ufw enable
- My first question is, will this block udp traffic since I specified the default to deny incoming and outgoing?
- My second questions is, how can I get ufw to insert rules to block the IPs listed on the website? I know I have to write a script that wgets the files, but I'm not sure how to apply it to ufw. Furthermore, even if there's a way to apply it, how would one easily allow access by country again? Is there something along the lines of:
sudo ufw deny India.txt
sudo ufw deny Sweden.txt
Then if I want:
sudo ufw allow India.txt
sudo ufw allow Sweden.txt
The list of IPs by country is here: http://www.ipdeny.com/ipblocks/
- My third question is, if someone uses a proxy to bypass the above deny by country IP, is there a way for ufw to automatically block that specific IP after a certain amount of tries? I know there's the limit command:
ie,
sudo ufw limit ssh/tcp
But I am unsure if the IP will be blocked permanently or just temporarily by ufw? That is, will it automagically insert rules before my other rules that I've defined, and it'll show up in ufw status?