summaryrefslogtreecommitdiff
path: root/manifests/implementations/shorewall/router/torrent.pp
blob: 7ca7e1e5d31b23025194c780de564a6c10d54160 (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::implementations::shorewall::router::torrent(
  $destination,
  $zone         = 'loc',
  $originaldest = $ipaddress,
  $range        = lookup('firewall::torrent::range', undef, undef, '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,
  }
}