ferm: change ferm.conf to a template
authorAurelien Jarno <aurelien@aurel32.net>
Mon, 24 Aug 2015 10:03:33 +0000 (12:03 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Mon, 24 Aug 2015 10:03:33 +0000 (12:03 +0200)
So we can provide a different version for wheezy and jessie hosts

modules/ferm/files/ferm.conf [deleted file]
modules/ferm/manifests/init.pp
modules/ferm/templates/ferm.conf.erb [new file with mode: 0644]

diff --git a/modules/ferm/files/ferm.conf b/modules/ferm/files/ferm.conf
deleted file mode 100644 (file)
index 5f77ce4..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-##
-## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-##
-
-# -*- shell-script -*-
-
-@include 'conf.d/';
-
-domain ip {
-        table filter {
-              chain log_and_reject {
-                      ULOG ulog-prefix "REJECT: ";
-                      proto tcp REJECT reject-with tcp-reset;
-                      REJECT;
-              }
-
-              chain log_or_drop {
-                      mod hashlimit hashlimit-name ulogreject  hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second jump log_and_reject;
-                      mod hashlimit hashlimit-name uloglogdrop hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second ULOG ulog-prefix "DROP: ";
-                      DROP;
-              }
-
-        }
-}
-domain ip6 {
-        table filter {
-              chain log_and_reject {
-                      LOG log-prefix "REJECT: ";
-                      proto tcp REJECT reject-with tcp-reset;
-                      REJECT;
-              }
-
-              chain log_or_drop {
-                      mod hashlimit hashlimit-name logreject  hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second jump log_and_reject;
-                      mod hashlimit hashlimit-name loglogdrop hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second LOG log-prefix "DROP: ";
-                      DROP;
-              }
-        }
-}
-domain (ip ip6) {
-        table filter {
-              chain INPUT {
-                      policy ACCEPT;
-                      mod state state (ESTABLISHED RELATED) ACCEPT;
-                      interface lo ACCEPT;
-                      proto icmp ACCEPT;
-                      # some of our hosts (e.g. villa and lobos) do ipv6 via tunnels (proto 41)
-                      # this requires we allow proto ipv6 to work in all cases.
-                      # without this, ipv6 connectivity only works once the host itself
-                      # created some ipv6 connectivity to some place.
-                      proto ipv6 ACCEPT;
-                      mod state state (INVALID) DROP;
-              }
-        }
-}
-
-@include 'dsa.d/';
-
-domain (ip ip6) {
-        chain INPUT {
-                proto (tcp udp) mod multiport destination-ports (135 137 138 139 445 1026 1027 1433) DROP;
-                jump log_or_drop;
-        }
-}
-
-@hook post "umask 0177; iptables-save | sed -e 's/\[.*//' -e 's/^#.*//' | sha256sum > /var/run/iptables-ferm.checksum";
-@hook post "umask 0177; ip6tables-save | sed -e 's/\[.*//' -e 's/^#.*//' | sha256sum > /var/run/ip6tables-ferm.checksum";
-# vim:set et:
index 1469da6..ae4ea19 100644 (file)
@@ -77,7 +77,7 @@ class ferm {
                mode    => '0444',
        }
        file { '/etc/ferm/ferm.conf':
-               source  => 'puppet:///modules/ferm/ferm.conf',
+               content => template('ferm/ferm.conf.erb'),
                notify  => Service['ferm'],
        }
        file { '/etc/ferm/conf.d/me.conf':
diff --git a/modules/ferm/templates/ferm.conf.erb b/modules/ferm/templates/ferm.conf.erb
new file mode 100644 (file)
index 0000000..5f77ce4
--- /dev/null
@@ -0,0 +1,69 @@
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+# -*- shell-script -*-
+
+@include 'conf.d/';
+
+domain ip {
+        table filter {
+              chain log_and_reject {
+                      ULOG ulog-prefix "REJECT: ";
+                      proto tcp REJECT reject-with tcp-reset;
+                      REJECT;
+              }
+
+              chain log_or_drop {
+                      mod hashlimit hashlimit-name ulogreject  hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second jump log_and_reject;
+                      mod hashlimit hashlimit-name uloglogdrop hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second ULOG ulog-prefix "DROP: ";
+                      DROP;
+              }
+
+        }
+}
+domain ip6 {
+        table filter {
+              chain log_and_reject {
+                      LOG log-prefix "REJECT: ";
+                      proto tcp REJECT reject-with tcp-reset;
+                      REJECT;
+              }
+
+              chain log_or_drop {
+                      mod hashlimit hashlimit-name logreject  hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second jump log_and_reject;
+                      mod hashlimit hashlimit-name loglogdrop hashlimit-mode srcip hashlimit-burst 10 hashlimit 1/second LOG log-prefix "DROP: ";
+                      DROP;
+              }
+        }
+}
+domain (ip ip6) {
+        table filter {
+              chain INPUT {
+                      policy ACCEPT;
+                      mod state state (ESTABLISHED RELATED) ACCEPT;
+                      interface lo ACCEPT;
+                      proto icmp ACCEPT;
+                      # some of our hosts (e.g. villa and lobos) do ipv6 via tunnels (proto 41)
+                      # this requires we allow proto ipv6 to work in all cases.
+                      # without this, ipv6 connectivity only works once the host itself
+                      # created some ipv6 connectivity to some place.
+                      proto ipv6 ACCEPT;
+                      mod state state (INVALID) DROP;
+              }
+        }
+}
+
+@include 'dsa.d/';
+
+domain (ip ip6) {
+        chain INPUT {
+                proto (tcp udp) mod multiport destination-ports (135 137 138 139 445 1026 1027 1433) DROP;
+                jump log_or_drop;
+        }
+}
+
+@hook post "umask 0177; iptables-save | sed -e 's/\[.*//' -e 's/^#.*//' | sha256sum > /var/run/iptables-ferm.checksum";
+@hook post "umask 0177; ip6tables-save | sed -e 's/\[.*//' -e 's/^#.*//' | sha256sum > /var/run/ip6tables-ferm.checksum";
+# vim:set et: