Puppet Class: roadwarrior::firewall

Defined in:
manifests/firewall.pp

Overview

Parameters:

  • manage_firewall_v4 (Any) (defaults to: $::roadwarrior::manage_firewall_v4)
  • manage_firewall_v6 (Any) (defaults to: $::roadwarrior::manage_firewall_v6)


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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'manifests/firewall.pp', line 4

class roadwarrior::firewall (
  $manage_firewall_v4 = $::roadwarrior::manage_firewall_v4,
  $manage_firewall_v6 = $::roadwarrior::manage_firewall_v6,
) {

  # IPv4
  if ($manage_firewall_v4) {

    # Enable packet fowarding
    if (!defined(Sysctl['net.ipv4.ip_forward'])) {
      sysctl { 'net.ipv4.ip_forward':
        value => '1',
      }
    }

    # Standard IPSec port
    firewall { '100 V4 Permit StrongSwan 500':
      provider => 'iptables',
      proto    => 'udp',
      dport    => '500',
      action   => 'accept',
    }

    # NAT-friendly IPSec port
    firewall { '100 V4 Permit StrongSwan 4500':
      provider => 'iptables',
      proto    => 'udp',
      dport    => '4500',
      action   => 'accept',
    }
  }


  # IPv6
  if ($manage_firewall_v6) {
    
    # Enable packet fowarding
    if (!defined(Sysctl['net.ipv4.ip_forward'])) {
      sysctl { 'net.ipv6.conf.all.forwarding':
        value => '1',
      }
    }

    # Standard IPSec port
    firewall { '100 V6 Permit StrongSwan 500':
      provider => 'ip6tables',
      proto    => 'udp',
      dport    => '500',
      action   => 'accept',
    }

    # NAT-friendly IPSec port
    firewall { '100 V6 Permit StrongSwan 4500':
      provider => 'ip6tables',
      proto    => 'udp',
      dport    => '4500',
      action   => 'accept',
    }
  }


}