summaryrefslogtreecommitdiff
path: root/manifests/conntrack/helper.pp
blob: ea7fb2ed68997c02a612f46fa69d025f8c17ffbe (plain)
1
2
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
31
32
# Class for managing conntrack file: Helpers
#
# See http://shorewall.net/manpages/shorewall-conntrack.html for more info.
# The $name defines the helper, so this needs to match one of the helpers
# in the documentation.
define shorewall::conntrack::helper(
  $ensure = present,
  $options = '',
  $source = '-',
  $destination = '-',
  $proto,
  $destinationport,
  $sourceport = '',
  $user = '',
  $switch = '',
  $chain = 'PO',
  $order
) {

  $_helper = sprintf("__%s_HELPER", upcase($name))
  $_chain = ":${chain}"
  $_options = ''

  if ($options != '') {
    $_options = "(${options})"
  }

  shorewall::entry{"conntrack-${order}-${name}":
    ensure => $ensure,
    line => "?if ${_helper}\nCT:helper:${name}${_options}${_chain} ${source} ${destination} ${proto} ${destinationport} ${sourceport} ${$user} ${switch}\n?endif"
  }
}