summaryrefslogtreecommitdiff
path: root/puppet/modules/site_openvpn/manifests/resolver.pp
blob: d3963c95b8e484d688a5aee3eaecfdae67fa0900 (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
class site_openvpn::resolver {

  # this is an unfortunate way to get around the fact that the version of
  # unbound we are working with does not accept a wildcard include directive
  # (/etc/unbound/conf.d/*), when it does, these line definitions should
  # go away and instead the caching_resolver should be configured to
  # include: /etc/unbound/conf.d/*

  line {
    'add_tcp_resolver':
      ensure => present,
      file   => '/etc/unbound/unbound.conf',
      line   => 'server: include: /etc/unbound/conf.d/vpn_tcp_resolver',
      notify => Service['unbound'];

    'add_udp_resolver':
      ensure => present,
      file   => '/etc/unbound/unbound.conf',
      line   => 'server: include: /etc/unbound/conf.d/vpn_udp_resolver',
      notify => Service['unbound'];
  }

  file {
    '/etc/unbound/conf.d/vpn_udp_resolver':
      content => "interface: ${site_openvpn::openvpn_udp_network_prefix}.1\naccess-control: ${site_openvpn::openvpn_udp_network_prefix}.0/${site_openvpn::openvpn_udp_cidr} allow\n",
      owner   => root, group => root, mode => '0644',
      require => Service['openvpn'],
      notify  => Service['unbound'];

    '/etc/unbound/conf.d/vpn_tcp_resolver':
      content => "interface: ${site_openvpn::openvpn_tcp_network_prefix}.1\naccess-control: ${site_openvpn::openvpn_tcp_network_prefix}.0/${site_openvpn::openvpn_tcp_cidr} allow\n",
      owner   => root, group => root, mode => '0644',
      require => Service['openvpn'],
      notify  => Service['unbound'];
  }
}