summaryrefslogtreecommitdiff
path: root/puppet/modules/site_openvpn/manifests/keys.pp
blob: f3c5b423fe0e5fd31f47dcdb662fa1b3fad537c9 (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
49
50
51
class site_openvpn::keys {

  x509::key {
    'leap_openvpn':
      content => $site_openvpn::x509_config['key'],
      notify  => Service[openvpn];
  }

  x509::cert {
    'leap_openvpn':
      content => $site_openvpn::x509_config['cert'],
      notify  => Service[openvpn];
  }

  x509::ca {
    'leap_ca':
      content => $site_openvpn::x509_config['ca_cert'],
      notify  => Service[openvpn];
  }

  file { '/etc/openvpn/keys/dh.pem':
    content => $site_openvpn::x509_config['dh'],
    mode    => '0644',
  }

  #
  # CA bundle -- we want to have the possibility of allowing multiple CAs.
  # For now, the reason is to transition to using client CA. In the future,
  # we will want to be able to smoothly phase out one CA and phase in another.
  # I tried "--capath" for this, but it did not work.
  #

  concat {
    '/etc/openvpn/ca_bundle.pem':
      owner  => root,
      group  => root,
      mode   => 644,
      warn   => true,
      notify => Service['openvpn'];
  }

  concat::fragment {
    'client_ca_cert':
      content => $site_openvpn::x509_config['client_ca_cert'],
      target  => '/etc/openvpn/ca_bundle.pem';
    'ca_cert':
      content => $site_openvpn::x509_config['ca_cert'],
      target  => '/etc/openvpn/ca_bundle.pem';
  }

}