summaryrefslogtreecommitdiff
path: root/manifests/router/torrent.pp
blob: be8007192a529d3fb903c0a6cada8161453d3a25 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class firewall::router::torrent(
  $destination,
  $zone         = 'loc',
  $originaldest = $ipaddress,
  $range        = hiera('firewall::torrent::range', '6881:6999')
) {
  shorewall::rule { "torrent-tcp-1":
    action          => 'DNAT',
    source          => 'net',
    destination     => "$zone:$destination",
    proto           => 'tcp',
    destinationport => "$range",
    ratelimit       => '-',
    order           => 200,
  }

  shorewall::rule { "torrent-tcp-2":
    action          => 'DNAT',
    source          => 'all',
    destination     => "$zone:$destination",
    proto           => 'tcp',
    destinationport => "$range",
    originaldest    => "$originaldest",
    ratelimit       => '-',
    order           => 200,
  }

  shorewall::rule { "torrent-udp-1":
    action          => 'DNAT',
    source          => 'net',
    destination     => "$zone:$destination",
    proto           => 'udp',
    destinationport => "$range",
    ratelimit       => '-',
    order           => 201,
  }

  shorewall::rule { "torrent-udp-2":
    action          => 'DNAT',
    source          => 'all',
    destination     => "$zone:$destination",
    proto           => 'udp',
    destinationport => "6881:6999",
    originaldest    => "$originaldest",
    ratelimit       => '-',
    order           => 201,
  }
}