Add initial ip6tables to base.

This commit is contained in:
Kevin Fenzi 2015-02-06 21:20:11 +00:00
parent 2a5feef336
commit 8622c15919
3 changed files with 78 additions and 0 deletions

View file

@ -38,6 +38,9 @@
- name: restart iptables
action: service name=iptables state=restarted
- name: restart ip6tables
action: service name=ip6tables state=restarted
- name: restart jenkins
action: service name=jenkins state=restarted

View file

@ -127,6 +127,29 @@
- service
- base
- name: ip6tables
template: src={{ item }} dest=/etc/sysconfig/ip6tables mode=600 backup=yes
with_first_found:
- ../templates/iptables/ip6tables.{{ datacenter }}
- ../templates/iptables/ip6tables.{{ ansible_fqdn }}
- ../templates/iptables/ip6tables.{{ host_group }}
- ../templates/iptables/ip6tables.{{ env }}
- ../templates/iptables/ip6tables
notify:
- restart ip6tables
- hup libvirtd
tags:
- ip6tables
- config
- base
- name: ip6tables service enabled
service: name=ip6tables state=started enabled=true
tags:
- ip6tables
- service
- base
- name: rsyslog.conf
copy: src={{ item }} dest=/etc/rsyslog.conf mode=644
with_first_found:

View file

@ -0,0 +1,52 @@
# {{ ansible_managed }}
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
loopback allowed
-A INPUT -i lo -j ACCEPT
# Accept ping and traceroute (needs icmp)
-A INPUT -p ipv6-icmp -j ACCEPT
# Established connections allowed
-A INPUT -m state --state ESTABLISHED,RELATED -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 - always
-A INPUT -m conntrack --ctstate NEW -m tcp -p tcp --dport 22 -j ACCEPT
# for nrpe - allow it from nocs
-A INPUT -p tcp -m tcp --dport 5666 -s 192.168.1.10 -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 icmp6-adm-prohibited
-A FORWARD -j REJECT --reject-with icmp6-adm-prohibited
COMMIT