summaryrefslogtreecommitdiff
path: root/puppet/modules/site_shorewall/manifests/couchdb/bigcouch.pp
blob: 85272657fa573b95be175049c8dedadf03bd5575 (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_shorewall::couchdb::bigcouch {

  include site_shorewall::defaults

  $stunnel = hiera('stunnel')
  $bigcouch_replication_clients         = $stunnel['bigcouch_replication_clients']

  $bigcouch_replication_server          = $stunnel['bigcouch_replication_server']
  $bigcouch_replication_server_port     = $bigcouch_replication_server['accept']
  $bigcouch_replication_connect         = $bigcouch_replication_server['connect']

  # define macro for incoming services
  file { '/etc/shorewall/macro.leap_bigcouch':
    content => "PARAM   -       -       tcp    ${bigcouch_replication_server_port}",
    notify  => Service['shorewall'],
    require => Package['shorewall']
  }

  shorewall::rule {
      'net2fw-bigcouch':
        source      => 'net',
        destination => '$FW',
        action      => 'leap_bigcouch(ACCEPT)',
        order       => 300;
  }

  $bigcouch_shorewall_dnat_defaults = {
    'source'          => '$FW',
    'proto'           => 'tcp',
    'destinationport' => regsubst($bigcouch_replication_connect, '^([0-9.]+:)([0-9]+)$', '\2')
  }

  create_resources(site_shorewall::couchdb::dnat, $bigcouch_replication_clients, $bigcouch_shorewall_dnat_defaults)

}