From 4b3fd7e66dc1ed8b577cb522859d290b313b4ab1 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 30 Oct 2013 20:56:45 +0100 Subject: Basic ansible setup. To run the playbook: cd ./ansible ansible-playbook -i vms site.yml --- roles/common/tasks/main.yml | 2 ++ roles/common/tasks/sysctl.yml | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 roles/common/tasks/main.yml create mode 100644 roles/common/tasks/sysctl.yml (limited to 'roles') diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 0000000..acc9611 --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include: sysctl.yml tags=sysctl diff --git a/roles/common/tasks/sysctl.yml b/roles/common/tasks/sysctl.yml new file mode 100644 index 0000000..4f52d3e --- /dev/null +++ b/roles/common/tasks/sysctl.yml @@ -0,0 +1,52 @@ +- sysctl: name={{ item.name }} value={{ item.value }} + with_items: + - { name: 'kernel.domainname', value: '{{ ansible_domain }}' } + + # Networking. See + # https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt + + # Enable Spoof protection (reverse-path filter). Turn on Source + # Address Verification in all interfaces to prevent some spoofing + # attacks. + - { name: 'net.ipv4.conf.default.rp_filter', value: 1 } + - { name: 'net.ipv4.conf.all.rp_filter', value: 1 } + + # Enable TCP/IP SYN cookies to avoid TCP SYN flood attacks. We + # rate-limit not only the default ICMP types 3, 4, 11 and 12 + # (0x1818), but also types 0 and 8. See icmp(7). + - { name: 'net.ipv4.tcp_syncookies', value: 1 } + - { name: 'net.ipv4.icmp_ratemask', value: 6425 } + - { name: 'net.ipv4.icmp_ratelimit', value: 1000 } + + # Disable paquet forwarding between interfaces (we are not a router). + - { name: 'net.ipv4.ip_forward', value: 0 } + - { name: 'net.ipv6.conf.all.forwarding', value: 0 } + + # Enable IPv6 Privacy Extensions. + - { name: 'net.ipv6.conf.default.use_tempaddr', value: 2 } + - { name: 'net.ipv6.conf.all.use_tempaddr', value: 2 } + - { name: 'net.ipv6.conf.all.autoconf', value: 0 } + + # Do not accept ICMP redirects (prevent MITM attacks). + - { name: 'net.ipv4.conf.all.accept_redirects', value: 0 } + - { name: 'net.ipv6.conf.all.accept_redirects', value: 0 } + + # Do not send ICMP redirects (we are not a router). + - { name: 'net.ipv4.conf.default.send_redirects', value: 0 } + - { name: 'net.ipv4.conf.all.send_redirects', value: 0 } + + # Do not accept IP source route packets (we are not a router). + - { name: 'net.ipv4.conf.all.accept_source_route', value: 0 } + - { name: 'net.ipv6.conf.all.accept_source_route', value: 0 } + + # Log Martian Packets. + - { name: 'net.ipv4.conf.all.log_martians', value: 1 } + + # Ignore ICMP broadcasts. + - { name: 'net.ipv4.icmp_echo_ignore_broadcasts', value: 1 } + + # Ignore bogus ICMP errors. + - { name: 'net.ipv4.icmp_ignore_bogus_error_responses', value: 1 } + + # Enable connection tracking flow accounting. + - { name: 'net.netfilter.nf_conntrack_acct', value: 1 } -- cgit v1.2.3