Skip to content

Instantly share code, notes, and snippets.

@rcherara
Created January 5, 2019 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcherara/edec8a137c9c9220435b23013d2d1e93 to your computer and use it in GitHub Desktop.
Save rcherara/edec8a137c9c9220435b23013d2d1e93 to your computer and use it in GitHub Desktop.
Setup a basic configuration to allow SSH, HTTPS and HTTP incoming
#!/bin/sh
# Install ufw
sudo apt install ufw
# Create setup_firewall.sh and run
chmod +x ./setup_firewall.sh
# Then run the script:
sudo ./setup_firewall.sh.
# You can check the config at any time with
sudo ufw status verbose
# You can disable the ufw configuration at any time with: sudo ufw disable
#!/bin/sh
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment