ericjarvies
12/11/2016 - 8:37 AM

iptables

iptables

tinc;

iptables -I INPUT -p udp --dport 655 -j ACCEPT
iptables -I INPUT -p tcp --dport 655 -j ACCEPT
iptables -I INPUT -i tinc -j ACCEPT
iptables -I FORWARD -i tinc -j ACCEPT

need ot figure out which of these work;

sudo iptables -A TCP -p tcp --dport 9200:9400 -s 10.136.x.x,10.134.x.x,10.129.x.x,10.137.x.x,189.252.x.x -j ACCEPT
sudo iptables -I INPUT 1 -p tcp --dport 9200:9400 -s 10.136.x.x,10.134.x.x,10.129.x.x,10.137.x.x,189.252.x.x -j ACCEPT
sudo iptables -I INPUT 4 -p tcp --dport 9200:9400 -j REJECT
sudo iptables -A TCP -p tcp --dport 9200:9400 -s 198.199.80.115 -j ACCEPT
sudo iptables -A INPUT -i eth0 -p tcp -m tcp --dport 9200:9400 -j ACCEPT
sudo iptables -A OUTPUT -p tcp -s 198.199.x.x --dport 9200 -m state --state ESTABLISHED -j ACCEPT
allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0;
>   -A INPUT -i lo -j ACCEPT
>   -A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT

accepts all established inbound connections;
>   -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

allows all outbound traffic;
>   -A OUTPUT -j ACCEPT

allows HTTP and HTTPS connections from anywhere (the normal ports for websites);
>   -A INPUT -p tcp --dport 80 -j ACCEPT
>   -A INPUT -p tcp --dport 443 -j ACCEPT

ElasticSearch;
>   -A INPUT -p tcp --dport 9200:9300 -j ACCEPT

Tinc;
>   -A INPUT -p tcp --dport 665 -j ACCEPT

allows SSH connections;
>   -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

allow FTP connections;
>   -A INPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
>   -A OUTPUT -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT

allow ping;
>   -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

log iptables denied calls;
>   -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

reject all other inbound - default deny unless explicitly allowed policy;
>   -A INPUT -j REJECT
>-A FORWARD -j REJECT