summaryrefslogtreecommitdiff
path: root/puppet/modules/site_shorewall/manifests/dnat_rule.pp
blob: aa298408b0c199380892d317e14bb6bb5ed24d61 (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;
      }
    }
  }
}