From a326c9e8677086f87a65771f1346a8c6d71b9e12 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Sat, 5 Jul 2014 21:11:59 +0000 Subject: [PATCH] Just add this for now to get rid of ssh noise at coloamer01 --- roles/base/tasks/main.yml | 1 + .../base/templates/iptables/iptables.coloamer | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 roles/base/templates/iptables/iptables.coloamer diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index eb66350b5d..f960e7ec5c 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -92,6 +92,7 @@ - name: iptables template: src={{ item }} dest=/etc/sysconfig/iptables mode=600 backup=yes with_first_found: + - ../templates/iptables/iptables.{{ datacenter }} - ../templates/iptables/iptables.{{ ansible_fqdn }} - ../templates/iptables/iptables.{{ host_group }} - ../templates/iptables/iptables.{{ env }} diff --git a/roles/base/templates/iptables/iptables.coloamer b/roles/base/templates/iptables/iptables.coloamer new file mode 100644 index 0000000000..920ef2e2f3 --- /dev/null +++ b/roles/base/templates/iptables/iptables.coloamer @@ -0,0 +1,67 @@ +# {{ ansible_managed }} +*filter +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] + +# allow ping and traceroute +-A INPUT -p icmp -j ACCEPT + +# localhost is fine +-A INPUT -i lo -j ACCEPT + +# Established connections allowed +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + +# allow ssh only from needed ips +# vpn in from tun0 +-A INPUT -m conntrack --ctstate NEW -m tcp -p tcp --dport 22 -s 192.168.0.0/24 -i tun0 -j ACCEPT +# external ip for phx2 +-A INPUT -m conntrack --ctstate NEW -m tcp -p tcp --dport 22 -s 209.132.181.0/24 -j ACCEPT +# external ip for scrye +-A INPUT -m conntrack --ctstate NEW -m tcp -p tcp --dport 22 -s 75.148.32.185 -j ACCEPT + +# for fireball mode - allow port 5099 from lockbox and it's ips +-A INPUT -p tcp -m tcp --dport 5099 -s 192.168.1.58 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 5099 -s 10.5.126.23 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 5099 -s 10.5.127.51 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 5099 -s 209.132.181.6 -j ACCEPT + +# for nrpe - allow it from nocs +-A INPUT -p tcp -m tcp --dport 5666 -s 192.168.1.10 -j ACCEPT +# FIXME - this is the global nat-ip and we need the noc01-specific ip +-A INPUT -p tcp -m tcp --dport 5666 -s 209.132.181.102 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 5666 -s 209.132.181.35 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 5666 -s 10.5.126.41 -j ACCEPT + + +# if the host/group defines incoming tcp_ports - allow them +{% if tcp_ports is defined %} +{% for port in tcp_ports %} +-A INPUT -p tcp -m tcp --dport {{ port }} -j ACCEPT +{% endfor %} +{% endif %} + +# if the host/group defines incoming udp_ports - allow them +{% if udp_ports is defined %} +{% for port in udp_ports %} +-A INPUT -p udp -m udp --dport {{ port }} -j ACCEPT +{% endfor %} +{% endif %} + +# if there are custom rules - put them in as-is +{% if custom_rules is defined %} +{% for rule in custom_rules %} +{{ rule }} +{% endfor %} +{% endif %} + +# otherwise kick everything out +-A INPUT -j REJECT --reject-with icmp-host-prohibited +{% if virthost is defined %} +-A FORWARD -j ACCEPT +{% else %} +-A FORWARD -j REJECT --reject-with icmp-host-prohibited +{% endif %} +COMMIT