summaryrefslogtreecommitdiff
path: root/manifests/daemon/control.pp
blob: 027a49d2f30aeb0c061d12b482274e0ce187f4b4 (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
# control definition
define tor::daemon::control(
  $ensure                          = 'present',
  $port                            = 0,
  $hashed_control_password         = '',
  $cookie_authentication           = 0,
  $cookie_auth_file                = '',
  $cookie_auth_file_group_readable = '',
) {

  if $ensure == 'present' {
    if $cookie_authentication == '0' and $hashed_control_password == '' {
      fail('You need to define the tor control password')
    }

    if $cookie_authentication == 0 and ($cookie_auth_file != '' or $cookie_auth_file_group_readable != '') {
      notice('You set a tor cookie authentication option, but do not have cookie_authentication on')
    }

    concat::fragment { '04.control':
      content => template('tor/torrc.control.erb'),
      order   => '04',
      target  => $tor::daemon::config_file,
    }
  }
}