Puppet Class: samba::firewall

Inherits:
samba
Defined in:
manifests/firewall.pp

Overview

@summary: Manage the firewall



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'manifests/firewall.pp', line 3

class samba::firewall () inherits samba {
  assert_private("Use of private class ${name} by ${caller_module_name}")

  if $samba::firewall_manage {
    $samba::hosts_allow.each |$network| {
      $samba::service_ports.each |$entry| {
        if defined('::firewall') {
          firewall { "${entry[port]} Allow SAMBA ${entry[proto]} connection on port: ${entry[port]} from: ${network}":
            dport  => $entry[port],
            source => $network,
            proto  => $entry[proto],
            action => accept,
          }
        }

        if defined('::ferm') {
          ferm::rule { "${entry[port]} Allow SAMBA ${entry[proto]} connection on port: ${entry[port]} from: ${network}":
            chain  => 'INPUT',
            action => 'ACCEPT',
            proto  => $entry[proto],
            dport  => $entry[port],
            saddr  => $network,
          }
        }
      }
    }
  }
}