Skip to content

Instantly share code, notes, and snippets.

@mdrmike
Last active May 19, 2020 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdrmike/fa10238831915a988298 to your computer and use it in GitHub Desktop.
Save mdrmike/fa10238831915a988298 to your computer and use it in GitHub Desktop.
Quick Firewall Setup for VBox Development using ufw

#Quick Firewall Setup for VBox (and easily modified for Desktop) Development

Based on Firewall Ubuntu Desktops and Forums: Creating a Firewall for Your Ubuntu Desktop Both from: Do I Need a Firewall

# Check Firewall Status
sudo ufw status verbose
# Quick setup
sudo ufw --force reset                                                      # reset firewall
sudo ufw default deny                                                       # deny as default
sudo ufw allow out 53,67,68,137,138/udp                                     # Allow outbound DNS,dhcp,dhcp,netbios(SAMBA),netbios(SAMBA)/udp
sudo ufw allow out 22,80,110,139,443,587,2083,2222,8025,7000,32415/tcp      # Allow outbound  SSH,HTTP,POP3,SAMBA,HTTPS,SMTP,LiquidWeb-cpanel,mailhog,IRC,ssh2/tcp
sudo ufw allow out on vboxnet1                                              # VBOX ONLY: allow vboxnet1 for HostOnly network (might need to change to vboxnet0, etc
sudo ufw allow in on vboxnet1                                               # VBOX ONLY: allow vboxnet1 for HostOnly network (might need to change to vboxnet0, etc
sudo ufw deny out to any                                                    # deny any other port
sudo ufw enable
sudo ufw status verbose
# Deny incoming
sudo ufw default deny

#  Allow 
# outgoing dns(53tcp/UDP), dhcp (67,68/UDP)
# Basic services:
# DNS (Domain Name Service) = protocol udp port 53.
# Web browsing = http protocol tcp port 80.
# Secure web browsing = https protocol tcp port 443.
# SSH = protocol tcp port 22, (+2222, +32415)
# mailhog for Development 8025
# liquid web port for cpanel 2083
# Samba uses multiple ports, protocol udp ports 137 and 138 as well as tcp ports 139, and 445.
# IRC Freenode 7000
# Mail = protocol tcp port 25.
# FTP = protocol tcp port 20 and 21.
# VNC = protocol tcp port 5900.
# IRC protocol tcp , Ubuntu Servers defaults to 8001.
# POP3 110
# SMTP 587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment