Skip to content

Commit

Permalink
Merge pull request #14 from rehanone/develop/ferm-as-firewall
Browse files Browse the repository at this point in the history
- Apply firewall rules if `ferm` is defined as firewall manager. It u…
  • Loading branch information
rehanone authored May 1, 2020
2 parents bf08e2c + 42e4fe4 commit 2afa34f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions manifests/firewall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@

assert_private("Use of private class ${name} by ${caller_module_name}")

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

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,
}
}
}
}
Expand Down

0 comments on commit 2afa34f

Please sign in to comment.