Last active
February 25, 2018 20:20
-
-
Save atma/6002916 to your computer and use it in GitHub Desktop.
Basic rules for securing ubuntu VPS with ufw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# default rule | |
sudo ufw default deny | |
# allow ssh | |
sudo ufw allow 22/tcp | |
# enable firewall | |
sudo ufw enable | |
# allow https? | |
sudo ufw allow 80/tcp | |
sudo ufw allow 443/tcp | |
# check status | |
sudo ufw status | |
# blocking a port | |
sudo ufw deny port <port number> | |
# blocking an IP | |
sudo ufw deny from <ip address> | |
# blocking a specific ip address and port | |
sudo ufw deny from <ipaddress> to port <port number> | |
# blocking an IP range to specifoc port example | |
sudo ufw deny from 10.0.0.1/24 to any port 22 | |
# remove rule | |
sudo ufw delete <rule type> from <ip address> to any port <port number> | |
## https://help.ubuntu.com/community/UFW | |
## http://www.howtogeek.com/115116/how-to-configure-ubuntus-built-in-firewall/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment