Defined Type: ferm::filter_log

Defined in:
modules/ferm/manifests/filter_log.pp

Overview

defines a custom ferm rule to filter logs

Parameters:

  • proto (Optional[Enum['tcp', 'udp']]) (defaults to: undef)
  • saddr (Optional[Stdlib::IP::Address]) (defaults to: undef)
  • daddr (Optional[Stdlib::IP::Address]) (defaults to: undef)
  • sport (Optional[Stdlib::Port]) (defaults to: undef)
  • dport (Optional[Stdlib::Port]) (defaults to: undef)


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
33
# File 'modules/ferm/manifests/filter_log.pp', line 2

define ferm::filter_log (
    Optional[Enum['tcp', 'udp']]  $proto = undef,
    Optional[Stdlib::IP::Address] $saddr = undef,
    Optional[Stdlib::IP::Address] $daddr = undef,
    Optional[Stdlib::Port]        $sport = undef,
    Optional[Stdlib::Port]        $dport = undef,
) {
  $_proto = $proto ? {
    undef   => '',
    default => "proto ${proto}",
  }
  $_saddr = $saddr ? {
    undef   => '',
    default => "saddr ${saddr}",
  }
  $_daddr = $daddr ? {
    undef   => '',
    default => "daddr ${daddr}",
  }
  $_sport = $sport ? {
    undef   => '',
    default => "sport ${sport}",
  }
  $_dport = $dport ? {
    undef   => '',
    default => "dport ${dport}",
  }
  ferm::rule { "filter_log_${name}":
    rule => "${_proto} ${_saddr} ${_daddr} ${_sport} ${_dport} DROP;",
    prio => '98',
  }
}