Skip to content

Instantly share code, notes, and snippets.

@amiad
amiad / iptables.sh
Last active November 28, 2017 09:25 — forked from thomasfr/iptables.sh
iptable rules to allow outgoing DNS lookups, all connection on port 80 and 443, incoming connections on SSH port, outgoing SMTP port, and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER=$(egrep -v '^#' /etc/resolv.conf | cut -f2 -d' ')
# SSH Port