When setting up an Ubuntu server, you'll want to establish basic security including a firewall to only allow certain types of requests, and to allow only certain types of responses. This code will:
- Flush your current firewall
- Because it's our server and we're not hosting other people's stuff (like a shared server), we'll allow all output
- Allow input requests for SSH, Port 80 and 443 (Web and TLS (SSL))
- Log bad requests with the prefix "iptables denied:"
- Then save these rules to a file called
/etc/iptables.up.rules