summaryrefslogtreecommitdiff
path: root/puppet/modules/site_shorewall/manifests/dnat_rule.pp
blob: 49b929f23ae9ed34a72dc74a9af2d1cbc4fa94a6 (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
define site_shorewall::dnat_rule {

  $port = $name
  if $port != 1194 {
    if $site_openvpn::openvpn_allow_unlimited {
      shorewall::rule {
          "dnat_tcp_port_${port}":
            action          => 'DNAT',
            source          => 'net',
            destination     => "\$FW:${site_openvpn::unlimited_gateway_address}:1194",
            proto           => 'tcp',
            destinationport => $port,
            order           => 100;
      }
      shorewall::rule {
          "dnat_udp_port_${port}":
            action          => 'DNAT',
            source          => 'net',
            destination     => "\$FW:${site_openvpn::unlimited_gateway_address}:1194",
            proto           => 'udp',
            destinationport => $port,
            order           => 100;
      }
    }
    if $site_openvpn::openvpn_allow_limited {
      shorewall::rule {
          "dnat_free_tcp_port_${port}":
            action          => 'DNAT',
            source          => 'net',
            destination     => "\$FW:${site_openvpn::limited_gateway_address}:1194",
            proto           => 'tcp',
            destinationport => $port,
            order           => 100;
      }
      shorewall::rule {
          "dnat_free_udp_port_${port}":
            action          => 'DNAT',
            source          => 'net',
            destination     => "\$FW:${site_openvpn::limited_gateway_address}:1194",
            proto           => 'udp',
            destinationport => $port,
            order           => 100;
      }
    }
  }
}