aboutsummaryrefslogtreecommitdiff
path: root/manifests/daemon/relay.pp
blob: d5296de908a76bd204905e55a8844024dcbcaf74 (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
# relay definition
define tor::daemon::relay(
  $port                    = 0,
  $listen_addresses        = [],
  $outbound_bindaddresses  = [],
  # KB/s, defaulting to using tor's default: 5120KB/s
  $bandwidth_rate          = '',
  # KB/s, defaulting to using tor's default: 10240KB/s
  $bandwidth_burst         = '',
  # KB/s, 0 for no limit
  $relay_bandwidth_rate    = 0,
  # KB/s, 0 for no limit
  $relay_bandwidth_burst   = 0,
  # GB, 0 for no limit
  $accounting_max          = 0,
  $accounting_start        = [],
  $contact_info            = '',
  # TODO: autofill with other relays
  $my_family               = '',
  $address                 = "tor.${::domain}",
  $bridge_relay            = 0,
  $ensure                  = present ) {

  $nickname = $name

  if $outbound_bindaddresses == [] {
    $real_outbound_bindaddresses = $listen_addresses
  } else {
    $real_outbound_bindaddresses = $outbound_bindaddresses
  }

  concat::fragment { '03.relay':
    ensure  => $ensure,
    content => template('tor/torrc.relay.erb'),
    owner   => 'debian-tor',
    group   => 'debian-tor',
    mode    => '0644',
    order   => 03,
    target  => $tor::daemon::config_file,
  }
}